syzbot


KCSAN: data-race in sg_ioctl / sg_rq_end_io (5)

Status: moderation: reported on 2024/10/22 21:07
Subsystems: scsi
[Documentation on labels]
Reported-by: syzbot+2239bbb1012ad9fb368d@syzkaller.appspotmail.com
First crash: 29d, last: 29d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in sg_ioctl / sg_rq_end_io scsi 1 1159d 1159d 0/28 auto-closed as invalid on 2021/10/23 07:44
upstream KCSAN: data-race in sg_ioctl / sg_rq_end_io (4) scsi 2 227d 255d 0/28 auto-obsoleted due to no activity on 2024/05/13 03:00
upstream KCSAN: data-race in sg_ioctl / sg_rq_end_io (3) scsi 1 820d 820d 0/28 auto-closed as invalid on 2022/09/27 16:29
upstream KCSAN: data-race in sg_ioctl / sg_rq_end_io (2) scsi 2 1055d 1067d 0/28 auto-closed as invalid on 2022/02/04 08:07

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

write to 0xffff888114d1e11c of 4 bytes by interrupt on cpu 1:
 sg_rq_end_io+0x154/0x710 drivers/scsi/sg.c:1350
 __blk_mq_end_request+0x2fa/0x380 block/blk-mq.c:1041
 scsi_end_request+0x29f/0x4d0 drivers/scsi/scsi_lib.c:664
 scsi_io_completion+0x9f/0x200 drivers/scsi/scsi_lib.c:1067
 scsi_finish_command+0x1be/0x1d0 drivers/scsi/scsi.c:198
 scsi_complete+0x19a/0x1d0 drivers/scsi/scsi_lib.c:1523
 blk_complete_reqs block/blk-mq.c:1126 [inline]
 blk_done_softirq+0x74/0xb0 block/blk-mq.c:1131
 handle_softirqs+0xbf/0x280 kernel/softirq.c:554
 __do_softirq kernel/softirq.c:588 [inline]
 invoke_softirq kernel/softirq.c:428 [inline]
 __irq_exit_rcu kernel/softirq.c:637 [inline]
 irq_exit_rcu+0x3e/0x90 kernel/softirq.c:649
 common_interrupt+0x81/0x90 arch/x86/kernel/irq.c:278
 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
 kcsan_setup_watchpoint+0x404/0x410 kernel/kcsan/core.c:705
 pv_queued_spin_unlock arch/x86/include/asm/paravirt.h:589 [inline]
 queued_spin_unlock arch/x86/include/asm/qspinlock.h:57 [inline]
 do_raw_spin_unlock include/linux/spinlock.h:204 [inline]
 __raw_spin_unlock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_unlock+0x14/0x50 kernel/locking/spinlock.c:186
 spin_unlock include/linux/spinlock.h:391 [inline]
 io_poll_remove_all_table+0x17b/0x1c0 io_uring/poll.c:785
 io_poll_remove_all+0x2a/0x50 io_uring/poll.c:799
 io_uring_try_cancel_requests+0x2cd/0x370 io_uring/io_uring.c:3125
 io_ring_exit_work+0x160/0x500 io_uring/io_uring.c:2913
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0x483/0x9a0 kernel/workqueue.c:3310
 worker_thread+0x51d/0x6f0 kernel/workqueue.c:3391
 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

read to 0xffff888114d1e11c of 4 bytes by task 4364 on cpu 0:
 sg_fill_request_table drivers/scsi/sg.c:881 [inline]
 sg_ioctl_common drivers/scsi/sg.c:1089 [inline]
 sg_ioctl+0x965/0x1870 drivers/scsi/sg.c:1163
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xcd/0x140 fs/ioctl.c:893
 __x64_sys_ioctl+0x43/0x50 fs/ioctl.c:893
 x64_sys_call+0x15cc/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:17
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xc9/0x1c0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

value changed: 0xfffc2778 -> 0x00000000

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 4364 Comm: syz.4.283 Not tainted 6.12.0-rc4-syzkaller-00045-gd12937763990 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/22 21:07 upstream d12937763990 a93682b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in sg_ioctl / sg_rq_end_io
* Struck through repros no longer work on HEAD.