====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.2.1409/10332 is trying to acquire lock: ffffffff8e531fa8 (pcpu_alloc_mutex){+.+.}-{4:4}, at: pcpu_alloc_noprof+0xb4c/0x14c0 mm/percpu.c:1782 but task is already holding lock: ffff8880263f1e18 (&q->q_usage_counter(io)#17){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&q->q_usage_counter(io)#17){++++}-{0:0}: blk_alloc_queue+0x619/0x760 block/blk-core.c:461 blk_mq_alloc_queue+0x172/0x280 block/blk-mq.c:4399 __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4446 loop_add+0x490/0xb70 drivers/block/loop.c:2047 loop_init+0x164/0x270 drivers/block/loop.c:2282 do_one_initcall+0x123/0x6e0 init/main.c:1283 do_initcall_level init/main.c:1345 [inline] do_initcalls init/main.c:1361 [inline] do_basic_setup init/main.c:1380 [inline] kernel_init_freeable+0x5c8/0x920 init/main.c:1593 kernel_init+0x1c/0x2b0 init/main.c:1483 ret_from_fork+0x675/0x7d0 arch/x86/kernel/process.c:158 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:4269 [inline] fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:4283 might_alloc include/linux/sched/mm.h:318 [inline] prepare_alloc_pages+0x162/0x610 mm/page_alloc.c:4951 __alloc_frozen_pages_noprof+0x18b/0x2470 mm/page_alloc.c:5172 __alloc_pages_noprof+0xb/0x1b0 mm/page_alloc.c:5217 __alloc_pages_node_noprof include/linux/gfp.h:284 [inline] alloc_pages_node_noprof include/linux/gfp.h:311 [inline] pcpu_alloc_pages mm/percpu-vm.c:95 [inline] pcpu_populate_chunk+0x110/0xb00 mm/percpu-vm.c:285 pcpu_alloc_noprof+0x86a/0x14c0 mm/percpu.c:1870 xt_percpu_counter_alloc+0x13e/0x1b0 net/netfilter/x_tables.c:1934 find_check_entry.constprop.0+0xbc/0x9b0 net/ipv4/netfilter/ip_tables.c:526 translate_table+0xc98/0x1720 net/ipv4/netfilter/ip_tables.c:716 ipt_register_table+0x102/0x430 net/ipv4/netfilter/ip_tables.c:1742 iptable_security_table_init+0x40/0x60 net/ipv4/netfilter/iptable_security.c:46 xt_find_table_lock+0x2e4/0x520 net/netfilter/x_tables.c:1260 xt_request_find_table_lock+0x28/0xf0 net/netfilter/x_tables.c:1285 get_info+0x19c/0x7c0 net/ipv4/netfilter/ip_tables.c:963 do_ipt_get_ctl+0x169/0xaa0 net/ipv4/netfilter/ip_tables.c:1659 nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x18c/0x1e0 net/ipv4/ip_sockglue.c:1777 tcp_getsockopt+0xa1/0x100 net/ipv4/tcp.c:4810 do_sock_getsockopt+0x34d/0x440 net/socket.c:2421 __sys_getsockopt+0x12f/0x260 net/socket.c:2450 __do_sys_getsockopt net/socket.c:2457 [inline] __se_sys_getsockopt net/socket.c:2454 [inline] __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2454 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (pcpu_alloc_mutex){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x126f/0x1c90 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 pcpu_alloc_noprof+0xb4c/0x14c0 mm/percpu.c:1782 __percpu_counter_init_many+0x42/0x3b0 lib/percpu_counter.c:198 blkg_rwstat_init+0x2c/0xd0 block/blk-cgroup-rwstat.c:12 throtl_pd_alloc+0xf1/0xa50 block/blk-throttle.c:278 blkcg_activate_policy+0x7e6/0xf00 block/blk-cgroup.c:1632 blk_throtl_init+0x3bb/0x710 block/blk-throttle.c:1337 tg_set_conf.constprop.0+0x3ca/0x560 block/blk-throttle.c:1376 cgroup_file_write+0x1ef/0x790 kernel/cgroup/cgroup.c:4312 kernfs_fop_write_iter+0x3af/0x570 fs/kernfs/file.c:352 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x7d3/0x11d0 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/0xfa0 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: pcpu_alloc_mutex --> fs_reclaim --> &q->q_usage_counter(io)#17 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&q->q_usage_counter(io)#17); lock(fs_reclaim); lock(&q->q_usage_counter(io)#17); lock(pcpu_alloc_mutex); *** DEADLOCK *** 7 locks held by syz.2.1409/10332: #0: ffff888030f469b8 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x2a2/0x370 fs/file.c:1232 #1: ffff88807b45a420 (sb_writers#11){.+.+}-{0:0}, at: ksys_write+0x12a/0x250 fs/read_write.c:738 #2: ffff88807ba4cc88 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x28f/0x570 fs/kernfs/file.c:343 #3: ffff88807ec885a8 (kn->active#64){.+.+}-{0:0}, at: kernfs_get_active_of fs/kernfs/file.c:80 [inline] #3: ffff88807ec885a8 (kn->active#64){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x2ff/0x570 fs/kernfs/file.c:344 #4: ffff8880263f2020 (&q->rq_qos_mutex){+.+.}-{4:4}, at: blkg_conf_open_bdev+0x2a7/0x410 block/blk-cgroup.c:802 #5: ffff8880263f1e18 (&q->q_usage_counter(io)#17){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205 #6: ffff8880263f1e50 (&q->q_usage_counter(queue)){+.+.}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205 stack backtrace: CPU: 1 UID: 0 PID: 10332 Comm: syz.2.1409 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Call Trace: __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:2043 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x126f/0x1c90 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 pcpu_alloc_noprof+0xb4c/0x14c0 mm/percpu.c:1782 __percpu_counter_init_many+0x42/0x3b0 lib/percpu_counter.c:198 blkg_rwstat_init+0x2c/0xd0 block/blk-cgroup-rwstat.c:12 throtl_pd_alloc+0xf1/0xa50 block/blk-throttle.c:278 blkcg_activate_policy+0x7e6/0xf00 block/blk-cgroup.c:1632 blk_throtl_init+0x3bb/0x710 block/blk-throttle.c:1337 tg_set_conf.constprop.0+0x3ca/0x560 block/blk-throttle.c:1376 cgroup_file_write+0x1ef/0x790 kernel/cgroup/cgroup.c:4312 kernfs_fop_write_iter+0x3af/0x570 fs/kernfs/file.c:352 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x7d3/0x11d0 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/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f624338efc9 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:00007f62442bb038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f62435e6090 RCX: 00007f624338efc9 RDX: 000000000000006a RSI: 00002000000000c0 RDI: 0000000000000007 RBP: 00007f62442bb090 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007f62435e6128 R14: 00007f62435e6090 R15: 00007ffda7ccf918