netd…@kernel.org writes:
> [Severity: Low]
> This isn't a bug, but bpf_xdp_adjust_tail() in net/core/filter.c still has
> this comment above its linear grow check:
[...]
> Should that comment be updated as well?
Yes, will fix.
> [Severity: Critical]
> Can this overflow the skb_shared_info of the skb built by
> xdp_build_skb_from_zc() in net/core/xdp.c?
[...]
> Should truesize be sized from (data_end - data_hard_start) +
> SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), or should the copy be
> bounded some other way?
You're right. It already happens for single-buffer pools, which give the
device the whole chunk (Clément reported that case earlier [1]), and
this patch extends it to multi-buffer pools and to tail growth. I'll add
the apatch in front that sizes the skb head from the data, as you
suggest, and gives a head that does not fit a page its own allocation.
[1] https://lore.kernel.org/bpf/2026…@google.com/
> [Severity: High]
> A related question: can the LARGEST_ALIGN(len) copy in
> xdp_build_skb_from_zc() now read past the end of the UMEM chunk?
Ya. The same new patch copies the exact length, for the head and the
fragments. The new patch fixes those.
> [Severity: Low]
> This isn't a bug, but struct xsk_buff_pool documents this section as
> "Members only used in the control path first.". The data path members
> start at the cacheline aligned fq.
[...]
> Would it fit better with the data path members?
I'd keep it next to xskb_list, which tracks the same packet and is also
used on the data path.
> [Severity: Medium]
> Does the shared info flag really stay for virtio_net in zero-copy
> mode?
[...]
> Should xp_alloc() and xsk_buff_set_size() set XDP_FLAGS_SINFO_EXT
> instead of only keeping it? xp_alloc_batch() would need the same
> treatment, since virtio_net allocates through it. Alternatively,
> should buf_to_xdp() clear only XDP_FLAGS_HAS_FRAGS?
Good point. In the next version every buffer gets the flag when the pool
is created, and set again.
> [Severity: Medium]
> Is there a window here where a head already has XDP_FLAGS_SINFO_EXT and
> the new rxq, but rxq->ext_sinfo is still NULL?
[...]
> Would storing rxq->ext_sinfo before publishing rxq on the heads, with
> release/acquire or WRITE_ONCE() ordering, close this window? Requiring a
> quiesced datapath here would also work.
Yup. As the flag is set at creation, xp_set_rxq_info() no longer touches
the flags. I'll fence the stores rxq->ext_sinfo in the next version.
Switching the queue under a running NAPI is older than this series.
pw-bot: cr
Björn