Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit message understates how much of the shared info the old xdp_build_skb_from_zc() let a sender overwrite. -- xdp: Size zero-copy skbs from the data, not the frame size This patch changes how xdp_build_skb_from_zc() sizes the skb head. It now uses data_end - data_hard_start instead of the XSk frame size, so packet data can no longer overwrite the skb_shared_info. It also copies the exact head and fragment lengths instead of rounding them up with LARGEST_ALIGN(). Heads larger than a page now come from __netdev_alloc_skb(). Link: https://lore.kernel.org/bpf/2026…@google.com/
> With 2K chunks, no UMEM > headroom and the default MTU, a 1514 byte frame that XDP passes on > ice, idpf or gve needs 256 + 1514 + 320 = 2090 bytes and gets 2048. > The sender controls up to 48 bytes of the shared info, its frag list > among them.
[Severity: Low] Is "up to 48 bytes" the real upper bound, or only the overflow for this example? The 48 bytes come from 1514 rounded up to 1520 by LARGEST_ALIGN(): 256 + 1520 + 320 - 2048 = 48. For single-buffer pools, xsk_pool_get_rx_frame_size() subtracts the shared info tailroom only for multi-buffer pools: include/net/xdp_sock_drv.h:xsk_pool_get_rx_frame_size() { ... mbuf = pool->dev && (umem->flags & XDP_UMEM_SG_FLAG); frame_size -= xsk_pool_get_tailroom(mbuf); return ALIGN_DOWN(frame_size, 128); } xp_create_and_assign_umem() sets frame_sz to the whole chunk: xskb->xdp.frame_sz = umem->chunk_size - umem->headroom; The commit message says a device may fill a single-buffer frame to its end. In that case data_end - data_hard_start can equal frame_sz. One example is a 2K chunk whose 1792 byte rx buffer is filled after a raised MTU. Another is 4K chunks with 3840 byte frames. The old code built the head with napi_build_skb(data, xdp->frame_sz). That left only frame_sz - 320 bytes of linear room. So the copy would overwrite all of SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), which is 320 bytes on x86_64, including frags[]. With 4K chunks, the LARGEST_ALIGN() rounding could also write past the page handed out by the system page pool. The sender also controls more than the frag list in the first 48 bytes. The flags, nr_frags, frag_list, dataref and destructor_arg fields all sit there. A chosen SKBFL_ZEROCOPY_* flag combined with a chosen destructor_arg gives a callback pointer. Could the commit message give the worst case as the whole shared info rather than 48 bytes? The code change closes the whole overflow. Only the stated impact looks understated.
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40kernel.org