Look up another CVE · open CVE-2024-39508 in the interactive tracker
CVE-2024-39508
io_uring/io-wq: Use set_bit() and test_bit() at worker->flags
Published 2024-07-12 (2 years ago) by the Linux kernel CNA. Subsystem io_uring. Debian urgency: not yet assigned.
What to do, per Debian release
Debian's own status for CVE-2024-39508 in every release this site tracks, and what each one means in practice. Every status below is the one the Debian Security Team publishes for this CVE. source
| Release | Status | Version | What this means |
|---|---|---|---|
| Debian 12bookworm | vulnerable | 6.1.190-1 | No fix published anywhere yet, neither in Debian nor upstream for the series bookworm tracks. Watch the Debian tracker page for this CVE. Advisories for bookworm have historically landed a median of 23 days after publication. |
| Debian 13trixie | fixed | 6.9.7-1 | Update the kernel and reboot. Fixed in 6.9.7-1. A running kernel keeps the old code until the machine restarts. |
| Debian 14forky | fixed | 6.9.7-1 | Update the kernel and reboot. Fixed in 6.9.7-1. A running kernel keeps the old code until the machine restarts. |
| Debian unstablesid | fixed | 6.9.7-1 | Update the kernel and reboot. Fixed in 6.9.7-1. A running kernel keeps the old code until the machine restarts. |
The vulnerability
What the bug is
Utilize set_bit() and test_bit() on worker->flags within io_uring/io-wq to address potential data races. The structure io_worker->flags may be accessed through various data paths, leading to concurrency issues. When KCSAN is enabled, it reveals data races occurring in io_worker_handle_work and io_wq_activate_free_worker functions. BUG: KCSAN: data-race in io_worker_handle_work / io_wq_activate_free_worker write to 0xffff8885c4246404 of 4 bytes by task 49071 on cpu 28: io_worker_handle_work (io_uring/io-wq.c:434 io_uring/io-wq.c:569) io_wq_worker (io_uring/io-wq.c:?) <snip> read to 0xffff8885c4246404 of 4 bytes by task 49024 on cpu 5: io_wq_activate_free_worker (io_uring/io-wq.c:? io_uring/io-wq.c:285) io_wq_enqueue (io_uring/io-wq.c:947) io_queue_iowq (io_uring/io_uring.c:524) io_req_task_submit (io_uring/io_uring.c:1511) io_handle_tw_list (io_uring/io_uring.c:1198) <snip> Line numbers against commit 18daea77cca6 ("Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm"). These races involve writes and reads to the same memory location by different tasks running on different CPUs. To mitigate this, refactor the code to use atomic operations such as set_bit(), test_bit(), and clear_bit() instead of basic "and" and "or" operations. This ensures thread-safe manipulation of worker flags. Also, move `create_index` to avoid holes in the structure.
Where it lives
The fix touches these files. If the subsystem is one you do not use, the practical exposure is lower, though the package is still the vulnerable one.
io_uring/io-wq.c
- What this is
- IO_URINGMAINTAINERS section matched on io_uring/ · io-uring@vger.kernel.org · Maintained
Check it on the machine
grep -w CONFIG_IO_WQ /boot/config-$(uname -r)Reads the booted kernel's own configuration, on the machine and nowhere else. =y is built in, =m is a module, and an is not set line means the code is not there.
Show whether Debian builds this, per release
Debian builds this code. Every release below compiles the affected file into the kernels it ships.
- bookworm, trixie, forky, sidy
- y
- built into the kernel image on every flavour - only a patch removes it
- Build switch
- CONFIG_IO_WQ
From the configuration Debian publishes for every kernel flavour it builds. It covers only the architectures Debian ships a linux-config package for, and nothing about a kernel you built yourself. Debian's own status above stays authoritative about the source package.MAINTAINERS kbuild Makefiles Debian linux-config packages
Signals
- Published
- 2024-07-12 (2 years ago)source
- CVSS
- 7.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:Hsource recompute it - Attack vector
- local (AV:L)source
- EPSS
- 0.22%, higher than 12.1% of all CVEssource
- CISA KEV
- not listedthe KEV catalogue
- Debian urgency
- not yet assignedsource
- Subsystem
- io_uring
Upstream fixes
The versions the CNA records as introducing and fixing this, and the commit for each. source
| Introduced | Fixed in | Commit |
|---|---|---|
| 5.1 | 6.6.35 | ab702c3483db |
| 5.1 | 6.9.6 | 1cbb0affb154 |
| 5.1 | 6.10 | 8a565304927f |
Why the CNA scored it this way
Quoted from the kernel CNA's own scoring file, word for word. A highlighted metric carries the most severe value CVSS v3.1 defines for it, which is what pushes the score up. source
- AV:LAttack vector, local
- The race is reached only through local io_uring syscalls (`io_uring_setup(2)`/`io_uring_enter(2)`) on a ring the attacker owns, via `io_queue_iowq()` → `io_wq_enqueue()` → `io_wq_activate_free_worker()`. No network or adjacent-network data path touches `io_uring/io-wq.c`.
- AC:LAttack complexity, low
- The attacker controls both sides of the race: it creates the io-wq workers, forces async punting with `IOSQE_ASYNC`, and submits from multiple threads so that `io_wq_activate_free_worker()` walks `wq->free_list` on one CPU while a worker executes the non-atomic `worker->flags &= ~IO_WORKER_F_FREE` in `__io_worker_busy()` on another. The window can be hit repeatedly at no cost, exactly as KCSAN observed under ordinary load.
- PR:LPrivileges required, low
- Only an unprivileged local account is required — `io_uring_setup()` performs no capability check and `sysctl_io_uring_disabled` defaults to 0, permitting io_uring for all users; io-wq worker threads are created on demand for that user's own ring.
- UI:NUser interaction, none
- The attacking task performs every step itself — creating the ring, spawning submitter threads, and queueing async work — with no action required from any other user or administrator.
- S:UScope, unchanged
- The raced state and all its consequences live in the kernel's own io-wq bookkeeping for the calling task's ring; no VM, hypervisor, IOMMU, or sandbox boundary is crossed.
- C:HConfidentiality impact, high
- The raced field is the sole guard on `wq->free_list` membership — `io_worker_exit()` unlinks `worker->nulls_node` only `if (worker->flags & IO_WORKER_F_FREE)` before `kfree_rcu(worker, rcu)` — so an indeterminate value leaves a freed `io_worker` linked and read by `io_wq_activate_free_worker()` from other tasks, which after slab reuse discloses attacker-observable kernel heap contents through `worker->wq` and `worker->task`.
- I:HIntegrity impact, high
- The same stale-flag path lets other tasks operate on a freed `io_worker`: `io_worker_get()` performs `refcount_inc_not_zero` into a reallocated slab object and `wake_up_process(worker->task)` dereferences a sprayable pointer into the scheduler, yielding a write and control-flow primitive.
- A:HAvailability impact, high
- A wrong `IO_WORKER_F_BOUND` read makes `io_wq_activate_free_worker()` wake a worker from the other accounting class and return true, so `io_wq_enqueue()` skips `io_wq_create_worker()` and the queued work is left with no worker to run it — an indefinite hang of the io_uring request plus `acct->nr_running` imbalance, triggerable at will by an unprivileged user.