AZL-117061: CVE-2026-139322 affecting package kernel 6.6.161.1-1
In the Linux kernel, the following vulnerability has been resolved:
bpf: Reject sleepable programs for taskvma iterator
A sleepable "iter.s/taskvma" program can be attached, but its ->show() callback runs with the mmaplock of the iterated mm held for read. As soon as the program runs, bpfiterrunprog() calls mightfault(), and any bpfcopyfromuser() or bpfcopyfromusertask() it does may really fault or take mmaplock again. With lockdep this is reported as recursive locking of mmaplock. Without lockdep, a fault on the reader's own mm, or accessprocessvm() on the iterated mm, has to take mmaplock for read again. If a writer queued up in the meantime that blocks behind the writer, which in turn waits for the read lock the iterator already holds, and the read() hangs:
reader (iter.s/taskvma) other thread of the same mm taskvmaseqgetnext() mmapreadlock(mm) mmapwritelock(mm) <- waits bpf prog: copyfromuser() page fault mmapreadlock(mm) <- queued behind the writer
The reader waits killable, so the hang lasts until it gets a fatal signal.
bpfiterlinkattach() allows sleepable programs for the targets that set BPFITERRESCHED, and taskvma sets it because condresched() between VMAs is fine with mmaplock held. Rescheduling between objects and running a sleepable program inside ->show() are different properties, though, and taskvma only has the first one. The open-coded taskvma iterator does not have this problem since it hands out a snapshot of the VMA and holds no lock when it returns to the program.
The vma handed to the program is only stable under mmaplock, so the lock can't be dropped around ->show(). Add a feature flag BPFITERNOSLEEP for targets which can't run sleepable programs although they can reschedule, and set it for taskvma.
The check at attach time is not enough. BPFLINKUPDATE replaces the program of a link, and bpfiterlinkreplace() only compares the type, the attach type and the BTF id of the two programs, which are the same for a sleepable and a non-sleepable one. Do the check there as well. That also closes this way around the existing rule: so far a sleepable program could be put on a link of a target that doesn't set BPFITERRESCHED, like the hash map element iterator, which runs it under rcureadlock().
BPFLINKCREATE of a sleepable program for the taskvma target, and BPFLINKUPDATE to one, now fail with -EINVAL, also for programs that don't touch user memory and have been working since sleepable iterator programs exist. The programs can still be loaded. They have to be loaded as non-sleepable programs, or use the open-coded iterator.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Load the task_vma iterator program as non-sleepable.
BPF iter.s/task_vma program sleepable = false - Compensating control
Use the open-coded task_vma iterator instead of a sleepable iterator program.
Event History
Frequently Asked Questions
What systems are exposed to this issue?
Systems using the Azure Linux kernel package version 6.6.161.1-1 are identified as affected. Exposure requires use of the BPF task_vma iterator with a sleepable iter.s/task_vma program attached.
What does an attacker or local user need to trigger the hang?
They need to attach a sleepable BPF program to the task_vma iterator and cause its callback to perform an operation such as bpf_copy_from_user() or bpf_copy_from_user_task() that can fault or reacquire mmap_lock. A queued mmap writer can then create the lock ordering condition that causes the iterator read to hang.
What is the operational impact if exploitation succeeds?
The affected reader can hang while processing the task_vma iterator. The wait is killable, so the hang persists until the reader receives a fatal signal.
What configuration behavior allowed the vulnerable attachment?
bpf_iter_link_attach() permits sleepable programs for iterator targets that set BPF_ITER_RESCHED. The task_vma iterator sets that flag, allowing sleepable programs to be attached even though its show callback runs while mmap_lock is held for reading.