======================================================
WARNING: possible circular locking dependency detected
6.1.16-syzkaller #0 Not tainted
------------------------------------------------------
udevd/7724 is trying to acquire lock:
ffff888020785c40 (&q->queue_lock){..-.}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline]
ffff888020785c40 (&q->queue_lock){..-.}-{2:2}, at: throtl_pending_timer_fn+0x10d/0x1be0 block/blk-throttle.c:1193
but task is already holding lock:
ffffc90000007bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:41 [inline]
ffffc90000007bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: call_timer_fn+0xbd/0x840 kernel/time/timer.c:1464
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 ((&sq->pending_timer)){+.-.}-{0:0}:
lock_acquire+0x23a/0x630 kernel/locking/lockdep.c:5669
del_timer_sync+0x111/0x2e0 kernel/time/timer.c:1417
throtl_pd_free+0x15/0x40 block/blk-throttle.c:493
blkcg_deactivate_policy+0x32d/0x550 block/blk-cgroup.c:1499
blk_throtl_exit+0xa6/0x140 block/blk-throttle.c:2406
disk_release+0x1dd/0x380 block/genhd.c:1171
device_release+0x91/0x1c0
kobject_cleanup lib/kobject.c:681 [inline]
kobject_release lib/kobject.c:712 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x224/0x460 lib/kobject.c:729
do_floppy_init+0x373/0xc59 drivers/block/floppy.c:4758
async_run_entry_fn+0xa2/0x410 kernel/async.c:127
process_one_work+0x909/0x1380 kernel/workqueue.c:2289
worker_thread+0xa5f/0x1210 kernel/workqueue.c:2436
kthread+0x268/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
-> #1 (&blkcg->lock){....}-{2:2}:
lock_acquire+0x23a/0x630 kernel/locking/lockdep.c:5669
__raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
_raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
spin_lock include/linux/spinlock.h:350 [inline]
blkg_create+0xa94/0x1280 block/blk-cgroup.c:336
blkcg_init_disk+0xee/0x350 block/blk-cgroup.c:1260
__alloc_disk_node+0x2ce/0x590 block/genhd.c:1385
__blk_alloc_disk+0x2c/0x80 block/genhd.c:1424
brd_alloc+0x2f9/0x6a0 drivers/block/brd.c:397
brd_init+0x100/0x1c2 drivers/block/brd.c:484
do_one_initcall+0x2d6/0xa80 init/main.c:1303
do_initcall_level+0x157/0x207 init/main.c:1376
do_initcalls+0x49/0x86 init/main.c:1392
kernel_init_freeable+0x473/0x61f init/main.c:1631
kernel_init+0x19/0x290 init/main.c:1519
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
-> #0 (&q->queue_lock){..-.}-{2:2}:
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x23a/0x630 kernel/locking/lockdep.c:5669
__raw_spin_lock_irq include/linux/spinlock_api_smp.h:119 [inline]
_raw_spin_lock_irq+0xcf/0x110 kernel/locking/spinlock.c:170
spin_lock_irq include/linux/spinlock.h:375 [inline]
throtl_pending_timer_fn+0x10d/0x1be0 block/blk-throttle.c:1193
call_timer_fn+0x200/0x840 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers+0x67c/0x890 kernel/time/timer.c:1790
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803
__do_softirq+0x30d/0xb1b kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x155/0x240 kernel/softirq.c:650
irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1107
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649
finish_lock_switch+0x91/0x100 kernel/sched/core.c:4998
finish_task_switch+0x134/0x630 kernel/sched/core.c:5115
context_switch kernel/sched/core.c:5241 [inline]
__schedule+0x1399/0x4390 kernel/sched/core.c:6551
preempt_schedule_irq+0xf7/0x1c0 kernel/sched/core.c:6863
irqentry_exit+0x53/0x80 kernel/entry/common.c:432
asm_sysvec_reschedule_ipi+0x16/0x20 arch/x86/include/asm/idtentry.h:654
unwind_done arch/x86/include/asm/unwind.h:50 [inline]
unwind_get_return_address+0x19/0x80 arch/x86/kernel/unwind_orc.c:320
arch_stack_walk+0xf3/0x140 arch/x86/kernel/stacktrace.c:26
stack_trace_save+0x113/0x1c0 kernel/stacktrace.c:122
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
__kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x50/0x370 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
kmem_cache_alloc_node+0x142/0x2a0 mm/slub.c:3443
__alloc_skb+0xde/0x620 net/core/skbuff.c:497
alloc_skb include/linux/skbuff.h:1267 [inline]
alloc_skb_with_frags+0xa4/0x740 net/core/skbuff.c:6128
sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2721
unix_dgram_sendmsg+0x5b1/0x2050 net/unix/af_unix.c:1943
sock_sendmsg_nosec net/socket.c:716 [inline]
sock_sendmsg net/socket.c:736 [inline]
sock_write_iter+0x394/0x4e0 net/socket.c:1113
call_write_iter include/linux/fs.h:2205 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x7ae/0xba0 fs/read_write.c:584
ksys_write+0x19c/0x2c0 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
other info that might help us debug this:
Chain exists of:
&q->queue_lock --> &blkcg->lock --> (&sq->pending_timer)
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock((&sq->pending_timer));
lock(&blkcg->lock);
lock((&sq->pending_timer));
lock(&q->queue_lock);
*** DEADLOCK ***
1 lock held by udevd/7724:
#0: ffffc90000007bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:41 [inline]
#0: ffffc90000007bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: call_timer_fn+0xbd/0x840 kernel/time/timer.c:1464
stack backtrace:
CPU: 0 PID: 7724 Comm: udevd Not tainted 6.1.16-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2178
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x23a/0x630 kernel/locking/lockdep.c:5669
__raw_spin_lock_irq include/linux/spinlock_api_smp.h:119 [inline]
_raw_spin_lock_irq+0xcf/0x110 kernel/locking/spinlock.c:170
spin_lock_irq include/linux/spinlock.h:375 [inline]
throtl_pending_timer_fn+0x10d/0x1be0 block/blk-throttle.c:1193
call_timer_fn+0x200/0x840 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers+0x67c/0x890 kernel/time/timer.c:1790
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803
__do_softirq+0x30d/0xb1b kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x155/0x240 kernel/softirq.c:650
irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1107
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:finish_lock_switch+0x91/0x100 kernel/sched/core.c:4998
Code: 45 31 c9 68 e7 9c 60 81 e8 1c a3 09 00 48 83 c4 08 4c 89 ff e8 90 c9 fe ff 66 90 4c 89 ff e8 f6 e0 32 09 e8 b1 73 30 00 fb 5b <41> 5c 41 5d 41 5e 41 5f c3 44 89 f1 80 e1 07 80 c1 03 38 c1 7c 87
RSP: 0018:ffffc900098cee98 EFLAGS: 00000286
RAX: a45c624bf5a6dd00 RBX: ffff8880489a9d74 RCX: ffffffff91a5e003
RDX: dffffc0000000000 RSI: ffffffff8aebd320 RDI: ffffffff8b3d0ba0
RBP: ffffc900098cef10 R08: dffffc0000000000 R09: ffffed10173073b9
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 1ffff11017307563 R14: ffff8880b983ab18 R15: ffff8880b9839dc0
finish_task_switch+0x134/0x630 kernel/sched/core.c:5115
context_switch kernel/sched/core.c:5241 [inline]
__schedule+0x1399/0x4390 kernel/sched/core.c:6551
preempt_schedule_irq+0xf7/0x1c0 kernel/sched/core.c:6863
irqentry_exit+0x53/0x80 kernel/entry/common.c:432
asm_sysvec_reschedule_ipi+0x16/0x20 arch/x86/include/asm/idtentry.h:654
RIP: 0010:unwind_done arch/x86/include/asm/unwind.h:50 [inline]
RIP: 0010:unwind_get_return_address+0x19/0x80 arch/x86/kernel/unwind_orc.c:320
Code: 40 8b 74 24 14 e9 e1 fe ff ff e8 f2 f9 4c 09 66 90 41 57 41 56 53 48 89 fb 49 be 00 00 00 00 00 fc ff df 48 89 f8 48 c1 e8 03 <42> 0f b6 04 30 84 c0 75 47 83 3b 00 74 3a 48 83 c3 48 49 89 df 49
RSP: 0018:ffffc900098cf260 EFLAGS: 00000a06
RAX: 1ffff92001319e50 RBX: ffffc900098cf280 RCX: 0000000080000000
RDX: dffffc0000000000 RSI: ffffc900098c8000 RDI: ffffc900098cf280
RBP: ffffc900098cf310 R08: ffffc900098cfcb0 R09: ffffc900098cf2d0
R10: 0000000000000000 R11: dffffc0000000001 R12: ffff88807b7b3a80
R13: ffffffff81785090 R14: dffffc0000000000 R15: 0000000000000000
arch_stack_walk+0xf3/0x140 arch/x86/kernel/stacktrace.c:26
stack_trace_save+0x113/0x1c0 kernel/stacktrace.c:122
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
__kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x50/0x370 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
kmem_cache_alloc_node+0x142/0x2a0 mm/slub.c:3443
__alloc_skb+0xde/0x620 net/core/skbuff.c:497
alloc_skb include/linux/skbuff.h:1267 [inline]
alloc_skb_with_frags+0xa4/0x740 net/core/skbuff.c:6128
sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2721
unix_dgram_sendmsg+0x5b1/0x2050 net/unix/af_unix.c:1943
sock_sendmsg_nosec net/socket.c:716 [inline]
sock_sendmsg net/socket.c:736 [inline]
sock_write_iter+0x394/0x4e0 net/socket.c:1113
call_write_iter include/linux/fs.h:2205 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x7ae/0xba0 fs/read_write.c:584
ksys_write+0x19c/0x2c0 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f3d73f259a3
Code: 8b 15 d9 f4 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 64 8b 04 25 18 00 00 00 85 c0 75 14 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 55 c3 0f 1f 40 00 48 83 ec 28 48 89 54 24 18
RSP: 002b:00007ffdb3be3388 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f3d73f259a3
RDX: 0000000000000000 RSI: 00007ffdb3be33df RDI: 000000000000000a
RBP: 00007ffdb3be33df R08: 0000000000000001 R09: 00005565e2e571c0
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000a
R13: 00007f3d743536a8 R14: 0000000000000000 R15: 00005565e2e4f910
----------------
Code disassembly (best guess):
0: 45 31 c9 xor %r9d,%r9d
3: 68 e7 9c 60 81 pushq $0xffffffff81609ce7
8: e8 1c a3 09 00 callq 0x9a329
d: 48 83 c4 08 add $0x8,%rsp
11: 4c 89 ff mov %r15,%rdi
14: e8 90 c9 fe ff callq 0xfffec9a9
19: 66 90 xchg %ax,%ax
1b: 4c 89 ff mov %r15,%rdi
1e: e8 f6 e0 32 09 callq 0x932e119
23: e8 b1 73 30 00 callq 0x3073d9
28: fb sti
29: 5b pop %rbx
* 2a: 41 5c pop %r12 <-- trapping instruction
2c: 41 5d pop %r13
2e: 41 5e pop %r14
30: 41 5f pop %r15
32: c3 retq
33: 44 89 f1 mov %r14d,%ecx
36: 80 e1 07 and $0x7,%cl
39: 80 c1 03 add $0x3,%cl
3c: 38 c1 cmp %al,%cl
3e: 7c 87 jl 0xffffffc7