WARNING in io_sq_thread_stop

Status: upstream: reported C repro on 2026/11/01 18:25
Subsystems: io-uring
Labels: prio:low
[Documentation on labels]
Reported-by: syzbot+675af112519ca34f5502@syzkaller.appspotmail.com
First crash: 2d03h, last: now
Cause bisection: introduced by (bisect log) :
commit 22d9db9fd64a493525d692b32c556875b7254665
Author: Jens Axboe <axboe@kernel.dk>
Date: Fri Oct 30 13:27:28 2026 +0000

  io_uring/sqpoll: don't attach to a thread that is canceling

Crash: WARNING in io_sq_thread_stop (log)
Repro: C syz .config
  
✨ AI-generated root cause summary:

When an io_uring SQPOLL thread terminates prematurely (e.g., due to a fatal signal), io_sq_thread() sets the IO_SQ_THREAD_SHOULD_STOP bit in sqd->state before exiting. Later, when the ring is cleaned up during io_ring_exit_work(), io_put_sq_data() calls io_sq_thread_stop(), which checks WARN_ON_ONCE(test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)) under the assumption that the stop bit is not yet set. This causes a benign WARN_ON_ONCE to trigger; subsequent cleanup proceeds normally without leaking memory or corrupting state.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit bd5c762ac051:

Root Cause Analysis

1. Functions, Structs, and Files Involved

  • File: io_uring/sqpoll.c
  • Functions: io_sq_thread(), io_sq_thread_stop(), io_put_sq_data(), io_sq_thread_finish(), io_sq_data_release()
  • Structs & Fields: struct io_sq_data (state, refs, free_refs, lock, thread), struct io_ring_ctx

2. Technical Mechanism and Trigger

In io_uring, submission queue polling (IORING_SETUP_SQPOLL) creates a dedicated kernel/user-worker thread (io_sq_thread) to poll and submit SQ entries. The thread and associated context are represented by struct io_sq_data *sqd.

  1. To prevent other rings from attaching via io_sq_offload_create() to an SQPOLL thread while it is exiting and canceling requests (during which sqd->lock is dropped in io_uring_cancel_generic()), io_sq_thread() explicitly sets the stop bit:

    set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
    

    This occurs whenever io_sq_thread() breaks out of its execution loop (for instance, if the thread or process group receives a fatal signal such as SIGKILL or SIGTERM).

  2. When the user process exits or its file descriptors close, the io_uring cleanup workqueue item (iou_exit running io_ring_exit_work()) destroys the remaining io_uring context:

    io_ring_exit_work() -> io_ring_ctx_free() -> io_sq_thread_finish() -> io_put_sq_data()
    
  3. In io_put_sq_data(), when the reference count sqd->refs reaches zero, it calls io_sq_thread_stop(sqd):

    void io_sq_thread_stop(struct io_sq_data *sqd)
    {
        struct task_struct *tsk;
    
        WARN_ON_ONCE(test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state));
        set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
        ...
    }
    

    io_sq_thread_stop() contains an assertion (WARN_ON_ONCE) based on the older assumption that io_sq_thread_stop() is the only function that sets IO_SQ_THREAD_SHOULD_STOP. Because the terminating io_sq_thread() already set this bit prior to ring teardown, test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state) evaluates to true, triggering the warning at line 88.


3. Production Kernel Impact and Classification

  • Memory Corruption (MemoryCorruption = false): The bit manipulation on sqd->state is atomic and idempotent. The refcounting (sqd->refs, sqd->free_refs), task pointers, and cancellation state remain valid and consistent. No invalid memory accesses, UAF, or out-of-bounds writes occur.
  • Information Leak (InfoLeak = "none"): No kernel memory contents or addresses are exposed or copied to userspace.
  • Denial of Service (RawDenialOfService = false): In a production kernel running without panic_on_warn, WARN_ON_ONCE outputs a single warning splat to the kernel log and execution continues normally. io_sq_thread_stop() completes its locking and wakeups safely, and io_sq_data_release() frees the sqd once both the rings and the thread have released their respective free_refs counts. No deadlock, hang, crash, or resource leak occurs.
  • Networking / KVM (IsNetCandidate = false, IsKVMCandidate = false): The defect is isolated to io_uring SQPOLL thread lifecycle management and has no dependency on networking or virtualization.
▶ ▼ ✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision
cfcba6a6 assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ✅ UserNamespace: ✅ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ WARNING in io_sq_thread_stop 2026/10/30 18:49 2026/10/30 18:50 2026/10/30 19:41 0ec395f8
▶ ▼ Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [io-uring?] WARNING in io_sq_thread_stop 0 (1) 2026/11/01 18:25

Sample crash report:
------------[ cut here ]------------
test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)
WARNING: io_uring/sqpoll.c:88 at io_sq_thread_stop+0x17e/0x1a0 io_uring/sqpoll.c:88, CPU#1: kworker/u8:7/155
Modules linked in:
CPU: 1 UID: 0 PID: 155 Comm: kworker/u8:7 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/07/2026
Workqueue: iou_exit io_ring_exit_work
RIP: 0010:io_sq_thread_stop+0x17e/0x1a0 io_uring/sqpoll.c:88
Code: c6 05 89 64 c1 0c 01 48 c7 c7 20 3c 8c 8c be 26 00 00 00 48 c7 c2 60 3c 8c 8c e8 0d 9b be fc e9 4f ff ff ff e8 d3 48 e3 fc 90 <0f> 0b 90 e9 e1 fe ff ff e8 c5 48 e3 fc 90 0f 0b 90 e9 6e ff ff ff
RSP: 0018:ffffc90002eff890 EFLAGS: 00010293
RAX: ffffffff84e5c75d RBX: ffff88803641c400 RCX: ffff8880217a8000
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffff88803641c51f R09: 1ffff11006c838a3
R10: dffffc0000000000 R11: ffffed1006c838a4 R12: 0000000000000001
R13: 0000000000000000 R14: ffff88803641c518 R15: dffffc0000000000
FS:  0000000000000000(0000) GS:ffff888123511000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1e61daf77c CR3: 00000000738c4000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 io_put_sq_data+0x8a/0x150 io_uring/sqpoll.c:105
 io_sq_thread_finish+0x1fd/0x240 io_uring/sqpoll.c:130
 io_ring_ctx_free+0x2d/0x5f0 io_uring/io_uring.c:2322
 io_ring_exit_work+0x5b4/0x650 io_uring/io_uring.c:2658
 process_one_work kernel/workqueue.c:3495 [inline]
 process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578
 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659
 kthread+0x38b/0x480 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>

Crashes (41279):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/01 15:21 upstream cbbddb6b08cc 25a0ae84 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/10/31 03:13 upstream bd5c762ac051 0ec395f8 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/10/31 02:09 upstream bd5c762ac051 0ec395f8 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/10/31 00:50 upstream bd5c762ac051 0ec395f8 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/10/30 23:03 upstream bd5c762ac051 0ec395f8 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/10/31 10:40 upstream abf8c33470f7 2041d3f8 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream WARNING in io_sq_thread_stop
2026/11/01 22:42 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 22:41 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/01 22:40 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto WARNING in io_sq_thread_stop
2026/11/01 22:38 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 22:37 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto WARNING in io_sq_thread_stop
2026/11/01 22:36 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 22:34 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/01 22:32 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/01 22:31 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root WARNING in io_sq_thread_stop
2026/11/01 22:29 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root WARNING in io_sq_thread_stop
2026/11/01 22:28 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto WARNING in io_sq_thread_stop
2026/11/01 22:27 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto WARNING in io_sq_thread_stop
2026/11/01 22:25 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto WARNING in io_sq_thread_stop
2026/11/01 22:21 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 22:20 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/01 22:20 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 22:17 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/01 22:16 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 22:15 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root WARNING in io_sq_thread_stop
2026/11/01 22:14 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/01 22:11 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/01 22:09 upstream cbbddb6b08cc 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/11/01 22:07 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/01 22:05 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/01 22:04 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 22:03 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto WARNING in io_sq_thread_stop
2026/11/01 22:00 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 21:59 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 21:58 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root WARNING in io_sq_thread_stop
2026/11/01 21:56 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto WARNING in io_sq_thread_stop
2026/11/01 21:55 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root WARNING in io_sq_thread_stop
2026/11/01 21:54 upstream cbbddb6b08cc 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/11/01 21:53 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 21:51 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/01 21:51 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto WARNING in io_sq_thread_stop
2026/10/30 18:50 upstream bd5c762ac051 0ec395f8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/10/30 18:49 upstream bd5c762ac051 0ec395f8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/11/01 22:31 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 WARNING in io_sq_thread_stop
2026/11/01 22:20 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 WARNING in io_sq_thread_stop
2026/11/01 21:48 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 WARNING in io_sq_thread_stop
2026/11/01 22:26 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream WARNING in io_sq_thread_stop
2026/11/01 21:33 upstream 46fec1c3029b 25a0ae84 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in io_sq_thread_stop
2026/11/01 22:35 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:24 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:23 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:22 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:20 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:18 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:14 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:12 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:08 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:06 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 21:52 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 21:50 upstream 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/01 22:11 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte WARNING in io_sq_thread_stop
2026/11/01 22:03 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master 46fec1c3029b 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64 WARNING in io_sq_thread_stop
2026/11/01 19:51 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master cbbddb6b08cc 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-compat WARNING in io_sq_thread_stop
2026/11/01 12:16 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git for-next abf8c33470f7 25a0ae84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 WARNING in io_sq_thread_stop
* Struck through repros no longer work on HEAD.