CVE-2026-139269: bpf: Fix arena race between page free and alloc leading to incoherency

Published Nov 30, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix arena race between page free and alloc leading to incoherency

Existing arena kfunc code has an underlying race condition that can lead to writes being lost from the BPF program's point of view:

a) A memory range gets freed by operation (1), and its range is added back to the arena range tree.

b) A concurrent allocation (2) reallocates the range, and does writes to it. Writes from that CPU may follow the stale TLB entries into the pages that are about to be freed.

c) (1) invalidates the TLB. The old pages, and any writes done to them, are now inaccessible. zappages() similarly removes the mappings for userspace threads.

This can be triggered by particularly demanding BPF arena data structures that constantly allocate and deallocate memory, like hash table allocations.

Solve this ABA problem by keeping the range allocated until TLB invalidation and unmapping are complete. Under the arena spinlock, claim any free pages in the range and clear its kernel PTEs. Then drop the spinlock, lock and unlock each cleared page to wait for faults that are still installing a user PTE, flush the kernel TLB and zap the user page tables. Finally, retake the spinlock to release the range. Frees serialize on zapmutex, so an overlapping free cannot release the range early. Claiming the range only allocates a range tree node when the whole range is free, and then there is nothing to free.

User faults on a range that is allocated without a page now raise SIGBUS instead of populating it. That covers a range reserved with bpfarenareservepages() and a range whose kernel PTEs a free has already cleared. Touching a page while a BPF program frees it is a user space bug, and in a BPFFSEGVONFAULT arena it already raises SIGSEGV.

Sleepable frees run synchronously and are deferred only when the arena spinlock cannot be taken. The deferred free worker retries such a free in place instead of requeueing itself, so the flushwork() in arenamapfree() waits for all of its work.

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    In the BPF arena free path, serialize overlapping frees on zap_mutex and keep the range allocated while TLB invalidation and unmapping complete, including waiting for in-flight faults on cleared pages. Then reacquire the spinlock and return the range to the arena range tree.

Event History

Nov 30, 2026
CVE Published
via MITRE·01:33 PM
Data Sourced
via MITRE·01:33 PM
Description
Data Sourced
via NVD·02:18 PM
Description

Frequently Asked Questions

1

What workloads are most likely to trigger this issue?

The race can be triggered by demanding BPF arena data structures that repeatedly allocate and deallocate memory. Hash table allocations are specifically identified as an example.

2

What conditions are required for the race to occur?

A memory range must be freed while a concurrent allocation reuses that range and writes to it before TLB invalidation is completed. Stale TLB entries can direct those writes to pages that are about to be freed, causing the writes to become inaccessible.

3

What is the practical impact on affected BPF programs?

Writes made by a BPF program can be lost from the program's point of view. The issue results in memory-state incoherency when reused pages are later unmapped or their TLB entries are invalidated.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203