CVE-2026-43121
Beschrijving NL
In de Linux kernel is de volgende kwetsbaarheid verholpen:
io_uring/zcrx: fix user_ref race tussen scrub- en navulpaden
De functie io_zcrx_put_niov_uref () gebruikt een niet-atomaire
check-then-decrement patroon (atomic_read gevolgd door afzonderlijke
atomic_dec) om user_refs te manipuleren. Dit is geserialiseerd tegen andere
bellers door rq_lock, maar io_zcrx_scrub() wijzigt dezelfde teller met
atomic_xchg() ZONDER rq_lock vast te houden. Op SMP-systemen bestaat de volgende race:
CPU0 (bijvullen, houdt rq_lock) CPU1 (scrub, geen rq_lock)
put_niov_uref:
atomic_read(uref) - 1
// venster opent
atomic_xchg(uref, 0) - 1
return_niov_freelist(niov) [PUSH #1]
// venster sluit
atomic_dec(uref) - wraps naar -1
geeft waar terug
return_niov(niov)
return_niov_freelist(niov) [PUSH #2: DOUBLE-FREE]
De sa me niov wordt twee keer naar de freelist geduwd, waardoor free_count
nr_iovs overschrijden. Daaropvolgende freelist-pushes voeren vervolgens een out-of-bounds uit
schrijf (een u32-waarde) voorbij de kvmalloc'd freelist-array in de aangrenzende
plaatobject. Los dit op door de niet-atomaire read-then-dec te vervangen in
io_zcrx_put_niov_uref() met een atomaire_try_cmpxchg-lus die atomair
tests en verlagingen user_refs. Dit maakt de operatie veilig tegen
gelijktijdige atomic_xchg van scrub zonder dat scrub nodig is om te verwerven
rq_lock. [pavel: heeft een waarschuwing en een opmerking verwijderd]
Origineel (Engels) tonen
In the Linux kernel, the following vulnerability has been resolved:
io_uring/zcrx: fix user_ref race between scrub and refill paths
The io_zcrx_put_niov_uref() function uses a non-atomic
check-then-decrement pattern (atomic_read followed by separate
atomic_dec) to manipulate user_refs. This is serialized against other
callers by rq_lock, but io_zcrx_scrub() modifies the same counter with
atomic_xchg() WITHOUT holding rq_lock.
On SMP systems, the following race exists:
CPU0 (refill, holds rq_lock) CPU1 (scrub, no rq_lock)
put_niov_uref:
atomic_read(uref) - 1
// window opens
atomic_xchg(uref, 0) - 1
return_niov_freelist(niov) [PUSH #1]
// window closes
atomic_dec(uref) - wraps to -1
returns true
return_niov(niov)
return_niov_freelist(niov) [PUSH #2: DOUBLE-FREE]
The same niov is pushed to the freelist twice, causing free_count to
exceed nr_iovs. Subsequent freelist pushes then perform an out-of-bounds
write (a u32 value) past the kvmalloc'd freelist array into the adjacent
slab object.
Fix this by replacing the non-atomic read-then-dec in
io_zcrx_put_niov_uref() with an atomic_try_cmpxchg loop that atomically
tests and decrements user_refs. This makes the operation safe against
concurrent atomic_xchg from scrub without requiring scrub to acquire
rq_lock.
[pavel: removed a warning and a comment]