AZL-117452: CVE-2026-139326 affecting package kernel 6.6.161.1-1
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.
- Compensating control
In devmap egress, set rxq.mem.type from each frame before running the devmap program.
Event History
Frequently Asked Questions
What systems are most likely to be exposed to this issue?
Exposure requires devmap egress XDP processing of redirected xdp_frame packets whose memory originates from a page_pool-based driver. The described reproducer uses 9000-byte frames from virtio_net and an egress program that removes whole fragments.
What XDP program behavior triggers the faulty fragment release?
A devmap egress program must remove a whole fragment using bpf_xdp_adjust_tail() or bpf_xdp_pull_data(). In that path, fragments can be freed according to an incorrect shared-memory type instead of the frame's actual memory type.
How can I identify signs that this has already occurred?
The reported symptom is a kernel "Bad page state" message associated with a "page_pool leak," potentially with stack frames including bpf_xdp_adjust_tail(), dev_map_bpf_prog_run(), and page_pool-related page freeing. This indicates the page reference held by the pool was dropped while the pool still accounted for the fragment.
What should be done if the affected XDP workflow cannot immediately be updated?
Avoid devmap egress programs that remove whole fragments with bpf_xdp_adjust_tail() or bpf_xdp_pull_data(), particularly for frames supplied by page_pool-based drivers. The issue is described as resolved in the Linux kernel, so move to a kernel build that includes the resolution when available.