AZL-117064: CVE-2026-139323 affecting package kernel 6.6.161.1-1
In the Linux kernel, the following vulnerability has been resolved:
bpf: Don't hand out a linked element as extra element
When htabmapupdateelem() replaces an element of a preallocated map, allochtabelem() takes the spare element of this cpu and puts the old element into the per-cpu slot right away, long before the old element is unlinked from its bucket. The bucket lock disables interrupts, but it does not keep out an NMI, or a tracing program on the return of allochtabelem(). bpfprogactive only helps if both programs are kprobe, tracepoint or perfevent programs. A program that updates an existing key in another bucket of the same map gets to use the slot:
htabmapupdateelem(k1) tc, xdp, fentry, rawtp, ... allochtabelem() lnew = plnew plnew = lold still linked in bucket 1 <NMI> htabmapupdateelem(k2) perfevent program lnew = plnew the lold of the outer update hlistnullsaddheadrcu(lnew, bucket 2) hlistnullsdelrcu(k2's old element) </NMI> hlistnullsaddheadrcu(lnew, bucket 1) hlistnullsdelrcu(lold)
If lold was the first element of bucket 1, the outer add points its pprev at lnew, and the delete takes it out of bucket 1 only. lnew->next now leads into bucket 2, where lold stays with a poisoned pprev, on which a delete of k2 crashes. If it was not the first, the delete takes it out of bucket 2: k2 is gone from the map, and the chain of bucket 1 still contains lold, whose next pointer leads into bucket 2.
Either way a walk of bucket 1 ends on the nulls value of bucket 2. lookupnullselemraw() restarts whenever that happens, so every lookup in bucket 1 which does not find its key spins forever:
rcu: INFO: rcupreempt detected stalls on CPUs/tasks: htabmaplookupelem+0x354/0x4d0
BUG: KASAN: wild-memory-access in htabmapdeleteelem+0x30c/0x670 Write of size 8 at addr dead000000000122 by task extra/102
An NMI between the load and the store of the slot makes both updates use the same element, with much the same result.
Empty the slot when the spare element is taken, in a way that is atomic on this cpu, and put the old element in only after it has been unlinked and its timers and the like have been cancelled. A nested update that finds the slot empty, which is the case that corrupted the map, fails with -EBUSY.
Affected Software
Event History
Frequently Asked Questions
What conditions are needed to reach the vulnerable update sequence?
The sequence involves replacing an existing element in a preallocated BPF hash map. A second BPF program must update an existing key in a different bucket while the first update has temporarily placed an old, still-linked element in the per-CPU spare slot.
Which BPF execution contexts can participate in the race?
The outer update can originate from contexts including tc, XDP, fentry, or raw tracepoints. The interrupting update is illustrated as a perf_event program running in an NMI; the description notes that bpf_prog_active protection only covers cases where both programs are kprobe, tracepoint, or perf_event programs.
How can I determine whether my system is in scope?
Check whether the system is using the azure-linux/kernel package version identified in the advisory: 6.6.161.1-1. Also assess whether workloads use preallocated BPF hash maps and can perform concurrent updates to existing keys from the relevant BPF execution contexts.