CVE-2024-39508 io_uring/io-wq: Use set_bit() and test_bit() at worker->flags

High 7.8 Published Updated

A data race in the Linux kernel io_uring subsystem can lead to concurrency issues and potential denial of service.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-39508?

CVE-2024-39508 is a high-severity vulnerability in Linux kernel, published on 12 Jul 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

In the Linux kernel, the following vulnerability has been resolved:

io_uring/io-wq: Use set_bit() and test_bit() at worker->flags

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.

Weakness: CWE-362

Which versions are affected by CVE-2024-39508?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-39508?

Apply the vendor's patch.

Is CVE-2024-39508 being exploited?

There is no known exploitation of CVE-2024-39508 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-68111, BELL-CVE-2024-39508, DEBIAN-CVE-2024-39508, GHSA-578w-3jwj-573c, ROOT-OS-DEBIAN-11-CVE-2024-39508, ROOT-OS-DEBIAN-12-CVE-2024-39508 and 2 more.

Is CVE-2024-39508 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free