Article View: linux.kernel.netdev
Article #6125Re: [PATCH bpf] net: return page_pool frags to the pool in bpf_xdp_shrink_data()
From: bot+bpf-ci
Date: Wed, 21 Oct 2026 16:59
Date: Wed, 21 Oct 2026 16:59
69 lines
10823 bytes
10823 bytes
--===============4988805122012070755==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
> net: return page_pool frags to the pool in bpf_xdp_shrink_data()
TL;DR: Commit message only: the Fixes tag (4dce1a0d7cf3) may be wrong;
e6d5dbdd20aa (v6.9, generic XDP multi-buff) seems the real origin, so stable
backport scope is understated.
> net: return page_pool frags to the pool in bpf_xdp_shrink_data()
>
> bpf_xdp_shrink_data() releases a fully-shrunk frag through
> __xdp_return(netmem, mem_type, false, zc_frag), selecting the freer from
> the rxq's mem type. Under generic XDP the rxq's xdp_rxq_info often has no
> mem model registered (e.g. loopback), so mem_type stays
> MEM_TYPE_PAGE_SHARED == 0 even though the frag was allocated from a page
> pool by skb_pp_cow_data(). __xdp_return() then frees the page through
> page_frag_free() instead of page_pool_put_full_netmem(), so the page is
> returned to the buddy allocator while its page_pool accounting is still
> live:
>
> BUG: Bad page state in process A-146-S3_S1 pfn:4694b
> page dumped because: page_pool leak
> page_frag_free+0xf0/0x11c
> __xdp_return+0x160/0x640
> bpf_xdp_adjust_tail+0x5a4/0xbac
> bpf_prog_run_generic_xdp+0x4a8/0x1204
>
> Before falling back to __xdp_return(), try the page_pool path: if the
> frag really is a page_pool page, napi_pp_put_page() recycles it through
> the pool and we are done.
>
> Fixes: 4dce1a0d7cf3 ("bpf: Support pulling non-linear xdp data")
> Assisted-by: LLM
> Signed-off-by: Dudu Lu <phx0fer@gmail.com>
Is the Fixes: tag pointing at the right commit?
4dce1a0d7cf3 only added bpf_xdp_pull_data() as a new caller of
bpf_xdp_shrink_data(). The splat in the commit message goes through
bpf_xdp_adjust_tail() -> bpf_xdp_frags_shrink_tail() -> __xdp_return(),
which already freed released frags based on xdp->rxq->mem.type
(MEM_TYPE_PAGE_SHARED when no mem model is registered, as in generic XDP)
since c5114710c8ce ("xsk: fix usage of multi-buffer BPF helpers for ZC XDP")
and bf25146a5595 ("bpf: add frags support to the bpf_xdp_adjust_tail() API").
The mismatch only became possible when e6d5dbdd20aa made
netif_receive_generic_xdp() build non-linear xdp_buffs from page_pool backed
frags via skb_pp_cow_data(), while the generic XDP rxq has no registered mem
model. From then on the adjust_tail shrink path freed page_pool pages with
page_frag_free(), and the "page_pool leak" check already existed via
dba1b8a7ab68 ("mm/page_pool: catch page_pool memory leaks").
e6d5dbdd20aa landed in v6.9 while 4dce1a0d7cf3 landed in v6.18, so the
current tag understates the stable backport scope. Should this instead
include:
Fixes: e6d5dbdd20aa ("xdp: add multi-buff support for xdp running in generic mode")
---
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/39631548606
--===============4988805122012070755==--
Technical Details
Message-ID:
<584b50e286edb7bf068660ad5221f7181c60a28871c5ed50b1d8cf00ba17a8ec@mail.kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350158-linux-kernel-netdev=dewy.ruReferences:
<20261021155645.69120-1-phx0fer@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350158-linux-kernel-netdev=dewy.ru From: bot+bpf-ci@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH bpf] net: return page_pool frags to the pool in bpf_xdp_shrink_data() Date: Wed, 21 Oct 2026 16:59:05 +0000 (UTC) Organization: Usenet Network Message-ID: <584b50e286edb7bf068660ad5221f7181c60a28871c5ed50b1d8cf00ba17a8ec@mail.kernel.org> References: <20261021155645.69120-1-phx0fer@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4988805122012070755==" Injection-Info: usenet.network; logging-data="12720"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:o/G2GguMs0U9dJtf8DbBoI7QBVk= sha256:wk0zWXabdRTDHed5eEMvaMtiOXQrIIun8O3/0/UpBUY= sha1:SjurmHCOeReppG5uBf6yyYSj6bE= sha256:3ZeiIN4AU1//tpeovIkt+V5LJQlxPdse0bluH3Xkeps= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 927B01110AD; Wed, 21 Oct 2026 20:01:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mbipJjtGawrK; Wed, 21 Oct 2026 20:00:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-350158-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id D8D50111062; Wed, 21 Oct 2026 20:00:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id E44D73AE28; Wed, 21 Oct 2026 16:59:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792601952; b=aLpNB39uUJ49RZowFndonoFLmZN62yoUHjLNL6qKaM9kKx2nXiDsuVsmFQTBKoQRaj6K d4H72U97XxPbQYZDieHE4xYbXR0AWDyDM1lfdch7korr3jLFkvn7rJPMPPVAkDRa+PTyq Nu58M7pfJ0+dQMDW3aqGGQJWX92jbxBHBtk5+NoqCuU49rMW1U5C0cIHGuBB8XLN2cree PeIK4+q7MqTMfmjzxVYg3OSm3HNFOmfagwxBBmxOR+c5kjMeQYcR2dgSrCyorBK4R1Wpi zzRO2yikOH1T7wOUlAdLLed3L2x4DVNit5e/wzMs2x4Sj/d25ds6l3/xabs1/2pMcVw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792601952; h=X-Original-To:Received:Received:DKIM-Signature:Content-Type: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=Ch+cdHNWdqSBOJQDfma07OavdtmO6Fn0ukfkIr5qp2w=; b=EV7HBk5hthMzqt97LIO/qWTz+W5OkUzRgeuw3lZIyvI4f7/QNc5mp/1L0gX73/311/oD LxMX1gHvUn3QooXj0B7SL98Fl+4iMzOx8dR5U7baEtyvzLkicHl2/jScXolydQ2i2jeM5 29C1CG0+ZuvsLiAvlftecQ7Zc3BGyhpVdtM1TZBNWBAs0x1bvThpmjwFAcBLr7K78dLHV zm2TaJb5bXij9FxtpKi4Q9r7cZRYd316MgKGSjcFfS1/trnZHavreCfRy/br1boTluO1q I9lXh8hcTb6LJnAwlOgkPUHbeavlKmpaEzkb9OlA95yME5KEoFqrDY2Ipn9bKpVlNPg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WH2fDS9g; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E9F2606A31F; Wed, 21 Oct 2026 16:59:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WH2fDS9g X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792601946; b=lhqIBoyBSaqnph0K8Yzy80OTb4rNpoWyd1eippDXVOArD+fpUBAfE40LIdq+Do+Bqtj5 b3T2DacXzuZhP0x1WzS/LAF97QqmRNRaEsS6niIvSCFSeIh3vas6+DLKBI6oGy/xbmLtC mvXyQcNKuFhEXnEir+C4tAkjUguvgHRIIjmV4copUpHZ91yRjoRAR+XFUUGEq5/gjaYqL hRiH2QyfCS/GCWvOCXjTN8ylRf8QiyGEnVvaU4ZD5mkvHfiMNAtoC1P9bIFQND62+nC9L kTEaL44JFA1UJCw1sYK7nYwQ+0v0DAy64G+R7Wj47DDTwVBf4fgDLp7/z7YNQdAHZcg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792601946; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=Ch+cdHNWdqSBOJQDfma07OavdtmO6Fn0ukfkIr5qp2w=; b=kNYXF53fWvlVkJ0v1sF/ouM/PmgAB8rRaTyjs2dNeKpy5PRX+WKX29OkPt9nsFz3T9+b KS6WgJS07av2yZcuCHYn5eTeumA0lWNtMqMkxldTHHke9Sxg5mOyJU//QF6MSLOyxr7Gl di3mIVAi2J6KfD9b72B5WmLprtb8ZTejo+7Y4M7ZLML9nPb+0K3QyyHAJ7SCgGrZGYrEd 4i3kvd83Ie+ISqBs67biq4b05CNfrJQeqQWOaxTEd1zwfPeaDkPtt4V8mjHb0RMLxix0o D2QDhAO3D4dA+g9LxiTTvnABedA6z0mnP4o/npbh/JNdIq38nezhhMbwBJyRd6UBKPg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WH2fDS9g; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E50C606A31A; Wed, 21 Oct 2026 16:59:05 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 461031F000C1; Wed, 21 Oct 2026 16:59:05 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792601945; bh=Ch+cdHNWdqSBOJQDfma07OavdtmO6Fn0ukfkIr5qp2w=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=WH2fDS9gwnSKO9+SNh64/8vxkuZPlqNeTvhYIDVDQbTaQw1MnLgFwNHa4KyIm15df Ijz6eb54a414X7cW290tmBmzuRfQq4VBQ9vGFMWqiX23gGg+9MAk9XX7rlNGE86XLg aFwvwOvSkQoyMl3bCN0EAHIh4a1bDoy4zJRpGQj0r7YNocKCdLE0GMuJNMJ7LxDQz5 5YYjk05bIzD0Oc+KDQUKWMOUzNPthtEfMAC2Q2/HjTolM4UqlE7jp/+u5Kzt2QqJtr xJ3DV19yVZ2ugkUwF1vcbEjeqN20p8O3KM9HDon+Q78fpDHUlS4GSSEoqw9LScObZk lZe7kQJ7uzRSQ== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261021155645.69120-1-phx0fer@gmail.com> X-Cc: netdev@vger.kernel.org,bpf@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev