CVE-2026-139326: bpf: Use the frame mem type in devmap egress XDP
In the Linux kernel, the following vulnerability has been resolved:
bpf: Use the frame mem type in devmap egress XDP
A devmap egress program that removes a whole fragment of a redirected xdpframe with bpfxdpadjusttail() or bpfxdppulldata() frees it with pagefragfree() whatever the frame's memory type is. For a MEMTYPEPAGEPOOL frame from a pagepool based driver this drops the page reference owned by the pool while the pool still accounts the fragment ("pagepool leak" bad page, leaked pp reference).
kernel/bpf/devmap.c:devmapbpfprogrun() points xdp.rxq at an on-stack
struct xdprxqinfo rxq = { .dev = rxdev };
whose mem.type is 0, i.e. MEMTYPEPAGESHARED, and net/core/filter.c:bpfxdpshrinkdata() releases frags according to rxq->mem.type. cpumap, which runs programs on xdpframes the same way, already copies xdpf->memtype into its private rxq for each frame.
With 9000 byte frames from virtionet and an egress program that cuts the fragments off:
BUG: Bad page state in process swapper/3 pfn:10660b page dumped because: pagepool leak badpage+0xbd/0x190 freefrozenpages+0x5c7/0x900 bpfxdpadjusttail+0x3be/0x480 bpfprogdad43f894a3faff7egress+0x15c/0x1cd devmapbpfprogrun+0x288/0x610
The pool waits for these pages for ever when its device is gone. That is the harmless case. A page of the pool can hold more than one fragment while its refcount is 1: the first pagefragfree() frees it under the fragment which is still in use, and the second one runs into
page dumped because: VMBUGONPAGE(pagerefcount(page) == 0) kernel BUG at include/linux/mm.h:1846!
veth is not affected. It takes references of its own on the pages and redirects the frame as MEMTYPEPAGESHARED.
Fix by setting rxq.mem.type from each frame before running the devmap program, as cpumapbpfprogrunxdp() does.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Set rxq.mem.type from each frame before running the devmap program.
Linux kernel devmap egress XDP rxq.mem.type = xdpf->mem_type