CVE-2025-38129: page_pool: Fix use-after-free in page_pool_recycle_in_ring
In the Linux kernel, the following vulnerability has been resolved:
pagepool: Fix use-after-free in pagepoolrecycleinring
syzbot reported a uaf in pagepoolrecycleinring:
BUG: KASAN: slab-use-after-free in lockrelease+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: <TASK> dumpstack lib/dumpstack.c:94 [inline] dumpstacklvl+0x241/0x360 lib/dumpstack.c:120 printaddressdescription mm/kasan/report.c:378 [inline] printreport+0x169/0x550 mm/kasan/report.c:489 kasanreport+0x143/0x180 mm/kasan/report.c:602 lockrelease+0x151/0xa30 kernel/locking/lockdep.c:5862 rawspinunlockbh include/linux/spinlockapismp.h:165 [inline] rawspinunlockbh+0x1b/0x40 kernel/locking/spinlock.c:210 spinunlockbh include/linux/spinlock.h:396 [inline] ptrringproducebh include/linux/ptrring.h:164 [inline] pagepoolrecycleinring net/core/pagepool.c:707 [inline] pagepoolputunrefednetmem+0x748/0xb00 net/core/pagepool.c:826 pagepoolputnetmem include/net/pagepool/helpers.h:323 [inline] pagepoolputfullnetmem include/net/pagepool/helpers.h:353 [inline] napippputpage+0x149/0x2b0 net/core/skbuff.c:1036 skbpprecycle net/core/skbuff.c:1047 [inline] skbfreehead net/core/skbuff.c:1094 [inline] skbreleasedata+0x6c4/0x8a0 net/core/skbuff.c:1125 skbreleaseall net/core/skbuff.c:1190 [inline] kfreeskb net/core/skbuff.c:1204 [inline] skskbreasondrop+0x1c9/0x380 net/core/skbuff.c:1242 kfreeskbreason include/linux/skbuff.h:1263 [inline] skbqueuepurgereason include/linux/skbuff.h:3343 [inline]
root cause is:
pagepoolrecycleinring ptrringproduce spinlock(&r->producerlock); WRITEONCE(r->queue[r->producer++], ptr) //recycle last page to pool pagepoolrelease pagepoolscrub pagepoolemptyring ptrringconsume pagepoolreturnpage //release all page pagepooldestroy freepercpu(pool->recyclestats); free(pool) //free
spinunlock(&r->producerlock); //pool->ring uaf read recyclestatinc(pool, ring);
pagepool can be free while page pool recycle the last page in ring. Add producer-lock barrier to pagepoolrelease to prevent the page pool from being free before all pages have been recycled.
recyclestatinc() is empty when CONFIGPAGEPOOLSTATS is not enabled, which will trigger Wempty-body build warning. Add definition for pool stat macro to fix warning.
Other sources
In the Linux kernel, the following vulnerability has been resolved:
pagepool: Fix use-after-free in pagepoolrecycleinring
syzbot reported a uaf in pagepoolrecycleinring:
BUG: KASAN: slab-use-after-free in lockrelease+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: TASK dumpstack lib/dumpstack.c:94 [inline] dumpstacklvl+0x241/0x360 lib/dumpstack.c:120 printaddressdescription mm/kasan/report.c:378 [inline] printreport+0x169/0x550 mm/kasan/report.c:489 kasanreport+0x143/0x180 mm/kasan/report.c:602 lockrelease+0x151/0xa30 kernel/locking/lockdep.c:5862 rawspinunlockbh include/linux/spinlockapismp.h:165 [inline] rawspinunlockbh+0x1b/0x40 kernel/locking/spinlock.c:210 spinunlockbh include/linux/spinlock.h:396 [inline] ptrringproducebh include/linux/ptrring.h:164 [inline] pagepoolrecycleinring net/core/pagepool.c:707 [inline] pagepoolputunrefednetmem+0x748/0xb00 net/core/pagepool.c:826 pagepoolputnetmem include/net/pagepool/helpers.h:323 [inline] pagepoolputfullnetmem include/net/pagepool/helpers.h:353 [inline] napippputpage+0x149/0x2b0 net/core/skbuff.c:1036 skbpprecycle net/core/skbuff.c:1047 [inline] skbfreehead net/core/skbuff.c:1094 [inline] skbreleasedata+0x6c4/0x8a0 net/core/skbuff.c:1125 skbreleaseall net/core/skbuff.c:1190 [inline] kfreeskb net/core/skbuff.c:1204 [inline] skskbreasondrop+0x1c9/0x380 net/core/skbuff.c:1242 kfreeskbreason include/linux/skbuff.h:1263 [inline] skbqueuepurgereason include/linux/skbuff.h:3343 [inline]
root cause is:
pagepoolrecycleinring ptrringproduce spinlock(&r-producerlock); WRITEONCE(r-queue[r-producer++], ptr) //recycle last page to pool pagepoolrelease pagepoolscrub pagepoolemptyring ptrringconsume pagepoolreturnpage //release all page pagepooldestroy freepercpu(pool-recyclestats); free(pool) //free
spinunlock(&r-producerlock); //pool-ring uaf read recyclestatinc(pool, ring);
pagepool can be free while page pool recycle the last page in ring. Add producer-lock barrier to pagepoolrelease to prevent the page pool from being free before all pages have been recycled.
recyclestatinc() is empty when CONFIGPAGEPOOLSTATS is not enabled, which will trigger Wempty-body build warning. Add definition for pool stat macro to fix warning.
— IBM
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Linux kernelto a version that resolves this vulnerability.Patch page_pool: Fix use-after-free in page_pool_recycle_in_ring - Configuration
Enable CONFIG_PAGE_POOL_STATS to trigger the associated code paths that control recycle_stat_inc/recycle_stats behavior (the material notes recycle_stat_inc() is empty when CONFIG_PAGE_POOL_STATS is not enabled).
Linux kernel (page_pool) CONFIG_PAGE_POOL_STATS = enabled - Compensating control
Ensure the page_pool pool/ring is not freed until all pages have been recycled in the ring (the material states page_pool can be freed while it is recycling the last page, leading to UAF).
- Operational
After applying the page_pool use-after-free fix, reboot or reload the kernel so the fixed page_pool/page_pool_release/page_pool_recycle_in_ring code is active.
Event History
Frequently Asked Questions
What is the severity of CVE-2025-38129?
CVE-2025-38129 is classified as a high-severity vulnerability due to the potential for use-after-free errors in the Linux kernel.
How do I fix CVE-2025-38129?
To fix CVE-2025-38129, update the Linux kernel to the latest stable version that includes the patch addressing this vulnerability.
What systems are affected by CVE-2025-38129?
CVE-2025-38129 affects all versions of the Linux kernel that contain the page_pool functionality.
Can CVE-2025-38129 lead to system crashes?
Yes, CVE-2025-38129 can lead to system instability and crashes due to the use-after-free error.
What is the impact of CVE-2025-38129 on kernel security?
CVE-2025-38129 poses a significant risk to kernel security as it can potentially allow attackers to exploit memory vulnerabilities.