======================================================
WARNING: possible circular locking dependency detected
6.1.16-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/3681 is trying to acquire lock:
ffff888021ce3b00 (&q->queue_lock){..-.}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline]
ffff888021ce3b00 (&q->queue_lock){..-.}-{2:2}, at: throtl_pending_timer_fn+0x10d/0x1be0 block/blk-throttle.c:1193
but task is already holding lock:
ffffc900001e0bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:41 [inline]
ffffc900001e0bc0 ((&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
PageTail include/linux/page-flags.h:292 [inline]
folio_flags include/linux/page-flags.h:319 [inline]
folio_test_slab include/linux/page-flags.h:487 [inline]
virt_to_slab+0x2a/0xa0 mm/slab.h:177
kmem_cache_free+0x90/0x580 mm/slub.c:3683
sk_prot_free net/core/sock.c:2066 [inline]
__sk_destruct+0x463/0x5f0 net/core/sock.c:2154
inet_release+0x174/0x1f0 net/ipv4/af_inet.c:429
__sock_release net/socket.c:652 [inline]
sock_close+0xcd/0x230 net/socket.c:1370
__fput+0x3b7/0x890 fs/file_table.c:320
task_work_run+0x246/0x300 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:203
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x60/0x2d0 kernel/entry/common.c:296
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
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 ***
2 locks held by syz-executor.0/3681:
#0: ffff88805e5d2c10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
#0: ffff88805e5d2c10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: __sock_release net/socket.c:651 [inline]
#0: ffff88805e5d2c10 (&sb->s_type->i_mutex_key#10){+.+.}-{3:3}, at: sock_close+0x98/0x230 net/socket.c:1370
#1: ffffc900001e0bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:41 [inline]
#1: ffffc900001e0bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: call_timer_fn+0xbd/0x840 kernel/time/timer.c:1464
stack backtrace:
CPU: 1 PID: 3681 Comm: syz-executor.0 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:PageTail include/linux/page-flags.h:292 [inline]
RIP: 0010:folio_flags include/linux/page-flags.h:319 [inline]
RIP: 0010:folio_test_slab include/linux/page-flags.h:487 [inline]
RIP: 0010:virt_to_slab+0x2a/0xa0 mm/slab.h:177
Code: e8 4b e0 5d ff 48 c1 e8 06 48 83 e0 c0 48 ba 00 00 00 00 00 ea ff ff 48 8b 4c 10 08 f6 c1 01 75 3b 48 01 d0 66 90 48 8b 48 08 c1 01 75 58 66 90 48 8b 08 48 c1 e1 36 48 c1 f9 3f 48 21 c1 48
RSP: 0018:ffffc90003f8fc20 EFLAGS: 00000286
RAX: ffffea0000754800 RBX: ffff888027aca3c0 RCX: 0000000000000000
RDX: ffffea0000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000003 R08: ffffffff813dcf88 R09: fffffbfff204cc44
R10: 0000000000000000 R11: dffffc0000000001 R12: ffff88801d521980
R13: ffff88801d521980 R14: ffff888027aca3c0 R15: 0000000000000000
kmem_cache_free+0x90/0x580 mm/slub.c:3683
sk_prot_free net/core/sock.c:2066 [inline]
__sk_destruct+0x463/0x5f0 net/core/sock.c:2154
inet_release+0x174/0x1f0 net/ipv4/af_inet.c:429
__sock_release net/socket.c:652 [inline]
sock_close+0xcd/0x230 net/socket.c:1370
__fput+0x3b7/0x890 fs/file_table.c:320
task_work_run+0x246/0x300 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:203
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x60/0x2d0 kernel/entry/common.c:296
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5271c3dfab
Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:00007ffe63bd5700 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 00007ffe63bd57a0 RCX: 00007f5271c3dfab
RDX: 0000000000000000 RSI: 000000abf1e4f9b8 RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: ffff000000000000
R10: 0000000000000010 R11: 0000000000000293 R12: 0000000000000032
R13: 000000000004fc1e R14: 0000000000000002 R15: 00007ffe63bd57e0
----------------
Code disassembly (best guess):
0: e8 4b e0 5d ff callq 0xff5de050
5: 48 c1 e8 06 shr $0x6,%rax
9: 48 83 e0 c0 and $0xffffffffffffffc0,%rax
d: 48 ba 00 00 00 00 00 movabs $0xffffea0000000000,%rdx
14: ea ff ff
17: 48 8b 4c 10 08 mov 0x8(%rax,%rdx,1),%rcx
1c: f6 c1 01 test $0x1,%cl
1f: 75 3b jne 0x5c
21: 48 01 d0 add %rdx,%rax
24: 66 90 xchg %ax,%ax
26: 48 8b 48 08 mov 0x8(%rax),%rcx
* 2a: f6 c1 01 test $0x1,%cl <-- trapping instruction
2d: 75 58 jne 0x87
2f: 66 90 xchg %ax,%ax
31: 48 8b 08 mov (%rax),%rcx
34: 48 c1 e1 36 shl $0x36,%rcx
38: 48 c1 f9 3f sar $0x3f,%rcx
3c: 48 21 c1 and %rax,%rcx
3f: 48 rex.W