RE: Re: Re: Re: Re: [PATCH bpf v2] xsk: Fix out of order segment free in __xsk_generic_xmit()

From: Eryk Kubanski
Date: Tue Jun 10 2025 - 05:12:57 EST


> I've come with something as below. Idea is to embed addr at the end of
> linear part of skb/at the end of page frag.

Are you sure that this is safe for other components?

So instead of storing entire array at the skb_shared_info (skb->end),
we store It 8-bytes per PAGE fragment and 8-byte at skb->end.
Technically noone should edit skb past-the-end, it
looks good to me.

In xsk_cq_submit_locked() you use only xskq_prod_write_addr.
I think that this may cause synchronization issues on reader side.
You don't perform ATOMIC_RELEASE, so this producer incrementation
is atomic (u32) but it doesn't synchronize address write.

I think that you should accumulate local producer and
store it with ATOMIC_RELEASE after writing descriptors.
In current situation someone may see producer incrementation,
but address stored in this bank doesn't need to be synchronized yet.