Skip to contentSkip to conversation

CVE-2026-99797: io_uring/cancel: drop sqd->lock while SQPOLL waits

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Nov 20

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

io_uring/cancel: drop sqd->lock while SQPOLL waits

An exiting SQPOLL thread calls io_uring_cancel_generic() with sqd->lock held, and keeps it across cond_resched() and the sleep until nothing is in flight anymore. A zero-copy send notification can't be canceled and stays pending as long as the peer doesn't read, so the lock is held for as long as a user cares to. io_ring_exit_work() needs it to park the thread, and so do IORING_REGISTER_IOWQ_AFF and IOWQ_MAX_WORKERS. With 64 such rings sharing the thread, every iou_exit slot sleeps on the lock and no ring gets freed for anyone.

Drop the lock around cond_resched() and the sleep, like the main loop of the thread does. Each walk of ctx_list is still under one hold, and nothing is kept across the unlock. The thread drops its io-wq, frees its tctx and clears sqd->thread under one hold after the loop, so whoever holds the lock and finds sqd->thread set can still use them.

[axboe: adapted to the schedule_timeout() based loop]

The Linux kernel CVE team has assigned CVE-2026-99797 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.0 with commit 63809137ebb58f0aa2ce359117422686e3304f45 and fixed in 6.12.118 with commit 9ebfcc60793a46eaf60fc34792486c9a6e114460
	Issue introduced in 6.0 with commit 63809137ebb58f0aa2ce359117422686e3304f45 and fixed in 6.18.64 with commit 96ba960a6099935cfc5ea17aef056553f0c8e647
	Issue introduced in 6.0 with commit 63809137ebb58f0aa2ce359117422686e3304f45 and fixed in 7.3.5 with commit 682a8804640b6266a4b7fae5a131c57dd8711f70
	Issue introduced in 6.0 with commit 63809137ebb58f0aa2ce359117422686e3304f45 and fixed in 7.4-rc1 with commit cb0306c52ffae083a86fb283de67875ae7a9500e

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-99797

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
io_uring/cancel.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/9ebfcc60793a46eaf60fc34792486c9a6e114460
	https://git.kernel.org/stable/c/96ba960a6099935cfc5ea17aef056553f0c8e647
	https://git.kernel.org/stable/c/682a8804640b6266a4b7fae5a131c57dd8711f70
	https://git.kernel.org/stable/c/cb0306c52ffae083a86fb283de67875ae7a9500e