CVE-2026-139604: bpf: Clear the insn array used flag with release semantics
In the Linux kernel, the following vulnerability has been resolved:
bpf: Clear the insn array used flag with release semantics
A program that fails after the JIT ran, for example in bpfchecktailcall(), has already stored its jitted offsets and target pointers into the insn array maps it uses through bpfprogupdateinsnptrs() when releaseinsnarrays() hands them back by clearing the used flag with a plain atomicset(). Nothing orders those stores before the flag, so on a weakly ordered architecture they can still be in flight when the next program takes the map: it is acquired with atomicxchg() in bpfinsnarrayinit() and reset there, and the late stores then land on top of whatever the new owner has written since, be it that reset or the pointers its own JIT stored, leaving entries that point into an image which is about to be freed.
Clear the flag with atomicsetrelease() instead, so that everything the releasing program stored is visible before the map can be acquired again. This pairs with the fully ordered atomicxchg() on the acquire side.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In the BPF instruction-array release path, clear the used flag with atomic_set_release() instead of plain atomic_set(), ordering prior stores before the flag is cleared.
Event History
Frequently Asked Questions
What conditions are required for this race to occur?
A BPF program must fail after its JIT compilation has run, such as during bpf_check_tail_call(), and another program must subsequently acquire and reuse the same instruction-array map. The ordering issue is relevant on weakly ordered architectures.
What can happen when the race is triggered?
Stores from the failed program can arrive after the map has been reused and reset or populated by its new owner. This can leave instruction-array entries pointing to a JIT image that is about to be freed.
Is there a configuration-only mitigation described if the kernel cannot be updated immediately?
No configuration workaround is provided in the available information. The described fix changes the used-flag clear operation to use release semantics, pairing it with the ordered acquisition operation.