linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [kernfs?] possible deadlock in kernfs_remove
@ 2025-08-04 18:08 syzbot
  2025-08-05  2:27 ` Hillf Danton
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: syzbot @ 2025-08-04 18:08 UTC (permalink / raw)
  To: gregkh, linux-kernel, netdev, syzkaller-bugs, tj

Hello,

syzbot found the following issue on:

HEAD commit:    759dfc7d04ba netlink: avoid infinite retry looping in netl..
git tree:       net
console+strace: https://syzkaller.appspot.com/x/log.txt?x=11332f82580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=ac0888b9ad46cd69
dashboard link: https://syzkaller.appspot.com/bug?extid=2d7d0fbb5fb979113ff3
compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1136d9bc580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1536d9bc580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/19f96268d2a7/disk-759dfc7d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/231a4e67d668/vmlinux-759dfc7d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/166f12d38b7a/bzImage-759dfc7d.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2d7d0fbb5fb979113ff3@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
6.16.0-syzkaller-06588-g759dfc7d04ba #0 Not tainted
------------------------------------------------------
syz-executor258/5840 is trying to acquire lock:
ffff88801b2ff188 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549

but task is already holding lock:
ffff8881433a4558 (&q->q_usage_counter(io)#49){++++}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&q->q_usage_counter(io)#49){++++}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       blk_alloc_queue+0x538/0x620 block/blk-core.c:461
       blk_mq_alloc_queue block/blk-mq.c:4400 [inline]
       __blk_mq_alloc_disk+0x15c/0x340 block/blk-mq.c:4447
       nbd_dev_add+0x46c/0xae0 drivers/block/nbd.c:1943
       nbd_init+0x168/0x1f0 drivers/block/nbd.c:2680
       do_one_initcall+0x233/0x820 init/main.c:1269
       do_initcall_level+0x104/0x190 init/main.c:1331
       do_initcalls+0x59/0xa0 init/main.c:1347
       kernel_init_freeable+0x334/0x4a0 init/main.c:1579
       kernel_init+0x1d/0x1d0 init/main.c:1469
       ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #1 (fs_reclaim){+.+.}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __fs_reclaim_acquire mm/page_alloc.c:4045 [inline]
       fs_reclaim_acquire+0x72/0x100 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]
       kmem_cache_alloc_lru_noprof+0x49/0x3d0 mm/slub.c:4216
       alloc_inode+0xb8/0x1b0 fs/inode.c:348
       iget_locked+0xf0/0x570 fs/inode.c:1438
       kernfs_get_inode+0x4f/0x780 fs/kernfs/inode.c:253
       kernfs_fill_super fs/kernfs/mount.c:307 [inline]
       kernfs_get_tree+0x5a9/0x920 fs/kernfs/mount.c:391
       sysfs_get_tree+0x46/0x110 fs/sysfs/mount.c:31
       vfs_get_tree+0x8f/0x2b0 fs/super.c:1815
       do_new_mount+0x2a2/0x9e0 fs/namespace.c:3805
       do_mount fs/namespace.c:4133 [inline]
       __do_sys_mount fs/namespace.c:4344 [inline]
       __se_sys_mount+0x317/0x410 fs/namespace.c:4321
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&root->kernfs_rwsem){++++}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3165 [inline]
       check_prevs_add kernel/locking/lockdep.c:3284 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1575
       kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549
       __kobject_del+0xe1/0x300 lib/kobject.c:604
       kobject_del+0x45/0x60 lib/kobject.c:627
       elv_unregister_queue block/elevator.c:502 [inline]
       elevator_change_done+0xf2/0x470 block/elevator.c:643
       elevator_set_none+0x42/0xb0 block/elevator.c:757
       blk_mq_elv_switch_none block/blk-mq.c:5022 [inline]
       __blk_mq_update_nr_hw_queues block/blk-mq.c:5063 [inline]
       blk_mq_update_nr_hw_queues+0x68f/0x1890 block/blk-mq.c:5113
       nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
       nbd_genl_connect+0x135b/0x18f0 drivers/block/nbd.c:2228
       genl_family_rcv_msg_doit+0x215/0x300 net/netlink/genetlink.c:1115
       genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
       genl_rcv_msg+0x60e/0x790 net/netlink/genetlink.c:1210
       netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2552
       genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
       netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
       netlink_unicast+0x82c/0x9e0 net/netlink/af_netlink.c:1346
       netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
       sock_sendmsg_nosec net/socket.c:714 [inline]
       __sock_sendmsg+0x21c/0x270 net/socket.c:729
       ____sys_sendmsg+0x505/0x830 net/socket.c:2614
       ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
       __sys_sendmsg net/socket.c:2700 [inline]
       __do_sys_sendmsg net/socket.c:2705 [inline]
       __se_sys_sendmsg net/socket.c:2703 [inline]
       __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 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:
  &root->kernfs_rwsem --> fs_reclaim --> &q->q_usage_counter(io)#49

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&q->q_usage_counter(io)#49);
                               lock(fs_reclaim);
                               lock(&q->q_usage_counter(io)#49);
  lock(&root->kernfs_rwsem);

 *** DEADLOCK ***

6 locks held by syz-executor258/5840:
 #0: ffffffff8f56e3f0 (cb_lock){++++}-{4:4}, at: genl_rcv+0x19/0x40 net/netlink/genetlink.c:1218
 #1: ffffffff8f56e208 (genl_mutex){+.+.}-{4:4}, at: genl_lock net/netlink/genetlink.c:35 [inline]
 #1: ffffffff8f56e208 (genl_mutex){+.+.}-{4:4}, at: genl_op_lock net/netlink/genetlink.c:60 [inline]
 #1: ffffffff8f56e208 (genl_mutex){+.+.}-{4:4}, at: genl_rcv_msg+0x10d/0x790 net/netlink/genetlink.c:1209
 #2: ffff888025120988 (&set->update_nr_hwq_lock){++++}-{4:4}, at: blk_mq_update_nr_hw_queues+0xa6/0x1890 block/blk-mq.c:5111
 #3: ffff8880251208d8 (&set->tag_list_lock){+.+.}-{4:4}, at: blk_mq_update_nr_hw_queues+0xb9/0x1890 block/blk-mq.c:5112
 #4: ffff8881433a4558 (&q->q_usage_counter(io)#49){++++}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
 #5: ffff8881433a4590 (&q->q_usage_counter(queue)){+.+.}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478

stack backtrace:
CPU: 0 UID: 0 PID: 5840 Comm: syz-executor258 Not tainted 6.16.0-syzkaller-06588-g759dfc7d04ba #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2043
 check_noncircular+0x134/0x160 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+0xb9b/0x2140 kernel/locking/lockdep.c:3908
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1575
 kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549
 __kobject_del+0xe1/0x300 lib/kobject.c:604
 kobject_del+0x45/0x60 lib/kobject.c:627
 elv_unregister_queue block/elevator.c:502 [inline]
 elevator_change_done+0xf2/0x470 block/elevator.c:643
 elevator_set_none+0x42/0xb0 block/elevator.c:757
 blk_mq_elv_switch_none block/blk-mq.c:5022 [inline]
 __blk_mq_update_nr_hw_queues block/blk-mq.c:5063 [inline]
 blk_mq_update_nr_hw_queues+0x68f/0x1890 block/blk-mq.c:5113
 nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
 nbd_genl_connect+0x135b/0x18f0 drivers/block/nbd.c:2228
 genl_family_rcv_msg_doit+0x215/0x300 net/netlink/genetlink.c:1115
 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
 genl_rcv_msg+0x60e/0x790 net/netlink/genetlink.c:1210
 netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2552
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
 netlink_unicast+0x82c/0x9e0 net/netlink/af_netlink.c:1346
 netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
 sock_sendmsg_nosec net/socket.c:714 [inline]
 __sock_sendmsg+0x21c/0x270 net/socket.c:729
 ____sys_sendmsg+0x505/0x830 net/socket.c:2614
 ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
 __sys_sendmsg net/socket.c:2700 [inline]
 __do_sys_sendmsg net/socket.c:2705 [inline]
 __se_sys_sendmsg net/socket.c:2703 [inline]
 __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f773fc67419
Code: 48 83 c4 28 c3 e8 e7 18 00 00 0f 1f 80 00 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc34589e38 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007ffc3458a008 RCX: 00007f773fc67419
RDX: 0000000020000000 RSI: 0000200000001ac0 RDI: 0000000000000003
RBP: 00007f773fcda610 R08: 0000000000000008 R09: 00007ffc3458a008
R10: 000000000000000c R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffc34589ff8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [kernfs?] possible deadlock in kernfs_remove
  2025-08-04 18:08 [syzbot] [kernfs?] possible deadlock in kernfs_remove syzbot
@ 2025-08-05  2:27 ` Hillf Danton
  2025-08-05  3:02   ` syzbot
  2025-08-07 11:41 ` Edward Adam Davis
  2025-08-07 14:15 ` Edward Adam Davis
  2 siblings, 1 reply; 7+ messages in thread
From: Hillf Danton @ 2025-08-05  2:27 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs

> Date: Mon, 04 Aug 2025 11:08:26 -0700	[thread overview]
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    759dfc7d04ba netlink: avoid infinite retry looping in netl..
> git tree:       net
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=11332f82580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=ac0888b9ad46cd69
> dashboard link: https://syzkaller.appspot.com/bug?extid=2d7d0fbb5fb979113ff3
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1136d9bc580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1536d9bc580000

#syz test upstream master

--- x/fs/kernfs/mount.c
+++ y/fs/kernfs/mount.c
@@ -303,9 +303,7 @@ static int kernfs_fill_super(struct supe
 	sb->s_shrink->seeks = 0;
 
 	/* get root inode, initialize and unlock it */
-	down_read(&kf_root->kernfs_rwsem);
 	inode = kernfs_get_inode(sb, info->root->kn);
-	up_read(&kf_root->kernfs_rwsem);
 	if (!inode) {
 		pr_debug("kernfs: could not get root inode\n");
 		return -ENOMEM;
--

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [kernfs?] possible deadlock in kernfs_remove
  2025-08-05  2:27 ` Hillf Danton
@ 2025-08-05  3:02   ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-08-05  3:02 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in kernfs_remove

======================================================
WARNING: possible circular locking dependency detected
6.16.0-syzkaller-g7e161a991ea7-dirty #0 Not tainted
------------------------------------------------------
syz.0.17/6594 is trying to acquire lock:
ffff88801b2ff988 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549

but task is already holding lock:
ffff88814371d8f8 (&q->q_usage_counter(io)#49){++++}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&q->q_usage_counter(io)#49){++++}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       blk_alloc_queue+0x538/0x620 block/blk-core.c:461
       blk_mq_alloc_queue block/blk-mq.c:4400 [inline]
       __blk_mq_alloc_disk+0x15c/0x340 block/blk-mq.c:4447
       nbd_dev_add+0x46c/0xae0 drivers/block/nbd.c:1943
       nbd_init+0x168/0x1f0 drivers/block/nbd.c:2680
       do_one_initcall+0x233/0x820 init/main.c:1269
       do_initcall_level+0x104/0x190 init/main.c:1331
       do_initcalls+0x59/0xa0 init/main.c:1347
       kernel_init_freeable+0x334/0x4b0 init/main.c:1579
       kernel_init+0x1d/0x1d0 init/main.c:1469
       ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #1 (fs_reclaim){+.+.}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __fs_reclaim_acquire mm/page_alloc.c:4234 [inline]
       fs_reclaim_acquire+0x72/0x100 mm/page_alloc.c:4248
       might_alloc include/linux/sched/mm.h:318 [inline]
       slab_pre_alloc_hook mm/slub.c:4131 [inline]
       slab_alloc_node mm/slub.c:4209 [inline]
       kmem_cache_alloc_lru_noprof+0x49/0x3d0 mm/slub.c:4248
       alloc_inode+0xb8/0x1b0 fs/inode.c:348
       iget_locked+0xf0/0x570 fs/inode.c:1438
       kernfs_get_inode+0x4f/0x780 fs/kernfs/inode.c:253
       kernfs_iop_lookup+0x1f6/0x320 fs/kernfs/dir.c:1236
       __lookup_slow+0x297/0x3d0 fs/namei.c:1808
       lookup_slow+0x53/0x70 fs/namei.c:1825
       walk_component fs/namei.c:2129 [inline]
       link_path_walk+0x935/0xea0 fs/namei.c:2497
       path_lookupat+0x97/0x430 fs/namei.c:2653
       filename_lookup+0x212/0x570 fs/namei.c:2683
       user_path_at+0x3a/0x60 fs/namei.c:3127
       do_mount fs/namespace.c:4130 [inline]
       __do_sys_mount fs/namespace.c:4344 [inline]
       __se_sys_mount+0x2d3/0x410 fs/namespace.c:4321
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&root->kernfs_rwsem){++++}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3165 [inline]
       check_prevs_add kernel/locking/lockdep.c:3284 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590
       kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549
       __kobject_del+0xe1/0x300 lib/kobject.c:604
       kobject_del+0x45/0x60 lib/kobject.c:627
       elv_unregister_queue block/elevator.c:502 [inline]
       elevator_change_done+0xf2/0x470 block/elevator.c:643
       elevator_set_none+0x42/0xb0 block/elevator.c:757
       blk_mq_elv_switch_none block/blk-mq.c:5022 [inline]
       __blk_mq_update_nr_hw_queues block/blk-mq.c:5063 [inline]
       blk_mq_update_nr_hw_queues+0x68f/0x1890 block/blk-mq.c:5113
       nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
       nbd_genl_connect+0x135b/0x18f0 drivers/block/nbd.c:2228
       genl_family_rcv_msg_doit+0x212/0x300 net/netlink/genetlink.c:1115
       genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
       genl_rcv_msg+0x60e/0x790 net/netlink/genetlink.c:1210
       netlink_rcv_skb+0x205/0x470 net/netlink/af_netlink.c:2552
       genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
       netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
       netlink_unicast+0x82f/0x9e0 net/netlink/af_netlink.c:1346
       netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
       sock_sendmsg_nosec net/socket.c:714 [inline]
       __sock_sendmsg+0x21c/0x270 net/socket.c:729
       ____sys_sendmsg+0x505/0x830 net/socket.c:2614
       ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
       __sys_sendmsg net/socket.c:2700 [inline]
       __do_sys_sendmsg net/socket.c:2705 [inline]
       __se_sys_sendmsg net/socket.c:2703 [inline]
       __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 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:
  &root->kernfs_rwsem --> fs_reclaim --> &q->q_usage_counter(io)#49

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&q->q_usage_counter(io)#49);
                               lock(fs_reclaim);
                               lock(&q->q_usage_counter(io)#49);
  lock(&root->kernfs_rwsem);

 *** DEADLOCK ***

6 locks held by syz.0.17/6594:
 #0: ffffffff8f5836f0 (cb_lock){++++}-{4:4}, at: genl_rcv+0x19/0x40 net/netlink/genetlink.c:1218
 #1: ffffffff8f583508 (genl_mutex){+.+.}-{4:4}, at: genl_lock net/netlink/genetlink.c:35 [inline]
 #1: ffffffff8f583508 (genl_mutex){+.+.}-{4:4}, at: genl_op_lock net/netlink/genetlink.c:60 [inline]
 #1: ffffffff8f583508 (genl_mutex){+.+.}-{4:4}, at: genl_rcv_msg+0x10d/0x790 net/netlink/genetlink.c:1209
 #2: ffff8881437d8988 (&set->update_nr_hwq_lock){++++}-{4:4}, at: blk_mq_update_nr_hw_queues+0xa6/0x1890 block/blk-mq.c:5111
 #3: ffff8881437d88d8 (&set->tag_list_lock){+.+.}-{4:4}, at: blk_mq_update_nr_hw_queues+0xb9/0x1890 block/blk-mq.c:5112
 #4: ffff88814371d8f8 (&q->q_usage_counter(io)#49){++++}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
 #5: ffff88814371d930 (&q->q_usage_counter(queue)){+.+.}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478

stack backtrace:
CPU: 1 UID: 0 PID: 6594 Comm: syz.0.17 Not tainted 6.16.0-syzkaller-g7e161a991ea7-dirty #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2043
 check_noncircular+0x134/0x160 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+0xb9b/0x2140 kernel/locking/lockdep.c:3908
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590
 kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549
 __kobject_del+0xe1/0x300 lib/kobject.c:604
 kobject_del+0x45/0x60 lib/kobject.c:627
 elv_unregister_queue block/elevator.c:502 [inline]
 elevator_change_done+0xf2/0x470 block/elevator.c:643
 elevator_set_none+0x42/0xb0 block/elevator.c:757
 blk_mq_elv_switch_none block/blk-mq.c:5022 [inline]
 __blk_mq_update_nr_hw_queues block/blk-mq.c:5063 [inline]
 blk_mq_update_nr_hw_queues+0x68f/0x1890 block/blk-mq.c:5113
 nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
 nbd_genl_connect+0x135b/0x18f0 drivers/block/nbd.c:2228
 genl_family_rcv_msg_doit+0x212/0x300 net/netlink/genetlink.c:1115
 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
 genl_rcv_msg+0x60e/0x790 net/netlink/genetlink.c:1210
 netlink_rcv_skb+0x205/0x470 net/netlink/af_netlink.c:2552
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
 netlink_unicast+0x82f/0x9e0 net/netlink/af_netlink.c:1346
 netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
 sock_sendmsg_nosec net/socket.c:714 [inline]
 __sock_sendmsg+0x21c/0x270 net/socket.c:729
 ____sys_sendmsg+0x505/0x830 net/socket.c:2614
 ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
 __sys_sendmsg net/socket.c:2700 [inline]
 __do_sys_sendmsg net/socket.c:2705 [inline]
 __se_sys_sendmsg net/socket.c:2703 [inline]
 __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff1bbb8eb69
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:00007ff1bc9f8038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007ff1bbdb5fa0 RCX: 00007ff1bbb8eb69
RDX: 0000000020000000 RSI: 0000200000001ac0 RDI: 0000000000000004
RBP: 00007ff1bbc11df1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007ff1bbdb5fa0 R15: 00007fffc10118f8
 </TASK>
nbd0: detected capacity change from 0 to 127


Tested on:

commit:         7e161a99 Merge tag 'i2c-for-6.17-rc1-part2' of git://g..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17fe06a2580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=3b1651a67dd046ce
dashboard link: https://syzkaller.appspot.com/bug?extid=2d7d0fbb5fb979113ff3
compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch:          https://syzkaller.appspot.com/x/patch.diff?x=122942f0580000


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [kernfs?] possible deadlock in kernfs_remove
  2025-08-04 18:08 [syzbot] [kernfs?] possible deadlock in kernfs_remove syzbot
  2025-08-05  2:27 ` Hillf Danton
@ 2025-08-07 11:41 ` Edward Adam Davis
  2025-08-07 14:02   ` syzbot
  2025-08-07 14:15 ` Edward Adam Davis
  2 siblings, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2025-08-07 11:41 UTC (permalink / raw)
  To: syzbot+2d7d0fbb5fb979113ff3; +Cc: linux-kernel, syzkaller-bugs

#syz test

diff --git a/block/blk-core.c b/block/blk-core.c
index fdac48aec5ef..8fff08c4c360 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -395,7 +395,7 @@ struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id)
 	struct request_queue *q;
 	int error;
 
-	q = kmem_cache_alloc_node(blk_requestq_cachep, GFP_KERNEL | __GFP_ZERO,
+	q = kmem_cache_alloc_node(blk_requestq_cachep, GFP_NOFS | __GFP_ZERO,
 				  node_id);
 	if (!q)
 		return ERR_PTR(-ENOMEM);


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [syzbot] [kernfs?] possible deadlock in kernfs_remove
  2025-08-07 11:41 ` Edward Adam Davis
@ 2025-08-07 14:02   ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-08-07 14:02 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in kernfs_remove

======================================================
WARNING: possible circular locking dependency detected
6.16.0-syzkaller-06619-gd942fe13f72b-dirty #0 Not tainted
------------------------------------------------------
syz.0.17/6667 is trying to acquire lock:
ffff88801b2ff188 (&root->kernfs_rwsem){++++}-{4:4}, at: kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549

but task is already holding lock:
ffff888025244558 (&q->q_usage_counter(io)#49){++++}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&q->q_usage_counter(io)#49){++++}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       blk_alloc_queue+0x538/0x620 block/blk-core.c:461
       blk_mq_alloc_queue block/blk-mq.c:4400 [inline]
       __blk_mq_alloc_disk+0x15c/0x340 block/blk-mq.c:4447
       nbd_dev_add+0x46c/0xae0 drivers/block/nbd.c:1943
       nbd_init+0x168/0x1f0 drivers/block/nbd.c:2680
       do_one_initcall+0x233/0x820 init/main.c:1269
       do_initcall_level+0x104/0x190 init/main.c:1331
       do_initcalls+0x59/0xa0 init/main.c:1347
       kernel_init_freeable+0x334/0x4a0 init/main.c:1579
       kernel_init+0x1d/0x1d0 init/main.c:1469
       ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #1 (fs_reclaim){+.+.}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __fs_reclaim_acquire mm/page_alloc.c:4045 [inline]
       fs_reclaim_acquire+0x72/0x100 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]
       kmem_cache_alloc_lru_noprof+0x49/0x3d0 mm/slub.c:4216
       alloc_inode+0xb8/0x1b0 fs/inode.c:348
       iget_locked+0xf0/0x570 fs/inode.c:1438
       kernfs_get_inode+0x4f/0x780 fs/kernfs/inode.c:253
       kernfs_fill_super fs/kernfs/mount.c:307 [inline]
       kernfs_get_tree+0x5a9/0x920 fs/kernfs/mount.c:391
       sysfs_get_tree+0x46/0x110 fs/sysfs/mount.c:31
       vfs_get_tree+0x8f/0x2b0 fs/super.c:1815
       do_new_mount+0x2a2/0x9e0 fs/namespace.c:3805
       do_mount fs/namespace.c:4133 [inline]
       __do_sys_mount fs/namespace.c:4344 [inline]
       __se_sys_mount+0x317/0x410 fs/namespace.c:4321
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&root->kernfs_rwsem){++++}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3165 [inline]
       check_prevs_add kernel/locking/lockdep.c:3284 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1575
       kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549
       __kobject_del+0xe1/0x300 lib/kobject.c:604
       kobject_del+0x45/0x60 lib/kobject.c:627
       elv_unregister_queue block/elevator.c:502 [inline]
       elevator_change_done+0xf2/0x470 block/elevator.c:643
       elevator_set_none+0x42/0xb0 block/elevator.c:757
       blk_mq_elv_switch_none block/blk-mq.c:5022 [inline]
       __blk_mq_update_nr_hw_queues block/blk-mq.c:5063 [inline]
       blk_mq_update_nr_hw_queues+0x68f/0x1890 block/blk-mq.c:5113
       nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
       nbd_genl_connect+0x135b/0x18f0 drivers/block/nbd.c:2228
       genl_family_rcv_msg_doit+0x215/0x300 net/netlink/genetlink.c:1115
       genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
       genl_rcv_msg+0x60e/0x790 net/netlink/genetlink.c:1210
       netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2552
       genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
       netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
       netlink_unicast+0x82c/0x9e0 net/netlink/af_netlink.c:1346
       netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
       sock_sendmsg_nosec net/socket.c:714 [inline]
       __sock_sendmsg+0x21c/0x270 net/socket.c:729
       ____sys_sendmsg+0x505/0x830 net/socket.c:2614
       ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
       __sys_sendmsg net/socket.c:2700 [inline]
       __do_sys_sendmsg net/socket.c:2705 [inline]
       __se_sys_sendmsg net/socket.c:2703 [inline]
       __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0x3b0 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:
  &root->kernfs_rwsem --> fs_reclaim --> &q->q_usage_counter(io)#49

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&q->q_usage_counter(io)#49);
                               lock(fs_reclaim);
                               lock(&q->q_usage_counter(io)#49);
  lock(&root->kernfs_rwsem);

 *** DEADLOCK ***

6 locks held by syz.0.17/6667:
 #0: ffffffff8f56e570 (cb_lock){++++}-{4:4}, at: genl_rcv+0x19/0x40 net/netlink/genetlink.c:1218
 #1: ffffffff8f56e388 (genl_mutex){+.+.}-{4:4}, at: genl_lock net/netlink/genetlink.c:35 [inline]
 #1: ffffffff8f56e388 (genl_mutex){+.+.}-{4:4}, at: genl_op_lock net/netlink/genetlink.c:60 [inline]
 #1: ffffffff8f56e388 (genl_mutex){+.+.}-{4:4}, at: genl_rcv_msg+0x10d/0x790 net/netlink/genetlink.c:1209
 #2: ffff888025355188 (&set->update_nr_hwq_lock){++++}-{4:4}, at: blk_mq_update_nr_hw_queues+0xa6/0x1890 block/blk-mq.c:5111
 #3: ffff8880253550d8 (&set->tag_list_lock){+.+.}-{4:4}, at: blk_mq_update_nr_hw_queues+0xb9/0x1890 block/blk-mq.c:5112
 #4: ffff888025244558 (&q->q_usage_counter(io)#49){++++}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
 #5: ffff888025244590 (&q->q_usage_counter(queue)){+.+.}-{0:0}, at: nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478

stack backtrace:
CPU: 0 UID: 0 PID: 6667 Comm: syz.0.17 Not tainted 6.16.0-syzkaller-06619-gd942fe13f72b-dirty #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2043
 check_noncircular+0x134/0x160 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+0xb9b/0x2140 kernel/locking/lockdep.c:3908
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1575
 kernfs_remove+0x30/0x60 fs/kernfs/dir.c:1549
 __kobject_del+0xe1/0x300 lib/kobject.c:604
 kobject_del+0x45/0x60 lib/kobject.c:627
 elv_unregister_queue block/elevator.c:502 [inline]
 elevator_change_done+0xf2/0x470 block/elevator.c:643
 elevator_set_none+0x42/0xb0 block/elevator.c:757
 blk_mq_elv_switch_none block/blk-mq.c:5022 [inline]
 __blk_mq_update_nr_hw_queues block/blk-mq.c:5063 [inline]
 blk_mq_update_nr_hw_queues+0x68f/0x1890 block/blk-mq.c:5113
 nbd_start_device+0x17f/0xb10 drivers/block/nbd.c:1478
 nbd_genl_connect+0x135b/0x18f0 drivers/block/nbd.c:2228
 genl_family_rcv_msg_doit+0x215/0x300 net/netlink/genetlink.c:1115
 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
 genl_rcv_msg+0x60e/0x790 net/netlink/genetlink.c:1210
 netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2552
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
 netlink_unicast+0x82c/0x9e0 net/netlink/af_netlink.c:1346
 netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
 sock_sendmsg_nosec net/socket.c:714 [inline]
 __sock_sendmsg+0x21c/0x270 net/socket.c:729
 ____sys_sendmsg+0x505/0x830 net/socket.c:2614
 ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
 __sys_sendmsg net/socket.c:2700 [inline]
 __do_sys_sendmsg net/socket.c:2705 [inline]
 __se_sys_sendmsg net/socket.c:2703 [inline]
 __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc5bbd8eb69
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:00007fc5bcbae038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fc5bbfb5fa0 RCX: 00007fc5bbd8eb69
RDX: 0000000020000000 RSI: 0000200000001ac0 RDI: 0000000000000004
RBP: 00007fc5bbe11df1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fc5bbfb5fa0 R15: 00007ffebf29b2c8
 </TASK>
nbd0: detected capacity change from 0 to 127


Tested on:

commit:         d942fe13 net: ti: icssg-prueth: Fix skb handling for X..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=1585e2f0580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=484535f4eb25fe17
dashboard link: https://syzkaller.appspot.com/bug?extid=2d7d0fbb5fb979113ff3
compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch:          https://syzkaller.appspot.com/x/patch.diff?x=123ecea2580000


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] [kernfs?] possible deadlock in kernfs_remove
  2025-08-04 18:08 [syzbot] [kernfs?] possible deadlock in kernfs_remove syzbot
  2025-08-05  2:27 ` Hillf Danton
  2025-08-07 11:41 ` Edward Adam Davis
@ 2025-08-07 14:15 ` Edward Adam Davis
  2025-08-07 14:45   ` syzbot
  2 siblings, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2025-08-07 14:15 UTC (permalink / raw)
  To: syzbot+2d7d0fbb5fb979113ff3; +Cc: linux-kernel, syzkaller-bugs

#syz test

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9692fa4c3ef2..0d69572fe1ce 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4443,8 +4443,11 @@ struct gendisk *__blk_mq_alloc_disk(struct blk_mq_tag_set *set,
 {
 	struct request_queue *q;
 	struct gendisk *disk;
+	unsigned int nofs_flag;
 
+	nofs_flag = memalloc_nofs_save();
 	q = blk_mq_alloc_queue(set, lim, queuedata);
+	memalloc_nofs_restore(nofs_flag);
 	if (IS_ERR(q))
 		return ERR_CAST(q);
 


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [syzbot] [kernfs?] possible deadlock in kernfs_remove
  2025-08-07 14:15 ` Edward Adam Davis
@ 2025-08-07 14:45   ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-08-07 14:45 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
INFO: task hung in nbd_queue_rq

INFO: task kworker/0:1H:56 blocked for more than 143 seconds.
      Not tainted 6.16.0-syzkaller-06619-gd942fe13f72b-dirty #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:kworker/0:1H    state:D stack:26152 pid:56    tgid:56    ppid:2      task_flags:0x4208060 flags:0x00004000
Workqueue: kblockd blk_mq_requeue_work
Call Trace:
 <TASK>
 context_switch kernel/sched/core.c:5351 [inline]
 __schedule+0x1737/0x4d30 kernel/sched/core.c:6954
 __schedule_loop kernel/sched/core.c:7036 [inline]
 schedule+0x165/0x360 kernel/sched/core.c:7051
 schedule_timeout+0x12b/0x270 kernel/time/sleep_timeout.c:99
 wait_for_reconnect drivers/block/nbd.c:1104 [inline]
 nbd_handle_cmd drivers/block/nbd.c:1146 [inline]
 nbd_queue_rq+0x662/0xf10 drivers/block/nbd.c:1204
 blk_mq_dispatch_rq_list+0x4bd/0x1900 block/blk-mq.c:2120
 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline]
 blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline]
 __blk_mq_sched_dispatch_requests+0xda4/0x1570 block/blk-mq-sched.c:307
 blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329
 blk_mq_run_hw_queue+0x348/0x4f0 block/blk-mq.c:2358
 blk_mq_run_hw_queues+0x33e/0x430 block/blk-mq.c:2407
 blk_mq_requeue_work+0x717/0x760 block/blk-mq.c:1574
 process_one_work kernel/workqueue.c:3238 [inline]
 process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
 kthread+0x70e/0x8a0 kernel/kthread.c:464
 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
INFO: task udevd:6344 blocked for more than 143 seconds.
      Not tainted 6.16.0-syzkaller-06619-gd942fe13f72b-dirty #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:udevd           state:D
 stack:22232 pid:6344  tgid:6344  ppid:5208   task_flags:0x400140 flags:0x00004002
Call Trace:
 <TASK>
 context_switch kernel/sched/core.c:5351 [inline]
 __schedule+0x1737/0x4d30 kernel/sched/core.c:6954
 __schedule_loop kernel/sched/core.c:7036 [inline]
 schedule+0x165/0x360 kernel/sched/core.c:7051
 schedule_timeout+0x12b/0x270 kernel/time/sleep_timeout.c:99
 wait_for_reconnect drivers/block/nbd.c:1104 [inline]
 nbd_handle_cmd drivers/block/nbd.c:1146 [inline]
 nbd_queue_rq+0x662/0xf10 drivers/block/nbd.c:1204
 blk_mq_dispatch_rq_list+0x4bd/0x1900 block/blk-mq.c:2120
 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline]
 blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline]
 __blk_mq_sched_dispatch_requests+0xda4/0x1570 block/blk-mq-sched.c:307
 blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329
 blk_mq_run_hw_queue+0x348/0x4f0 block/blk-mq.c:2358
 blk_mq_dispatch_list+0xd0c/0xe00 include/linux/spinlock.h:-1
 blk_mq_flush_plug_list+0x469/0x550 block/blk-mq.c:2967
 __blk_flush_plug+0x3d3/0x4b0 block/blk-core.c:1220
 blk_finish_plug block/blk-core.c:1247 [inline]
 __submit_bio+0x2d3/0x5a0 block/blk-core.c:649
 __submit_bio_noacct_mq block/blk-core.c:722 [inline]
 submit_bio_noacct_nocheck+0x4ab/0xb50 block/blk-core.c:751
 submit_bh fs/buffer.c:2829 [inline]
 block_read_full_folio+0x599/0x830 fs/buffer.c:2447
 filemap_read_folio+0x114/0x380 mm/filemap.c:2412
 do_read_cache_folio+0x350/0x590 mm/filemap.c:3923
 read_mapping_folio include/linux/pagemap.h:999 [inline]
 read_part_sector+0xb6/0x2b0 block/partitions/core.c:722
 adfspart_check_ICS+0xa4/0xa50 block/partitions/acorn.c:360
 check_partition block/partitions/core.c:141 [inline]
 blk_add_partitions block/partitions/core.c:589 [inline]
 bdev_disk_changed+0x75f/0x14b0 block/partitions/core.c:693
 blkdev_get_whole+0x380/0x510 block/bdev.c:748
 bdev_open+0x31e/0xd30 block/bdev.c:957
 blkdev_open+0x3a8/0x510 block/fops.c:691
 do_dentry_open+0xdf3/0x1970 fs/open.c:965
 vfs_open+0x3b/0x340 fs/open.c:1095
 do_open fs/namei.c:3887 [inline]
 path_openat+0x2ee5/0x3830 fs/namei.c:4046
 do_filp_open+0x1fa/0x410 fs/namei.c:4073
 do_sys_openat2+0x121/0x1c0 fs/open.c:1435
 do_sys_open fs/open.c:1450 [inline]
 __do_sys_openat fs/open.c:1466 [inline]
 __se_sys_openat fs/open.c:1461 [inline]
 __x64_sys_openat+0x138/0x170 fs/open.c:1461
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f986eca7407
RSP: 002b:00007ffdca12bcc0 EFLAGS: 00000202 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f986f34e880 RCX: 00007f986eca7407
RDX: 00000000000a0800 RSI: 000056006750eac0 RDI: ffffffffffffff9c
RBP: 00005600674fd910 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000056006751af30
R13: 0000560067515430 R14: 0000000000000000 R15: 000056006751af30
 </TASK>

Showing all locks held in the system:
1 lock held by khungtaskd/31:
 #0: ffffffff8e13c4e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
 #0: ffffffff8e13c4e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline]
 #0: ffffffff8e13c4e0 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x2e/0x180 kernel/locking/lockdep.c:6775
4 locks held by kworker/0:1H/56:
 #0: ffff8881412b2d48 ((wq_completion)kblockd){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3213 [inline]
 #0: ffff8881412b2d48 ((wq_completion)kblockd){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x17b0 kernel/workqueue.c:3321
 #1: ffffc9000131fbc0 ((work_completion)(&(&q->requeue_work)->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3214 [inline]
 #1: ffffc9000131fbc0 ((work_completion)(&(&q->requeue_work)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x17b0 kernel/workqueue.c:3321
 #2: ffff888025119490 (set->srcu){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:161 [inline]
 #2: ffff888025119490 (set->srcu){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:253 [inline]
 #2: ffff888025119490 (set->srcu){.+.+}-{0:0}, at: blk_mq_run_hw_queue+0x31f/0x4f0 block/blk-mq.c:2358
 #3: ffff88802549e178 (&cmd->lock){+.+.}-{4:4}, at: nbd_queue_rq+0xc8/0xf10 drivers/block/nbd.c:1196
2 locks held by getty/5600:
 #0: ffff88814d0e90a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x25/0x70 drivers/tty/tty_ldisc.c:243
 #1: ffffc900036be2f0 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x43e/0x1400 drivers/tty/n_tty.c:2222
3 locks held by udevd/6344:
 #0: ffff8880253b6358 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xe0/0xd30 block/bdev.c:945
 #1: ffff888025119490 (set->srcu){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:161 [inline]
 #1: ffff888025119490 (set->srcu){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:253 [inline]
 #1: ffff888025119490 (set->srcu){.+.+}-{0:0}, at: blk_mq_run_hw_queue+0x31f/0x4f0 block/blk-mq.c:2358
 #2: ffff88802549e338 (&cmd->lock){+.+.}-{4:4}, at: nbd_queue_rq+0xc8/0xf10 drivers/block/nbd.c:1196
7 locks held by syz.0.5658/18624:
 #0: ffff8880b8739f58 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x2a/0x140 kernel/sched/core.c:636
 #1: ffff8880b8724008 (per_cpu_ptr(&psi_seq, cpu)){-.-.}-{0:0}, at: psi_task_switch+0x53/0x880 kernel/sched/psi.c:937
 #2: ffffffff8e8caf58 (pool_lock#2){-.-.}-{2:2}, at: class_raw_spinlock_constructor include/linux/spinlock.h:535 [inline]
 #2: ffffffff8e8caf58 (pool_lock#2){-.-.}-{2:2}, at: pcpu_alloc+0x25b/0x310 lib/debugobjects.c:273
 #3: ffff8880249d88a0 (&____s->seqcount#6){....}-{0:0}, at: exit_notify kernel/exit.c:782 [inline]
 #3: ffff8880249d88a0 (&____s->seqcount#6){....}-{0:0}, at: do_exit+0x15f2/0x22e0 kernel/exit.c:976
 #4: ffff8880770e0538 (&pid->wait_pidfd){....}-{3:3}, at: __wake_up_common_lock+0x2f/0x1f0 kernel/sched/wait.c:106
 #5: ffffffff8e1306d8 (console_owner_lock){....}-{2:2}, at: console_lock_spinning_disable_and_check+0x76/0x170 kernel/printk/printk.c:1963
 #6: ffffffff99d9a4b8 (&port_lock_key){-.-.}-{3:3}, at: uart_port_lock_irqsave include/linux/serial_core.h:717 [inline]
 #6: ffffffff99d9a4b8 (&port_lock_key){-.-.}-{3:3}, at: serial8250_console_write+0x17e/0x1ba0 drivers/tty/serial/8250/8250_port.c:3355

=============================================

NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 31 Comm: khungtaskd Not tainted 6.16.0-syzkaller-06619-gd942fe13f72b-dirty #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 nmi_cpu_backtrace+0x39e/0x3d0 lib/nmi_backtrace.c:113
 nmi_trigger_cpumask_backtrace+0x17a/0x300 lib/nmi_backtrace.c:62
 trigger_all_cpu_backtrace include/linux/nmi.h:160 [inline]
 check_hung_uninterruptible_tasks kernel/hung_task.c:307 [inline]
 watchdog+0xf93/0xfe0 kernel/hung_task.c:470
 kthread+0x70e/0x8a0 kernel/kthread.c:464
 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 18632 Comm: syz.0.5662 Not tainted 6.16.0-syzkaller-06619-gd942fe13f72b-dirty #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
RIP: 0010:io_serial_out+0x7c/0xc0 drivers/tty/serial/8250/8250_port.c:407
Code: 92 73 fc 44 89 f9 d3 e5 49 83 c6 40 4c 89 f0 48 c1 e8 03 42 80 3c 20 00 74 08 4c 89 f7 e8 1c b5 d6 fc 41 03 2e 89 d8 89 ea ee <5b> 41 5c 41 5e 41 5f 5d e9 87 8e 26 06 cc 44 89 f9 80 e1 07 38 c1
RSP: 0018:ffffc9000df76bd0 EFLAGS: 00000002
RAX: 0000000000000033 RBX: 0000000000000033 RCX: 0000000000000000
RDX: 00000000000003f8 RSI: 0000000000000000 RDI: 0000000000000020
RBP: 00000000000003f8 R08: ffff888024808237 R09: 1ffff11004901046
R10: dffffc0000000000 R11: ffffffff854c1e10 R12: dffffc0000000000
R13: ffffffff99a958ea R14: ffffffff99d9a4e0 R15: 0000000000000000
FS:  00007f5db15d86c0(0000) GS:ffff888125d80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000001ac0 CR3: 00000000774f4000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 serial_port_out include/linux/serial_core.h:798 [inline]
 serial8250_console_putchar drivers/tty/serial/8250/8250_port.c:3246 [inline]
 serial8250_console_fifo_write drivers/tty/serial/8250/8250_port.c:-1 [inline]
 serial8250_console_write+0x1410/0x1ba0 drivers/tty/serial/8250/8250_port.c:3396
 console_emit_next_record kernel/printk/printk.c:3138 [inline]
 console_flush_all+0x725/0xc40 kernel/printk/printk.c:3226
 __console_flush_and_unlock kernel/printk/printk.c:3285 [inline]
 console_unlock+0xc4/0x270 kernel/printk/printk.c:3325
 vprintk_emit+0x5b7/0x7a0 kernel/printk/printk.c:2450
 _printk+0xcf/0x120 kernel/printk/printk.c:2475
 nbd_genl_connect+0x9b0/0x18f0 drivers/block/nbd.c:2127
 genl_family_rcv_msg_doit+0x215/0x300 net/netlink/genetlink.c:1115
 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
 genl_rcv_msg+0x60e/0x790 net/netlink/genetlink.c:1210
 netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2552
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
 netlink_unicast+0x82c/0x9e0 net/netlink/af_netlink.c:1346
 netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
 sock_sendmsg_nosec net/socket.c:714 [inline]
 __sock_sendmsg+0x21c/0x270 net/socket.c:729
 ____sys_sendmsg+0x505/0x830 net/socket.c:2614
 ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
 __sys_sendmsg net/socket.c:2700 [inline]
 __do_sys_sendmsg net/socket.c:2705 [inline]
 __se_sys_sendmsg net/socket.c:2703 [inline]
 __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5db078eb69
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:00007f5db15d8038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f5db09b5fa0 RCX: 00007f5db078eb69
RDX: 0000000020000000 RSI: 0000200000001ac0 RDI: 0000000000000004
RBP: 00007f5db0811df1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f5db09b5fa0 R15: 00007ffc2c157058
 </TASK>


Tested on:

commit:         d942fe13 net: ti: icssg-prueth: Fix skb handling for X..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=16382058580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=484535f4eb25fe17
dashboard link: https://syzkaller.appspot.com/bug?extid=2d7d0fbb5fb979113ff3
compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1002a5bc580000


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-07 14:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-04 18:08 [syzbot] [kernfs?] possible deadlock in kernfs_remove syzbot
2025-08-05  2:27 ` Hillf Danton
2025-08-05  3:02   ` syzbot
2025-08-07 11:41 ` Edward Adam Davis
2025-08-07 14:02   ` syzbot
2025-08-07 14:15 ` Edward Adam Davis
2025-08-07 14:45   ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).