BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiayuan Chen" <jiayuan.chen@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf] bpf: free page_pool frags via the page_pool path in bpf_xdp_shrink_data
Date: Sun, 16 Aug 2026 03:37:52 +0000	[thread overview]
Message-ID: <20260816033752.794AE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260816031245.268898-1-jiayuan.chen@linux.dev>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The netmem_is_pp() check fails on compound tail pages, leading to page_pool leaks and 'Bad page state' kernel panics.
- [Low] The multi-line comment introduced in bpf_xdp_shrink_data() does not follow the required BPF subsystem comment style.
--

--- Patch [1]: [PATCH bpf] bpf: free page_pool frags via the page_pool path in bpf_xdp_shrink_data ---
commit 28e0b86b119236ed1263628b895946efb16e99cf
Author: Jiayuan Chen <jiayuan.chen@linux.dev>

bpf: free page_pool frags via the page_pool path in bpf_xdp_shrink_data

This commit fixes a page_pool leak reported by syzbot when generic XDP
programs shrink skbs into fragments. It inspects the page itself using
netmem_is_pp() rather than relying on the rxq memory model.

Closes: https://syzkaller.appspot.com/bug?extid=237bbeed8dfe0699b7f5

> diff --git a/net/core/filter.c b/net/core/filter.c
> index 3423734124a5b..4536bd147c253 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c

[ ... ]

> @@ -4293,6 +4294,14 @@ static bool bpf_xdp_shrink_data(struct xdp_buff *xdp, skb_frag_t *frag,
>  	if (mem_type == MEM_TYPE_XSK_BUFF_POOL) {
>  		netmem = 0;
>  		zc_frag = bpf_xdp_shrink_data_zc(xdp, shrink, tail, release);
> +	} else if (netmem_is_pp(netmem)) {

[Severity: High]
Does this check handle compound tail pages correctly?

For fragments that span into tail pages of a compound page (such as those
from an order > 0 page_pool allocation), calling netmem_is_pp() directly on
the tail page might fail to find the page_pool signature. Tail pages store
compound_info in the memory location overlapping with pp_magic.

Would it be safer to check the compound head page here, perhaps using
netmem_compound_head(netmem) before checking the signature? Otherwise, tail
pages might still route to the wrong destructor and trigger the Bad page
state panic this patch aims to fix.

> +		/* The rxq mem model does not always describe how a released
> +		 * frag must be freed: the generic-XDP and veth paths run the

[Severity: Low]
This isn't a bug, but does this follow the required BPF subsystem multi-line
comment style?

The style guide requires the opening /* to be on its own line:

/*
 * The rxq mem model does not always describe...

> +		 * program on a shared rxq while the frag has been cow'd into
> +		 * page_pool memory. Trust the page itself and return a
> +		 * page_pool frag to its pool regardless of rxq->mem.type.
> +		 */
> +		mem_type = MEM_TYPE_PAGE_POOL;
>  	}
>  
>  	if (release) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260816031245.268898-1-jiayuan.chen@linux.dev?part=1

  reply	other threads:[~2026-08-16  3:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16  3:12 [PATCH bpf] bpf: free page_pool frags via the page_pool path in bpf_xdp_shrink_data Jiayuan Chen
2026-08-16  3:37 ` sashiko-bot [this message]
2026-08-16  5:10   ` Jiayuan Chen
2026-08-16  3:57 ` bot+bpf-ci
2026-08-16  5:16   ` Jiayuan Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260816033752.794AE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox