======================================================
WARNING: possible circular locking dependency detected
6.1.16-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/3678 is trying to acquire lock:
ffff8881478819c0 (&q->queue_lock){..-.}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline]
ffff8881478819c0 (&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
unwind_next_frame+0x0/0x2220
arch_stack_walk+0x10d/0x140 arch/x86/kernel/stacktrace.c:25
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_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
kmem_cache_free+0x2b6/0x580 mm/slub.c:3683
__merge_or_add_vmap_area mm/vmalloc.c:1192 [inline]
merge_or_add_vmap_area mm/vmalloc.c:1211 [inline]
free_vmap_area_noflush+0x90c/0x9c0 mm/vmalloc.c:1827
free_unmap_vmap_area mm/vmalloc.c:1846 [inline]
remove_vm_area+0x1ac/0x1d0 mm/vmalloc.c:2605
vm_remove_mappings mm/vmalloc.c:2634 [inline]
__vunmap+0x348/0x9a0 mm/vmalloc.c:2699
copy_entries_to_user net/ipv4/netfilter/ip_tables.c:868 [inline]
get_entries net/ipv4/netfilter/ip_tables.c:1024 [inline]
do_ipt_get_ctl+0x11d8/0x1890 net/ipv4/netfilter/ip_tables.c:1663
nf_getsockopt+0x28e/0x2b0 net/netfilter/nf_sockopt.c:116
ip_getsockopt+0x21a/0x2d0 net/ipv4/ip_sockglue.c:1796
tcp_getsockopt+0x15c/0x1c0 net/ipv4/tcp.c:4403
__sys_getsockopt+0x2b2/0x5d0 net/socket.c:2296
__do_sys_getsockopt net/socket.c:2311 [inline]
__se_sys_getsockopt net/socket.c:2308 [inline]
__x64_sys_getsockopt+0xb1/0xc0 net/socket.c:2308
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 ***
3 locks held by syz-executor.3/3678:
#0: ffff88814abd0308 (&xt[i].mutex){+.+.}-{3:3}, at: xt_find_table_lock+0x48/0x3a0 net/netfilter/x_tables.c:1242
#1: ffffffff8cffe5d8 (purge_vmap_area_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:350 [inline]
#1: ffffffff8cffe5d8 (purge_vmap_area_lock){+.+.}-{2:2}, at: free_vmap_area_noflush+0x1ed/0x9c0 mm/vmalloc.c:1826
#2: ffffc90000007bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:41 [inline]
#2: ffffc90000007bc0 ((&sq->pending_timer)){+.-.}-{0:0}, at: call_timer_fn+0xbd/0x840 kernel/time/timer.c:1464
stack backtrace:
CPU: 0 PID: 3678 Comm: syz-executor.3 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:unwind_next_frame+0x0/0x2220 arch/x86/kernel/unwind_orc.c:423
Code: eb 02 31 c0 5b 41 5e 41 5f c3 44 89 f1 80 e1 07 80 c1 03 38 c1 7c 95 4c 89 f7 e8 cb ff a3 00 eb 8b 66 0f 1f 84 00 00 00 00 00 <55> 41 57 41 56 41 55 41 54 53 48 81 ec a8 00 00 00 48 89 fb 49 be
RSP: 0018:ffffc90003d9f358 EFLAGS: 00000202
RAX: 0000000000000001 RBX: ffffc90003d9f360 RCX: ffffffff8f8e8000
RDX: dffffc0000000000 RSI: ffffffff81e0984b RDI: ffffc90003d9f360
RBP: ffffc90003d9f3f0 R08: 0000000000000000 R09: ffffc90003d9f450
R10: 0000000000000000 R11: dffffc0000000001 R12: ffff888023abd7c0
R13: ffffffff81785090 R14: ffffc90003d9f440 R15: 0000000000000000
arch_stack_walk+0x10d/0x140 arch/x86/kernel/stacktrace.c:25
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_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
kmem_cache_free+0x2b6/0x580 mm/slub.c:3683
__merge_or_add_vmap_area mm/vmalloc.c:1192 [inline]
merge_or_add_vmap_area mm/vmalloc.c:1211 [inline]
free_vmap_area_noflush+0x90c/0x9c0 mm/vmalloc.c:1827
free_unmap_vmap_area mm/vmalloc.c:1846 [inline]
remove_vm_area+0x1ac/0x1d0 mm/vmalloc.c:2605
vm_remove_mappings mm/vmalloc.c:2634 [inline]
__vunmap+0x348/0x9a0 mm/vmalloc.c:2699
copy_entries_to_user net/ipv4/netfilter/ip_tables.c:868 [inline]
get_entries net/ipv4/netfilter/ip_tables.c:1024 [inline]
do_ipt_get_ctl+0x11d8/0x1890 net/ipv4/netfilter/ip_tables.c:1663
nf_getsockopt+0x28e/0x2b0 net/netfilter/nf_sockopt.c:116
ip_getsockopt+0x21a/0x2d0 net/ipv4/ip_sockglue.c:1796
tcp_getsockopt+0x15c/0x1c0 net/ipv4/tcp.c:4403
__sys_getsockopt+0x2b2/0x5d0 net/socket.c:2296
__do_sys_getsockopt net/socket.c:2311 [inline]
__se_sys_getsockopt net/socket.c:2308 [inline]
__x64_sys_getsockopt+0xb1/0xc0 net/socket.c:2308
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:0x7f713e88d71a
Code: 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 37 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd08161fa8 EFLAGS: 00000202 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f713e88d71a
RDX: 0000000000000041 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007ffd08161fd0 R08: 00007ffd08161fcc R09: ffffffffff000000
R10: 00007ffd08162030 R11: 0000000000000202 R12: 00007ffd08162030
R13: 0000000000000003 R14: 00007ffd08161fcc R15: 00007f713e987160
----------------
Code disassembly (best guess):
0: eb 02 jmp 0x4
2: 31 c0 xor %eax,%eax
4: 5b pop %rbx
5: 41 5e pop %r14
7: 41 5f pop %r15
9: c3 retq
a: 44 89 f1 mov %r14d,%ecx
d: 80 e1 07 and $0x7,%cl
10: 80 c1 03 add $0x3,%cl
13: 38 c1 cmp %al,%cl
15: 7c 95 jl 0xffffffac
17: 4c 89 f7 mov %r14,%rdi
1a: e8 cb ff a3 00 callq 0xa3ffea
1f: eb 8b jmp 0xffffffac
21: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
28: 00 00
* 2a: 55 push %rbp <-- trapping instruction
2b: 41 57 push %r15
2d: 41 56 push %r14
2f: 41 55 push %r13
31: 41 54 push %r12
33: 53 push %rbx
34: 48 81 ec a8 00 00 00 sub $0xa8,%rsp
3b: 48 89 fb mov %rdi,%rbx
3e: 49 rex.WB
3f: be .byte 0xbe