syzbot


possible deadlock in static_key_slow_inc (4)

Status: upstream: reported on 2025/06/02 08:02
Subsystems: kernel
[Documentation on labels]
Reported-by: syzbot+61afb501981e58b312f8@syzkaller.appspotmail.com
First crash: 9d21h, last: 6h10m
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [kernel?] possible deadlock in static_key_slow_inc (4) 0 (1) 2025/06/02 08:02
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in static_key_slow_inc C done 1908 710d 823d 3/3 fixed on 2023/08/16 18:53
upstream possible deadlock in static_key_slow_inc 5 2841d 2776d 0/28 closed as invalid on 2017/10/31 11:27
linux-4.14 possible deadlock in static_key_slow_inc 1 1224d 1224d 0/1 auto-closed as invalid on 2022/05/31 03:42
upstream possible deadlock in static_key_slow_inc (3) cgroups C done 6387 682d 730d 23/28 fixed on 2023/09/28 17:51
linux-4.14 possible deadlock in static_key_slow_inc (2) C 2 852d 891d 0/1 upstream: reported C repro on 2022/12/29 19:42
upstream possible deadlock in static_key_slow_inc (2) cgroups C error 32622 730d 948d 22/28 fixed on 2023/06/08 14:41

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.15.0-syzkaller-13655-gbdc7f8c5adad #0 Not tainted
------------------------------------------------------
syz.1.2/5945 is trying to acquire lock:
ffffffff8e266b50 (cpu_hotplug_lock){++++}-{0:0}, at: static_key_slow_inc+0x12/0x30 kernel/jump_label.c:190

but task is already holding lock:
ffff888026630c70 (&q->rq_qos_mutex){+.+.}-{4:4}, at: wbt_init+0x393/0x540 block/blk-wbt.c:923

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&q->rq_qos_mutex){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/mutex.c:602 [inline]
       __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:747
       wbt_init+0x393/0x540 block/blk-wbt.c:923
       queue_wb_lat_store+0x354/0x3d0 block/blk-sysfs.c:603
       queue_attr_store+0x279/0x320 block/blk-sysfs.c:805
       sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
       kernfs_fop_write_iter+0x351/0x510 fs/kernfs/file.c:334
       new_sync_write fs/read_write.c:593 [inline]
       vfs_write+0x6c7/0x1150 fs/read_write.c:686
       ksys_write+0x12a/0x250 fs/read_write.c:738
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xcd/0x490 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&q->q_usage_counter(io)#52){++++}-{0:0}:
       blk_alloc_queue+0x619/0x760 block/blk-core.c:461
       blk_mq_alloc_queue+0x175/0x290 block/blk-mq.c:4396
       __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4443
       nbd_dev_add+0x4a0/0xbc0 drivers/block/nbd.c:1933
       nbd_init+0x181/0x320 drivers/block/nbd.c:2670
       do_one_initcall+0x120/0x6e0 init/main.c:1273
       do_initcall_level init/main.c:1335 [inline]
       do_initcalls init/main.c:1351 [inline]
       do_basic_setup init/main.c:1370 [inline]
       kernel_init_freeable+0x5c2/0x900 init/main.c:1583
       kernel_init+0x1c/0x2b0 init/main.c:1473
       ret_from_fork+0x5d7/0x6f0 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #1 (fs_reclaim){+.+.}-{0:0}:
       __fs_reclaim_acquire mm/page_alloc.c:4045 [inline]
       fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:4059
       might_alloc include/linux/sched/mm.h:318 [inline]
       slab_pre_alloc_hook mm/slub.c:4099 [inline]
       slab_alloc_node mm/slub.c:4177 [inline]
       __kmalloc_cache_node_noprof+0x53/0x420 mm/slub.c:4367
       kmalloc_node_noprof include/linux/slab.h:928 [inline]
       alloc_worker kernel/workqueue.c:2647 [inline]
       create_worker+0x10f/0x7e0 kernel/workqueue.c:2790
       workqueue_prepare_cpu+0xb5/0x160 kernel/workqueue.c:6650
       cpuhp_invoke_callback+0x3d5/0xa10 kernel/cpu.c:194
       __cpuhp_invoke_callback_range+0x101/0x210 kernel/cpu.c:967
       cpuhp_invoke_callback_range kernel/cpu.c:991 [inline]
       cpuhp_up_callbacks kernel/cpu.c:1022 [inline]
       _cpu_up+0x3f5/0x930 kernel/cpu.c:1687
       cpu_up+0x1dc/0x240 kernel/cpu.c:1719
       cpuhp_bringup_mask+0xd8/0x210 kernel/cpu.c:1785
       cpuhp_bringup_cpus_parallel kernel/cpu.c:1875 [inline]
       bringup_nonboot_cpus+0x176/0x1c0 kernel/cpu.c:1889
       smp_init+0x34/0x160 kernel/smp.c:1010
       kernel_init_freeable+0x3a8/0x900 init/main.c:1575
       kernel_init+0x1c/0x2b0 init/main.c:1473
       ret_from_fork+0x5d7/0x6f0 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #0 (cpu_hotplug_lock){++++}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3168 [inline]
       check_prevs_add kernel/locking/lockdep.c:3287 [inline]
       validate_chain kernel/locking/lockdep.c:3911 [inline]
       __lock_acquire+0x126f/0x1c90 kernel/locking/lockdep.c:5240
       lock_acquire kernel/locking/lockdep.c:5871 [inline]
       lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5828
       percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline]
       percpu_down_read include/linux/percpu-rwsem.h:77 [inline]
       cpus_read_lock+0x42/0x160 kernel/cpu.c:490
       static_key_slow_inc+0x12/0x30 kernel/jump_label.c:190
       rq_qos_add+0x2f8/0x4b0 block/blk-rq-qos.c:349
       wbt_init+0x3a9/0x540 block/blk-wbt.c:924
       queue_wb_lat_store+0x354/0x3d0 block/blk-sysfs.c:603
       queue_attr_store+0x279/0x320 block/blk-sysfs.c:805
       sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
       kernfs_fop_write_iter+0x351/0x510 fs/kernfs/file.c:334
       new_sync_write fs/read_write.c:593 [inline]
       vfs_write+0x6c7/0x1150 fs/read_write.c:686
       ksys_write+0x12a/0x250 fs/read_write.c:738
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xcd/0x490 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  cpu_hotplug_lock --> &q->q_usage_counter(io)#52 --> &q->rq_qos_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&q->rq_qos_mutex);
                               lock(&q->q_usage_counter(io)#52);
                               lock(&q->rq_qos_mutex);
  rlock(cpu_hotplug_lock);

 *** DEADLOCK ***

7 locks held by syz.1.2/5945:
 #0: ffff88803288c638 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x2a2/0x370 fs/file.c:1213
 #1: ffff888036948428 (sb_writers#7){.+.+}-{0:0}, at: ksys_write+0x12a/0x250 fs/read_write.c:738
 #2: ffff88805c67e888 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x28f/0x510 fs/kernfs/file.c:325
 #3: ffff888025d6d878 (kn->active#62){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x2b2/0x510 fs/kernfs/file.c:326
 #4: ffff888026630a70 (&q->q_usage_counter(io)#52){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205
 #5: ffff888026630aa8 (&q->q_usage_counter(queue)#4){+.+.}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205
 #6: ffff888026630c70 (&q->rq_qos_mutex){+.+.}-{4:4}, at: wbt_init+0x393/0x540 block/blk-wbt.c:923

stack backtrace:
CPU: 1 UID: 0 PID: 5945 Comm: syz.1.2 Not tainted 6.15.0-syzkaller-13655-gbdc7f8c5adad #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2046
 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3168 [inline]
 check_prevs_add kernel/locking/lockdep.c:3287 [inline]
 validate_chain kernel/locking/lockdep.c:3911 [inline]
 __lock_acquire+0x126f/0x1c90 kernel/locking/lockdep.c:5240
 lock_acquire kernel/locking/lockdep.c:5871 [inline]
 lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5828
 percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline]
 percpu_down_read include/linux/percpu-rwsem.h:77 [inline]
 cpus_read_lock+0x42/0x160 kernel/cpu.c:490
 static_key_slow_inc+0x12/0x30 kernel/jump_label.c:190
 rq_qos_add+0x2f8/0x4b0 block/blk-rq-qos.c:349
 wbt_init+0x3a9/0x540 block/blk-wbt.c:924
 queue_wb_lat_store+0x354/0x3d0 block/blk-sysfs.c:603
 queue_attr_store+0x279/0x320 block/blk-sysfs.c:805
 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
 kernfs_fop_write_iter+0x351/0x510 fs/kernfs/file.c:334
 new_sync_write fs/read_write.c:593 [inline]
 vfs_write+0x6c7/0x1150 fs/read_write.c:686
 ksys_write+0x12a/0x250 fs/read_write.c:738
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x490 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fae5738e929
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fae582b0038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fae575b6080 RCX: 00007fae5738e929
RDX: 0000000000000081 RSI: 00002000000001c0 RDI: 0000000000000007
RBP: 00007fae57410b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fae575b6080 R15: 00007ffe54da0de8
 </TASK>

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/07 22:55 upstream bdc7f8c5adad 4826c28e .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in static_key_slow_inc
2025/06/07 14:38 upstream bdc7f8c5adad 4826c28e .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in static_key_slow_inc
2025/06/05 22:53 upstream ec7714e49479 6b6b5f21 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in static_key_slow_inc
2025/06/05 22:45 upstream ec7714e49479 6b6b5f21 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in static_key_slow_inc
2025/06/05 22:42 upstream ec7714e49479 6b6b5f21 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in static_key_slow_inc
2025/06/05 22:39 upstream ec7714e49479 6b6b5f21 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in static_key_slow_inc
2025/05/31 06:29 upstream 8477ab143069 3d2f584d .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in static_key_slow_inc
2025/05/29 07:53 upstream 90b83efa6701 3d2f584d .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in static_key_slow_inc
* Struck through repros no longer work on HEAD.