Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 731352D29DB for ; Thu, 3 Jul 2025 08:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751531815; cv=none; b=hEO9DmjyKGMtzcskkUxI35yb3H2HRehA3nUCdX1QFah2v0/zwRvjwItcDJiTdCmTiyhVsGLmNww3mBhD2YoRqvjilN/4WOxyEVww9jRgC4CqsvpEYW/NDZ09/ak8i8ozefTE2MsSA73vi9Grx+JbEGfloGdVVuVLB2wNSfBkZ5U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751531815; c=relaxed/simple; bh=R75OR/W/r2CJge+6uiH/mg0Zf4gMa//cTtteUqelNkU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LLZozG2cO9xi7mI1hWwtYY2G4fIPe9KMNgSCz1hMT7Vqc6qmbzkCLrwgVkhhnfAvZazFkTmvuP3/KVftgZWJ7R3nyKo54ZznmzwczVUetY6jhazcAi7xtZIPMPtHf55uue/Wc4fUQJQfClpo1QUEovIPLTN97xnIlMlyEa9wQYU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OCDvqxC6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OCDvqxC6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5750C4CEE3; Thu, 3 Jul 2025 08:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751531815; bh=R75OR/W/r2CJge+6uiH/mg0Zf4gMa//cTtteUqelNkU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=OCDvqxC68Zlowcggk4zWQU392iJPJXY1SoZAdjOy0Ih2y2UJO92QCQVQMFk97rKEr mf1sOAgkcTH4VSrB3SJ0R0I7CA9ddd7wbkH8SU/1Y5STx1M1ds0z13P/uCI0xsnVLu WaCX/TRbuiMb3Y88lRIcudho+HyqE63atzg/ALjQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38129: page_pool: Fix use-after-free in page_pool_recycle_in_ring Date: Thu, 3 Jul 2025 10:35:46 +0200 Message-ID: <2025070330-CVE-2025-38129-3c0e@gregkh> X-Mailer: git-send-email 2.50.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4618; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=2DVfShyii1E1qrWt2hxa67HDD2PwJzxJst5nJM6QUPA=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlpDpd0VYKmJ2f5//vXM+fwFJNgRev1ydmSVx6u5px+d f7VpfH/OmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiPZcY5vupXdXvO3jh0658 5xMGv/+LNDYnz2KYK1vsYVq08h3j+jdbeazq3ThVuSVEAQ== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: page_pool: Fix use-after-free in page_pool_recycle_in_ring syzbot reported a uaf in page_pool_recycle_in_ring: BUG: KASAN: slab-use-after-free in lock_release+0x151/0xa30 kernel/locking/lockdep.c:5862 Read of size 8 at addr ffff8880286045a0 by task syz.0.284/6943 CPU: 0 UID: 0 PID: 6943 Comm: syz.0.284 Not tainted 6.13.0-rc3-syzkaller-gdfa94ce54f41 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 lock_release+0x151/0xa30 kernel/locking/lockdep.c:5862 __raw_spin_unlock_bh include/linux/spinlock_api_smp.h:165 [inline] _raw_spin_unlock_bh+0x1b/0x40 kernel/locking/spinlock.c:210 spin_unlock_bh include/linux/spinlock.h:396 [inline] ptr_ring_produce_bh include/linux/ptr_ring.h:164 [inline] page_pool_recycle_in_ring net/core/page_pool.c:707 [inline] page_pool_put_unrefed_netmem+0x748/0xb00 net/core/page_pool.c:826 page_pool_put_netmem include/net/page_pool/helpers.h:323 [inline] page_pool_put_full_netmem include/net/page_pool/helpers.h:353 [inline] napi_pp_put_page+0x149/0x2b0 net/core/skbuff.c:1036 skb_pp_recycle net/core/skbuff.c:1047 [inline] skb_free_head net/core/skbuff.c:1094 [inline] skb_release_data+0x6c4/0x8a0 net/core/skbuff.c:1125 skb_release_all net/core/skbuff.c:1190 [inline] __kfree_skb net/core/skbuff.c:1204 [inline] sk_skb_reason_drop+0x1c9/0x380 net/core/skbuff.c:1242 kfree_skb_reason include/linux/skbuff.h:1263 [inline] __skb_queue_purge_reason include/linux/skbuff.h:3343 [inline] root cause is: page_pool_recycle_in_ring ptr_ring_produce spin_lock(&r->producer_lock); WRITE_ONCE(r->queue[r->producer++], ptr) //recycle last page to pool page_pool_release page_pool_scrub page_pool_empty_ring ptr_ring_consume page_pool_return_page //release all page __page_pool_destroy free_percpu(pool->recycle_stats); free(pool) //free spin_unlock(&r->producer_lock); //pool->ring uaf read recycle_stat_inc(pool, ring); page_pool can be free while page pool recycle the last page in ring. Add producer-lock barrier to page_pool_release to prevent the page pool from being free before all pages have been recycled. recycle_stat_inc() is empty when CONFIG_PAGE_POOL_STATS is not enabled, which will trigger Wempty-body build warning. Add definition for pool stat macro to fix warning. The Linux kernel CVE team has assigned CVE-2025-38129 to this issue. Affected and fixed versions =========================== Issue introduced in 4.18 with commit ff7d6b27f894f1469dc51ccb828b7363ccd9799f and fixed in 6.12.34 with commit e869a85acc2e60dc554579b910826a4919d8cd98 Issue introduced in 4.18 with commit ff7d6b27f894f1469dc51ccb828b7363ccd9799f and fixed in 6.15.3 with commit 4ab8c0f8905c9c4d05e7f437e65a9a365573ff02 Issue introduced in 4.18 with commit ff7d6b27f894f1469dc51ccb828b7363ccd9799f and fixed in 6.16-rc1 with commit 271683bb2cf32e5126c592b5d5e6a756fa374fd9 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-38129 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/core/page_pool.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/e869a85acc2e60dc554579b910826a4919d8cd98 https://git.kernel.org/stable/c/4ab8c0f8905c9c4d05e7f437e65a9a365573ff02 https://git.kernel.org/stable/c/271683bb2cf32e5126c592b5d5e6a756fa374fd9