Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by bot+bpf-ci
Thu, 19 Nov 2026 14:11
Re: [PATCH v7 bpf 2/5] xdp: introduce xdp_convert_skb_to_buff()
Author: bot+bpf-ci
Date: Thu, 19 Nov 2026 14:11
Date: Thu, 19 Nov 2026 14:11
81 lines
11449 bytes
11449 bytes
--===============5181703165338020747== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > xdp: introduce xdp_convert_skb_to_buff() TL;DR: - Commit message calls the bug a page leak; it may be a use-after-free of page_pool pages - Stable Cc 6.4.x predates the Fixes: tag (v6.9) - kdoc may overstate mem type usage (nit) > Then when bpf_xdp_adjust_tail() calls > __xdp_return(), it acts incorrectly due to mem type not being set to > MEM_TYPE_PAGE_POOL and causes a page leak. Is "causes a page leak" the full impact? The mechanism is bpf_xdp_adjust_tail() -> bpf_xdp_frags_shrink_tail() -> bpf_xdp_shrink_data() -> __xdp_return(netmem, MEM_TYPE_PAGE_SHARED) -> page_frag_free(). That ends in put_page_testzero() on a page_pool page. With page checks enabled this is reported as "page_pool leak" and the page is not freed. Without them, page_pool keeps _refcount at 1 and counts fragment users in pp_ref_count, and skb_pp_cow_data() allocates fragment-sized chunks. A single page_frag_free() can therefore hand back to the buddy allocator a page that other skbs or pool->frag_page still use, which looks like a use-after-free rather than only a leak. Could the commit message describe that? > Cc: <stable@vger.kernel.org> # 6.4.x The Fixes: tag points at e6d5dbdd20aa, which first landed in v6.9. Before that, generic XDP linearized every skb and never set the frags flag, so this bug cannot occur on 6.4 through 6.8. The later veth patch in this series (1d3541dbf827) appears to be why 6.4.x is listed, since it uses this helper and needs it as a backport prerequisite. Could the commit message either say that, or align the stable range with the Fixes: tag? > diff --git a/include/net/xdp.h b/include/net/xdp.h > --- a/include/net/xdp.h > +++ b/include/net/xdp.h [ ... ] > +/** > + * xdp_convert_skb_to_buff - build an xdp_buff on top of an skb > + * @skb: skb to describe, packet data is taken from its MAC header onwards > + * @xdp: xdp_buff to initialize > + * @xdp_rxq: Rx queue info to attach to @xdp > + * > + * The memory type set on @xdp_rxq is only used to release fragments that > + * the XDP program consumes; the head can not be freed from under the skb. > + * A non-linear @skb is expected to have gone through skb_pp_cow_data(), so > + * all of its fragments are page_pool backed. > + */ This isn't a bug, but is the "only used to release fragments" statement a property of this helper, or of its current caller? It holds for generic XDP. However, the veth patch later in this series (1d3541dbf827) converts the xdp_buff to an xdp_frame on XDP_TX and XDP_REDIRECT, where the head is released through the same mem type, and it has to overwrite rq->xdp_rxq.mem after calling this helper. The kdoc also does not mention that the mem type stays set on the caller's possibly shared @xdp_rxq after the call. Should the kdoc say that these properties depend on the caller? --- AI reviewed your patch. Please fix the bug or email reply why it's not a bug. See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md CI run summary: https://github.com/kernel-patches/bpf/actions/runs/44535627869 --===============5181703165338020747==--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads