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: 3d12h, 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 (2)
Title Replies (including bot) Last reply
[PATCH] io_uring/sqpoll: don't set IO_SQ_THREAD_SHOULD_STOP on thread exit 1 (1) 2026/11/02 08:05
[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#0: kworker/u8:5/85
Modules linked in:
CPU: 0 UID: 0 PID: 85 Comm: kworker/u8:5 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 59 64 c1 0c 01 48 c7 c7 20 3c 8c 8c be 26 00 00 00 48 c7 c2 60 3c 8c 8c e8 7d 9a 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:ffffc9000205f890 EFLAGS: 00010293
RAX: ffffffff84e5c7cd RBX: ffff8880376fbc00 RCX: ffff88801f330000
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffff8880376fbd1f R09: 1ffff11006edf7a3
R10: dffffc0000000000 R11: ffffed1006edf7a4 R12: 0000000000000001
R13: 0000000000000000 R14: ffff8880376fbd18 R15: dffffc0000000000
FS:  0000000000000000(0000) GS:ffff888123411000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1569a047bc CR3: 000000000ff48000 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 (72536):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/02 08:30 upstream 46fec1c3029b 25a0ae84 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
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/03 07:32 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/03 07:32 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root WARNING in io_sq_thread_stop
2026/11/03 07:30 upstream 6628e7d4c6b2 6969b601 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/11/03 07:30 upstream 6628e7d4c6b2 6969b601 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/11/03 07:27 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/03 07:26 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root WARNING in io_sq_thread_stop
2026/11/03 07:24 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/03 07:22 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root WARNING in io_sq_thread_stop
2026/11/03 07:18 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root WARNING in io_sq_thread_stop
2026/11/03 07:12 upstream 6628e7d4c6b2 6969b601 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/11/03 07:09 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root WARNING in io_sq_thread_stop
2026/11/03 07:03 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root WARNING in io_sq_thread_stop
2026/11/03 06:57 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/03 06:55 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/03 06:55 upstream 6628e7d4c6b2 6969b601 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs WARNING in io_sq_thread_stop
2026/11/03 06:53 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/03 06:49 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 06:45 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/03 06:43 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/03 06:39 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/03 06:38 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/03 06:37 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/03 06:36 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce WARNING in io_sq_thread_stop
2026/11/03 06:35 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root WARNING in io_sq_thread_stop
2026/11/03 06:17 upstream 6628e7d4c6b2 0a94d799 .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/03 06:50 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 WARNING in io_sq_thread_stop
2026/11/03 06:40 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 WARNING in io_sq_thread_stop
2026/11/03 06:32 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 WARNING in io_sq_thread_stop
2026/11/03 07:28 upstream 6628e7d4c6b2 0a94d799 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in io_sq_thread_stop
2026/11/03 07:20 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream WARNING in io_sq_thread_stop
2026/11/03 07:02 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream WARNING in io_sq_thread_stop
2026/11/03 06:54 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream WARNING in io_sq_thread_stop
2026/11/03 06:44 upstream 6628e7d4c6b2 0a94d799 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in io_sq_thread_stop
2026/11/03 06:42 upstream 6628e7d4c6b2 0a94d799 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in io_sq_thread_stop
2026/11/03 06:42 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream WARNING in io_sq_thread_stop
2026/11/03 07:25 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/03 07:13 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/03 06:56 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/03 06:46 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/03 06:33 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/03 06:32 upstream 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 WARNING in io_sq_thread_stop
2026/11/03 07:17 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 07:16 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 07:14 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 07:10 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 07:08 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-rust-kasan-gce WARNING in io_sq_thread_stop
2026/11/03 07:00 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 06:48 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 06:38 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 06:29 linux-next 2637bdec0535 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root WARNING in io_sq_thread_stop
2026/11/03 07:21 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 WARNING in io_sq_thread_stop
2026/11/03 07:15 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 WARNING in io_sq_thread_stop
2026/11/03 07:05 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 WARNING in io_sq_thread_stop
2026/11/03 07:04 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 WARNING in io_sq_thread_stop
2026/11/03 06:51 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 WARNING in io_sq_thread_stop
2026/11/03 06:41 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6628e7d4c6b2 0a94d799 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 WARNING in io_sq_thread_stop
2026/11/03 07:06 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-compat WARNING in io_sq_thread_stop
2026/11/03 06:58 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-mte WARNING in io_sq_thread_stop
2026/11/03 06:27 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git for-next 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-riscv64 WARNING in io_sq_thread_stop
2026/11/03 04:45 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master 6628e7d4c6b2 0a94d799 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64 WARNING in io_sq_thread_stop
* Struck through repros no longer work on HEAD.