[moderation] [io-uring?] KCSAN: data-race in __io_commit_cqring_flush / io_submit_sqes (2)

0 views
Skip to first unread message

syzbot

unread,
7:05 PM (1 hour ago) 7:05 PM
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 8dac6df92a2e Merge tag 'nfsd-7.4-1' of git://git.kernel.or..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13ebb54d580000
kernel config: https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
dashboard link: https://syzkaller.appspot.com/bug?extid=1348744d623585ce0fc4
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [ax...@kernel.dk io-u...@vger.kernel.org linux-...@vger.kernel.org]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/dfc787d10469/disk-8dac6df9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/db7a8e4799da/vmlinux-8dac6df9.xz
kernel image: https://storage.googleapis.com/syzbot-assets/169073a123bc/bzImage-8dac6df9.xz

AI-generated root cause summary:
A data race occurs on the 32-bit non-atomic `ctx->int_flags` field between
`io_init_req()` and `__io_commit_cqring_flush()`. When an SQE with
`IOSQE_CQE_SKIP_SUCCESS` is submitted (e.g. by an SQPOLL thread holding
`ctx->uring_lock`), `io_init_req()` performs a non-atomic read-modify-write
`ctx->int_flags |= IO_RING_F_DRAIN_DISABLED;`. Meanwhile, an async completion
running concurrently on an io-wq worker calls `io_commit_cqring_flush()`, which
evaluates `data_race(ctx->int_flags) & SHOULD_FLUSH_MASK` and invokes
`__io_commit_cqring_flush()`, where unannotated plain C loads inspect
`ctx->int_flags` without holding `uring_lock`. Because mutable submission flags
and cross-thread completion flush flags share the same unannotated non-atomic
integer word, KCSAN detects the concurrent read and write.

full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=1348744d623585ce0fc4

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+134874...@syzkaller.appspotmail.com

==================================================================
BUG: KCSAN: data-race in __io_commit_cqring_flush / io_submit_sqes

write to 0xffff888104547004 of 4 bytes by task 5128 on cpu 0:
io_init_req io_uring/io_uring.c:1939 [inline]
io_submit_sqe io_uring/io_uring.c:2044 [inline]
io_submit_sqes+0xcf3/0x12b0 io_uring/io_uring.c:2212
__io_sq_thread io_uring/sqpoll.c:252 [inline]
io_sq_thread+0xaaa/0x16f0 io_uring/sqpoll.c:369
ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

read to 0xffff888104547004 of 4 bytes by task 5129 on cpu 1:
__io_commit_cqring_flush+0x1e/0x100 io_uring/io_uring.c:533
io_commit_cqring_flush io_uring/io_uring.h:519 [inline]
io_cq_unlock_post io_uring/io_uring.c:572 [inline]
io_req_complete_post io_uring/io_uring.c:1030 [inline]
io_issue_sqe+0xc16/0xd20 io_uring/io_uring.c:1546
io_wq_submit_work+0x64d/0x8f0 io_uring/io_uring.c:1677
io_worker_handle_work+0x688/0xd30 io_uring/io-wq.c:677
io_wq_worker+0x2be/0xcb0 io_uring/io-wq.c:768
ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 5129 Comm: iou-wrk-5128 Not tainted syzkaller #0 PREEMPT(lazy)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages