syzbot


KCSAN: data-race in __flush_work / __flush_work (2)

Status: fixed on 2024/10/03 15:25
Subsystems: kernel
[Documentation on labels]
Reported-by: syzbot+b3e4f2f51ed645fd5df2@syzkaller.appspotmail.com
Fix commit: 8bc35475ef1a workqueue: Fix spruious data race in __flush_work()
First crash: 129d, last: 115d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH wq/for-6.11-fixes] workqueue: Fix spruious data race in __flush_work() 1 (1) 2024/08/05 19:48
[syzbot] [io-uring?] KCSAN: data-race in __flush_work / __flush_work (2) 2 (3) 2024/08/05 18:54
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in __flush_work / __flush_work io-uring 1 181d 181d 0/28 auto-obsoleted due to no activity on 2024/07/19 08:38

Sample crash report:
==================================================================
BUG: KCSAN: data-race in __flush_work / __flush_work

write to 0xffff88810a1b2be8 of 8 bytes by task 10224 on cpu 1:
 instrument_write include/linux/instrumented.h:41 [inline]
 ___set_bit include/asm-generic/bitops/instrumented-non-atomic.h:28 [inline]
 insert_wq_barrier kernel/workqueue.c:3790 [inline]
 start_flush_work kernel/workqueue.c:4142 [inline]
 __flush_work+0x30b/0x570 kernel/workqueue.c:4178
 flush_work kernel/workqueue.c:4229 [inline]
 flush_delayed_work+0x66/0x70 kernel/workqueue.c:4251
 io_fallback_tw+0x24b/0x320 io_uring/io_uring.c:1087
 tctx_task_work_run+0xd1/0x1b0 io_uring/io_uring.c:1099
 tctx_task_work+0x40/0x80 io_uring/io_uring.c:1124
 task_work_run+0x13a/0x1a0 kernel/task_work.c:228
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0x5dd/0x1720 kernel/exit.c:882
 do_group_exit+0x102/0x150 kernel/exit.c:1031
 get_signal+0xf2f/0x1080 kernel/signal.c:2917
 arch_do_signal_or_restart+0x95/0x4b0 arch/x86/kernel/signal.c:310
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x59/0x130 kernel/entry/common.c:218
 do_syscall_64+0xd6/0x1c0 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff88810a1b2be8 of 8 bytes by task 63 on cpu 0:
 __flush_work+0x42a/0x570 kernel/workqueue.c:4188
 flush_work kernel/workqueue.c:4229 [inline]
 flush_delayed_work+0x66/0x70 kernel/workqueue.c:4251
 io_uring_try_cancel_requests+0x35b/0x370 io_uring/io_uring.c:3000
 io_ring_exit_work+0x160/0x500 io_uring/io_uring.c:2779
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0x483/0x9a0 kernel/workqueue.c:3312
 worker_thread+0x526/0x700 kernel/workqueue.c:3390
 kthread+0x1d1/0x210 kernel/kthread.c:389
 ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

value changed: 0xffff88810006c20d -> 0x0000000000c00000

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 63 Comm: kworker/u8:4 Not tainted 6.11.0-rc3-syzkaller-00321-g810996a36309 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Workqueue: iou_exit io_ring_exit_work
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/18 12:49 upstream 810996a36309 dbc93b08 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_work / __flush_work
2024/08/17 20:19 upstream e5fa841af679 dbc93b08 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_work / __flush_work
2024/08/11 22:52 upstream 7006fe2f7f78 6f4edef4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_work / __flush_work
2024/08/09 23:57 upstream ee9a43b7cfe2 a83d9288 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_work / __flush_work
2024/08/05 08:54 upstream de9c2c66ad8e 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_work / __flush_work
2024/08/04 17:15 upstream a5dbd76a8942 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __flush_work / __flush_work
* Struck through repros no longer work on HEAD.