AZL-117058: CVE-2026-139321 affecting package kernel 6.6.161.1-1
In the Linux kernel, the following vulnerability has been resolved:
bpf: Forbid sleeping in bpffindvma() callbacks
A sleepable program can call bpffindvma() and use a sleepable helper such as bpfcopyfromuser() or bpfcopyfromusertask() in the callback. The verifier accepts this, but bpffindvma() runs the callback with the mmaplock of the mm held for read. If the user copy faults on that mm, the fault handler has to take mmaplock again. Lockdep reports recursive locking, and if a writer queued up in between, the fault blocks behind the writer, which waits for the read lock the helper already holds:
sleepable prog other thread of the same mm bpffindvma(current, ...) mmapreadtrylock(mm) mmapwritelock(mm) <- waits callback: copyfromuser() page fault mmapreadlock(mm) <- queued behind the writer
This is the same problem as with sleepable taskvma iterator programs. The verifier checks synchronous callbacks in the caller's context, so insleepablecontext() is true in the callback of a sleepable program.
Verify the callback like a hash map foreach callback, as running in an RCU read-side critical section where sleeping is not allowed, and actually hold rcureadlock() around it, so that global functions the callback calls, which are then verified for a non-sleepable context, see the RCU protection they are verified with.
Non-sleepable programs already run the callback under RCU, nothing changes for them. A sleepable program whose bpffindvma() callback calls any helper, kfunc or global function that may sleep is now rejected by the verifier, including ones that would be harmless under mmaplock as they don't touch user memory.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Do not access user memory from bpf_find_vma() callbacks.
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
The affected software identified is the Azure Linux kernel package version 6.6.161.1-1. Exposure depends on whether sleepable BPF programs that use bpf_find_vma() can be loaded and run on the system.
What is required to trigger the problem?
A sleepable BPF program must call bpf_find_vma() and use a sleepable user-copy helper, such as bpf_copy_from_user() or bpf_copy_from_user_task(), from its callback. A page fault on the relevant memory mapping can then cause recursive mmap_lock acquisition.
How could an affected system behave when the issue is triggered?
Lockdep can report recursive locking. If another thread queues for the mmap_lock write lock while the callback is running, the faulting user-copy operation can block behind that writer while the writer waits for the read lock already held by the callback, resulting in a deadlock.