CVE-2024-39508: io_uring/io-wq: Use set_bit() and test_bit() at worker->flags
In the Linux kernel, the following vulnerability has been resolved:
iouring/io-wq: Use setbit() and testbit() at worker->flags
Utilize setbit() and testbit() on worker->flags within iouring/io-wq to address potential data races.
The structure ioworker->flags may be accessed through various data paths, leading to concurrency issues. When KCSAN is enabled, it reveals data races occurring in ioworkerhandlework and iowqactivatefreeworker functions.
BUG: KCSAN: data-race in ioworkerhandlework / iowqactivatefreeworker write to 0xffff8885c4246404 of 4 bytes by task 49071 on cpu 28: ioworkerhandlework (iouring/io-wq.c:434 iouring/io-wq.c:569) iowqworker (iouring/io-wq.c:?) <snip>
read to 0xffff8885c4246404 of 4 bytes by task 49024 on cpu 5: iowqactivatefreeworker (iouring/io-wq.c:? iouring/io-wq.c:285) iowqenqueue (iouring/io-wq.c:947) ioqueueiowq (iouring/iouring.c:524) ioreqtasksubmit (iouring/iouring.c:1511) iohandletwlist (iouring/iouring.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 setbit(), testbit(), and clearbit() instead of basic "and" and "or" operations. This ensures thread-safe manipulation of worker flags.
Also, move createindex to avoid holes in the structure.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 6.6.35 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 6.9.6 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 6.10 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.25-1Fixed in 6.12.27-1 - Upgrade
Upgrade
linux kernel io_uring/io-wqto a version that resolves this vulnerability.Patch 18daea77cca6 - Configuration
In io_uring/io-wq, refactor accesses to worker->flags to use atomic bit helpers: replace non-atomic "and"/"or" flag manipulation with set_bit() and test_bit() on worker->flags, and use clear_bit() where clearing is required, to prevent data races reported by KCSAN in io_worker_handle_work and io_wq_activate_free_worker.
Linux kernel io_uring/io-wq (worker flags) worker->flags bit operations = Use set_bit() and test_bit() (and clear_bit()) instead of basic "and" and "or" operations
Event History
Frequently Asked Questions
What is the severity of CVE-2024-39508?
CVE-2024-39508 has been classified as a potential data race vulnerability in the Linux kernel.
How do I fix CVE-2024-39508?
To fix CVE-2024-39508, update the kernel to version 6.6.35 or later for Red Hat or to version 5.10.223-1, 5.10.226-1, 6.1.119-1, 6.1.123-1 or newer for Debian.
Which Linux kernel versions are affected by CVE-2024-39508?
CVE-2024-39508 affects multiple versions of the Linux kernel prior to the specified remediation updates.
What causes CVE-2024-39508 in the Linux kernel?
CVE-2024-39508 is caused by improper handling of io_worker flags within the io_uring subsystem, leading to possible data races.
Is CVE-2024-39508 a low, medium, or high risk?
CVE-2024-39508 presents a medium risk due to the potential for data races that could affect system stability.