* [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr
@ 2025-04-01 8:32 syzbot
2025-04-10 20:33 ` syzbot
2025-07-20 13:33 ` syzbot
0 siblings, 2 replies; 7+ messages in thread
From: syzbot @ 2025-04-01 8:32 UTC (permalink / raw)
To: gregkh, linux-kernel, syzkaller-bugs, tj
Hello,
syzbot found the following issue on:
HEAD commit: acb4f33713b9 Merge tag 'm68knommu-for-v6.15' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=141a064c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=dd14976ddc05593f
dashboard link: https://syzkaller.appspot.com/bug?extid=4bb2305559463e8f6a2a
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/0a5c59c65f84/disk-acb4f337.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3da19a126568/vmlinux-acb4f337.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b6b972905364/bzImage-acb4f337.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4bb2305559463e8f6a2a@syzkaller.appspotmail.com
======================================================
WARNING: possible circular locking dependency detected
6.14.0-syzkaller-07422-gacb4f33713b9 #0 Not tainted
------------------------------------------------------
syz.2.1091/9434 is trying to acquire lock:
ffff88801bef71e0 (&root->kernfs_iattr_rwsem){++++}-{4:4}, at: kernfs_iop_getattr+0xd3/0x490 fs/kernfs/inode.c:191
but task is already holding lock:
ffff888025395868 (&q->q_usage_counter(io)#19){++++}-{0:0}, at: blk_mq_freeze_queue include/linux/blk-mq.h:928 [inline]
ffff888025395868 (&q->q_usage_counter(io)#19){++++}-{0:0}, at: loop_change_fd drivers/block/loop.c:643 [inline]
ffff888025395868 (&q->q_usage_counter(io)#19){++++}-{0:0}, at: lo_ioctl+0x203b/0x2850 drivers/block/loop.c:1569
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (&q->q_usage_counter(io)#19){++++}-{0:0}:
lock_acquire+0x116/0x2f0 kernel/locking/lockdep.c:5866
blk_alloc_queue+0x542/0x620 block/blk-core.c:461
blk_mq_alloc_queue block/blk-mq.c:4349 [inline]
__blk_mq_alloc_disk+0x162/0x380 block/blk-mq.c:4396
loop_add+0x445/0xaf0 drivers/block/loop.c:2067
loop_init+0x168/0x220 drivers/block/loop.c:2302
do_one_initcall+0x24a/0x940 init/main.c:1257
do_initcall_level+0x157/0x210 init/main.c:1319
do_initcalls+0x71/0xd0 init/main.c:1335
kernel_init_freeable+0x432/0x5d0 init/main.c:1567
kernel_init+0x1d/0x2b0 init/main.c:1457
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #2 (fs_reclaim){+.+.}-{0:0}:
lock_acquire+0x116/0x2f0 kernel/locking/lockdep.c:5866
__fs_reclaim_acquire mm/page_alloc.c:3853 [inline]
fs_reclaim_acquire+0x88/0x130 mm/page_alloc.c:3867
might_alloc include/linux/sched/mm.h:318 [inline]
slab_pre_alloc_hook mm/slub.c:4089 [inline]
slab_alloc_node mm/slub.c:4167 [inline]
kmem_cache_alloc_noprof+0x49/0x390 mm/slub.c:4194
__kernfs_iattrs+0x94/0x280 fs/kernfs/inode.c:37
kernfs_iattrs fs/kernfs/inode.c:60 [inline]
__kernfs_setattr fs/kernfs/inode.c:73 [inline]
kernfs_iop_setattr+0x125/0x410 fs/kernfs/inode.c:127
notify_change+0xbca/0xe90 fs/attr.c:552
do_truncate+0x222/0x310 fs/open.c:65
handle_truncate fs/namei.c:3466 [inline]
do_open fs/namei.c:3849 [inline]
path_openat+0x2e4f/0x35d0 fs/namei.c:4004
do_filp_open+0x284/0x4e0 fs/namei.c:4031
do_sys_openat2+0x12b/0x1d0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x249/0x2a0 fs/open.c:1455
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (iattr_mutex){+.+.}-{4:4}:
lock_acquire+0x116/0x2f0 kernel/locking/lockdep.c:5866
__mutex_lock_common kernel/locking/mutex.c:587 [inline]
__mutex_lock+0x1a5/0x10c0 kernel/locking/mutex.c:732
__kernfs_iattrs+0x2b/0x280 fs/kernfs/inode.c:32
kernfs_iattrs fs/kernfs/inode.c:60 [inline]
__kernfs_setattr fs/kernfs/inode.c:73 [inline]
kernfs_iop_setattr+0x125/0x410 fs/kernfs/inode.c:127
notify_change+0xbca/0xe90 fs/attr.c:552
do_truncate+0x222/0x310 fs/open.c:65
handle_truncate fs/namei.c:3466 [inline]
do_open fs/namei.c:3849 [inline]
path_openat+0x2e4f/0x35d0 fs/namei.c:4004
do_filp_open+0x284/0x4e0 fs/namei.c:4031
do_sys_openat2+0x12b/0x1d0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x249/0x2a0 fs/open.c:1455
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&root->kernfs_iattr_rwsem){++++}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3166 [inline]
check_prevs_add kernel/locking/lockdep.c:3285 [inline]
validate_chain+0xa69/0x24e0 kernel/locking/lockdep.c:3909
__lock_acquire+0xad5/0xd80 kernel/locking/lockdep.c:5235
lock_acquire+0x116/0x2f0 kernel/locking/lockdep.c:5866
down_read+0xb3/0xa50 kernel/locking/rwsem.c:1524
kernfs_iop_getattr+0xd3/0x490 fs/kernfs/inode.c:191
loop_query_min_dio_size drivers/block/loop.c:529 [inline]
loop_assign_backing_file+0x276/0x500 drivers/block/loop.c:582
loop_change_fd drivers/block/loop.c:645 [inline]
lo_ioctl+0x20a9/0x2850 drivers/block/loop.c:1569
blkdev_ioctl+0x5df/0x710 block/ioctl.c:698
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x230 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_iattr_rwsem --> fs_reclaim --> &q->q_usage_counter(io)#19
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&q->q_usage_counter(io)#19);
lock(fs_reclaim);
lock(&q->q_usage_counter(io)#19);
rlock(&root->kernfs_iattr_rwsem);
*** DEADLOCK ***
3 locks held by syz.2.1091/9434:
#0: ffff8880253ac368 (&lo->lo_mutex){+.+.}-{4:4}, at: loop_global_lock_killable drivers/block/loop.c:118 [inline]
#0: ffff8880253ac368 (&lo->lo_mutex){+.+.}-{4:4}, at: loop_change_fd drivers/block/loop.c:610 [inline]
#0: ffff8880253ac368 (&lo->lo_mutex){+.+.}-{4:4}, at: lo_ioctl+0x135f/0x2850 drivers/block/loop.c:1569
#1: ffff888025395868 (&q->q_usage_counter(io)#19){++++}-{0:0}, at: blk_mq_freeze_queue include/linux/blk-mq.h:928 [inline]
#1: ffff888025395868 (&q->q_usage_counter(io)#19){++++}-{0:0}, at: loop_change_fd drivers/block/loop.c:643 [inline]
#1: ffff888025395868 (&q->q_usage_counter(io)#19){++++}-{0:0}, at: lo_ioctl+0x203b/0x2850 drivers/block/loop.c:1569
#2: ffff8880253958a0 (&q->q_usage_counter(queue)#20){+.+.}-{0:0}, at: blk_mq_freeze_queue include/linux/blk-mq.h:928 [inline]
#2: ffff8880253958a0 (&q->q_usage_counter(queue)#20){+.+.}-{0:0}, at: loop_change_fd drivers/block/loop.c:643 [inline]
#2: ffff8880253958a0 (&q->q_usage_counter(queue)#20){+.+.}-{0:0}, at: lo_ioctl+0x203b/0x2850 drivers/block/loop.c:1569
stack backtrace:
CPU: 0 UID: 0 PID: 9434 Comm: syz.2.1091 Not tainted 6.14.0-syzkaller-07422-gacb4f33713b9 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
print_circular_bug+0x2e1/0x300 kernel/locking/lockdep.c:2079
check_noncircular+0x142/0x160 kernel/locking/lockdep.c:2211
check_prev_add kernel/locking/lockdep.c:3166 [inline]
check_prevs_add kernel/locking/lockdep.c:3285 [inline]
validate_chain+0xa69/0x24e0 kernel/locking/lockdep.c:3909
__lock_acquire+0xad5/0xd80 kernel/locking/lockdep.c:5235
lock_acquire+0x116/0x2f0 kernel/locking/lockdep.c:5866
down_read+0xb3/0xa50 kernel/locking/rwsem.c:1524
kernfs_iop_getattr+0xd3/0x490 fs/kernfs/inode.c:191
loop_query_min_dio_size drivers/block/loop.c:529 [inline]
loop_assign_backing_file+0x276/0x500 drivers/block/loop.c:582
loop_change_fd drivers/block/loop.c:645 [inline]
lo_ioctl+0x20a9/0x2850 drivers/block/loop.c:1569
blkdev_ioctl+0x5df/0x710 block/ioctl.c:698
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f110418d169
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:00007f1101fd5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f11043a6080 RCX: 00007f110418d169
RDX: 0000000000000005 RSI: 0000000000004c06 RDI: 0000000000000004
RBP: 00007f110420e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f11043a6080 R15: 00007f11044cfa28
</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 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_iop_getattr
2025-04-01 8:32 [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr syzbot
@ 2025-04-10 20:33 ` syzbot
2025-07-20 23:30 ` Hillf Danton
2025-07-21 1:53 ` Hillf Danton
2025-07-20 13:33 ` syzbot
1 sibling, 2 replies; 7+ messages in thread
From: syzbot @ 2025-04-10 20:33 UTC (permalink / raw)
To: gregkh, linux-kernel, syzkaller-bugs, tj
syzbot has found a reproducer for the following issue on:
HEAD commit: 2eb959eeecc6 Merge tag 'for-linus-6.15a-rc2-tag' of git://..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16fdf23f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=4c918722cb7e3d7
dashboard link: https://syzkaller.appspot.com/bug?extid=4bb2305559463e8f6a2a
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1352b7e4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17499d78580000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-2eb959ee.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e48cee99a6e9/vmlinux-2eb959ee.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6087fbb17208/bzImage-2eb959ee.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4bb2305559463e8f6a2a@syzkaller.appspotmail.com
======================================================
WARNING: possible circular locking dependency detected
6.15.0-rc1-syzkaller-00095-g2eb959eeecc6 #0 Not tainted
------------------------------------------------------
syz-executor105/5947 is trying to acquire lock:
ffff88801c68e9e0 (&root->kernfs_iattr_rwsem){++++}-{4:4}, at: kernfs_iop_getattr+0x9c/0xf0 fs/kernfs/inode.c:191
but task is already holding lock:
ffff8881070c75a8 (&q->q_usage_counter(io)#26){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:215
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (&q->q_usage_counter(io)#26){++++}-{0:0}:
blk_alloc_queue+0x619/0x760 block/blk-core.c:461
blk_mq_alloc_queue+0x179/0x290 block/blk-mq.c:4348
__blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4395
loop_add+0x496/0xb70 drivers/block/loop.c:2067
loop_init+0x164/0x270 drivers/block/loop.c:2302
do_one_initcall+0x120/0x6e0 init/main.c:1257
do_initcall_level init/main.c:1319 [inline]
do_initcalls init/main.c:1335 [inline]
do_basic_setup init/main.c:1354 [inline]
kernel_init_freeable+0x5c2/0x900 init/main.c:1567
kernel_init+0x1c/0x2b0 init/main.c:1457
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #2 (fs_reclaim){+.+.}-{0:0}:
__fs_reclaim_acquire mm/page_alloc.c:4028 [inline]
fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:4042
might_alloc include/linux/sched/mm.h:318 [inline]
slab_pre_alloc_hook mm/slub.c:4102 [inline]
slab_alloc_node mm/slub.c:4180 [inline]
kmem_cache_alloc_noprof+0x53/0x3b0 mm/slub.c:4207
__kernfs_iattrs+0xbc/0x3f0 fs/kernfs/inode.c:37
kernfs_iattrs fs/kernfs/inode.c:60 [inline]
__kernfs_setattr+0x4d/0x3c0 fs/kernfs/inode.c:73
kernfs_iop_setattr+0xda/0x120 fs/kernfs/inode.c:127
notify_change+0x6a6/0x1230 fs/attr.c:552
do_truncate+0x15b/0x220 fs/open.c:65
handle_truncate fs/namei.c:3466 [inline]
do_open fs/namei.c:3849 [inline]
path_openat+0x2761/0x2d40 fs/namei.c:4004
do_filp_open+0x20b/0x470 fs/namei.c:4031
do_sys_openat2+0x11b/0x1d0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x174/0x210 fs/open.c:1455
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (iattr_mutex){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:601 [inline]
__mutex_lock+0x199/0xb90 kernel/locking/mutex.c:746
__kernfs_iattrs+0x2b/0x3f0 fs/kernfs/inode.c:32
kernfs_iattrs fs/kernfs/inode.c:60 [inline]
__kernfs_setattr+0x4d/0x3c0 fs/kernfs/inode.c:73
kernfs_iop_setattr+0xda/0x120 fs/kernfs/inode.c:127
notify_change+0x6a6/0x1230 fs/attr.c:552
do_truncate+0x15b/0x220 fs/open.c:65
handle_truncate fs/namei.c:3466 [inline]
do_open fs/namei.c:3849 [inline]
path_openat+0x2761/0x2d40 fs/namei.c:4004
do_filp_open+0x20b/0x470 fs/namei.c:4031
do_sys_openat2+0x11b/0x1d0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x174/0x210 fs/open.c:1455
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&root->kernfs_iattr_rwsem){++++}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3166 [inline]
check_prevs_add kernel/locking/lockdep.c:3285 [inline]
validate_chain kernel/locking/lockdep.c:3909 [inline]
__lock_acquire+0x1173/0x1ba0 kernel/locking/lockdep.c:5235
lock_acquire kernel/locking/lockdep.c:5866 [inline]
lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5823
down_read+0x9b/0x480 kernel/locking/rwsem.c:1524
kernfs_iop_getattr+0x9c/0xf0 fs/kernfs/inode.c:191
vfs_getattr_nosec+0x29a/0x3a0 fs/stat.c:208
vfs_getattr+0x4a/0x60 fs/stat.c:246
loop_query_min_dio_size.isra.0+0x120/0x260 drivers/block/loop.c:529
loop_assign_backing_file drivers/block/loop.c:582 [inline]
loop_change_fd drivers/block/loop.c:645 [inline]
lo_ioctl+0x1ce0/0x26d0 drivers/block/loop.c:1569
blkdev_ioctl+0x274/0x6d0 block/ioctl.c:698
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 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_iattr_rwsem --> fs_reclaim --> &q->q_usage_counter(io)#26
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&q->q_usage_counter(io)#26);
lock(fs_reclaim);
lock(&q->q_usage_counter(io)#26);
rlock(&root->kernfs_iattr_rwsem);
*** DEADLOCK ***
3 locks held by syz-executor105/5947:
#0: ffff8880259ff368 (&lo->lo_mutex){+.+.}-{4:4}, at: loop_global_lock_killable drivers/block/loop.c:118 [inline]
#0: ffff8880259ff368 (&lo->lo_mutex){+.+.}-{4:4}, at: loop_change_fd drivers/block/loop.c:610 [inline]
#0: ffff8880259ff368 (&lo->lo_mutex){+.+.}-{4:4}, at: lo_ioctl+0x2a9/0x26d0 drivers/block/loop.c:1569
#1: ffff8881070c75a8 (&q->q_usage_counter(io)#26){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:215
#2: ffff8881070c75e0 (&q->q_usage_counter(queue)#20){+.+.}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:215
stack backtrace:
CPU: 2 UID: 0 PID: 5947 Comm: syz-executor105 Not tainted 6.15.0-rc1-syzkaller-00095-g2eb959eeecc6 #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__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:2079
check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2211
check_prev_add kernel/locking/lockdep.c:3166 [inline]
check_prevs_add kernel/locking/lockdep.c:3285 [inline]
validate_chain kernel/locking/lockdep.c:3909 [inline]
__lock_acquire+0x1173/0x1ba0 kernel/locking/lockdep.c:5235
lock_acquire kernel/locking/lockdep.c:5866 [inline]
lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5823
down_read+0x9b/0x480 kernel/locking/rwsem.c:1524
kernfs_iop_getattr+0x9c/0xf0 fs/kernfs/inode.c:191
vfs_getattr_nosec+0x29a/0x3a0 fs/stat.c:208
vfs_getattr+0x4a/0x60 fs/stat.c:246
loop_query_min_dio_size.isra.0+0x120/0x260 drivers/block/loop.c:529
loop_assign_backing_file drivers/block/loop.c:582 [inline]
loop_change_fd drivers/block/loop.c:645 [inline]
lo_ioctl+0x1ce0/0x26d0 drivers/block/loop.c:1569
blkdev_ioctl+0x274/0x6d0 block/ioctl.c:698
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f787e0f8e29
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 18 00 00 90 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:00007ffd0efe9d88 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f787e0f8e29
RDX: 0000000000000005 RSI: 0000000000004c06 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f787e142036
R13: 00007ffd0efe9dc0 R14: 00007ffd0efe9e00 R15: 0000000000000000
</TASK>
---
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr
2025-04-01 8:32 [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr syzbot
2025-04-10 20:33 ` syzbot
@ 2025-07-20 13:33 ` syzbot
1 sibling, 0 replies; 7+ messages in thread
From: syzbot @ 2025-07-20 13:33 UTC (permalink / raw)
To: axboe, gregkh, linux-kernel, ming.lei, syzkaller-bugs,
thomas.hellstrom, tj
syzbot has bisected this issue to:
commit ffa1e7ada456087c2402b37cd6b2863ced29aff0
Author: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Date: Tue Mar 18 09:55:48 2025 +0000
block: Make request_queue lockdep splats show up earlier
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=12d9a38c580000
start commit: bf61759db409 Merge tag 'sched_ext-for-6.16-rc6-fixes' of g..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=11d9a38c580000
console output: https://syzkaller.appspot.com/x/log.txt?x=16d9a38c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=415e83411fefd73f
dashboard link: https://syzkaller.appspot.com/bug?extid=4bb2305559463e8f6a2a
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1242b7d4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12b6238c580000
Reported-by: syzbot+4bb2305559463e8f6a2a@syzkaller.appspotmail.com
Fixes: ffa1e7ada456 ("block: Make request_queue lockdep splats show up earlier")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr
2025-04-10 20:33 ` syzbot
@ 2025-07-20 23:30 ` Hillf Danton
2025-07-21 0:21 ` syzbot
2025-07-21 1:53 ` Hillf Danton
1 sibling, 1 reply; 7+ messages in thread
From: Hillf Danton @ 2025-07-20 23:30 UTC (permalink / raw)
To: syzbot; +Cc: Thomas Hellström, linux-kernel, syzkaller-bugs
> Date: Thu, 10 Apr 2025 13:33:29 -0700 [thread overview]
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 2eb959eeecc6 Merge tag 'for-linus-6.15a-rc2-tag' of git://..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=16fdf23f980000
> kernel config: https://syzkaller.appspot.com/x/.config?x=4c918722cb7e3d7
> dashboard link: https://syzkaller.appspot.com/bug?extid=4bb2305559463e8f6a2a
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1352b7e4580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17499d78580000
#syz test upstream master
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr
2025-07-20 23:30 ` Hillf Danton
@ 2025-07-21 0:21 ` syzbot
0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-07-21 0:21 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs, thomas.hellstrom
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in kernfs_iop_getattr
======================================================
WARNING: possible circular locking dependency detected
6.16.0-rc7-syzkaller-g89be9a83ccf1 #0 Not tainted
------------------------------------------------------
syz.0.16/6627 is trying to acquire lock:
ffff88801c6f4a20 (&root->kernfs_iattr_rwsem){++++}-{4:4}, at: kernfs_iop_getattr+0x9c/0xf0 fs/kernfs/inode.c:191
but task is already holding lock:
ffff888026446278 (&q->q_usage_counter(io)#24){++++}-{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:
-> #3 (&q->q_usage_counter(io)#24){++++}-{0:0}:
blk_alloc_queue+0x619/0x760 block/blk-core.c:461
blk_mq_alloc_queue+0x175/0x290 block/blk-mq.c:4396
__blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4443
loop_add+0x49e/0xb70 drivers/block/loop.c:2012
loop_init+0x164/0x270 drivers/block/loop.c:2247
do_one_initcall+0x120/0x6e0 init/main.c:1274
do_initcall_level init/main.c:1336 [inline]
do_initcalls init/main.c:1352 [inline]
do_basic_setup init/main.c:1371 [inline]
kernel_init_freeable+0x5c2/0x900 init/main.c:1584
kernel_init+0x1c/0x2b0 init/main.c:1474
ret_from_fork+0x5d4/0x6f0 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
-> #2 (fs_reclaim){+.+.}-{0:0}:
__fs_reclaim_acquire mm/page_alloc.c:4045 [inline]
fs_reclaim_acquire+0x102/0x150 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_noprof+0x53/0x3b0 mm/slub.c:4204
__kernfs_iattrs+0xbc/0x3f0 fs/kernfs/inode.c:37
kernfs_iattrs fs/kernfs/inode.c:60 [inline]
__kernfs_setattr+0x4d/0x3c0 fs/kernfs/inode.c:73
kernfs_iop_setattr+0xda/0x120 fs/kernfs/inode.c:127
notify_change+0x6a9/0x1230 fs/attr.c:552
do_truncate+0x1d7/0x230 fs/open.c:68
handle_truncate fs/namei.c:3517 [inline]
do_open fs/namei.c:3900 [inline]
path_openat+0x2678/0x2cb0 fs/namei.c:4055
do_filp_open+0x20b/0x470 fs/namei.c:4082
do_sys_openat2+0x11b/0x1d0 fs/open.c:1437
do_sys_open fs/open.c:1452 [inline]
__do_sys_openat fs/open.c:1468 [inline]
__se_sys_openat fs/open.c:1463 [inline]
__x64_sys_openat+0x174/0x210 fs/open.c:1463
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (iattr_mutex){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:602 [inline]
__mutex_lock+0x199/0xb90 kernel/locking/mutex.c:747
__kernfs_iattrs+0x2b/0x3f0 fs/kernfs/inode.c:32
kernfs_iattrs fs/kernfs/inode.c:60 [inline]
__kernfs_setattr+0x4d/0x3c0 fs/kernfs/inode.c:73
kernfs_iop_setattr+0xda/0x120 fs/kernfs/inode.c:127
notify_change+0x6a9/0x1230 fs/attr.c:552
do_truncate+0x1d7/0x230 fs/open.c:68
handle_truncate fs/namei.c:3517 [inline]
do_open fs/namei.c:3900 [inline]
path_openat+0x2678/0x2cb0 fs/namei.c:4055
do_filp_open+0x20b/0x470 fs/namei.c:4082
do_sys_openat2+0x11b/0x1d0 fs/open.c:1437
do_sys_open fs/open.c:1452 [inline]
__do_sys_openat fs/open.c:1468 [inline]
__se_sys_openat fs/open.c:1463 [inline]
__x64_sys_openat+0x174/0x210 fs/open.c:1463
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&root->kernfs_iattr_rwsem){++++}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3168 [inline]
check_prevs_add kernel/locking/lockdep.c:3287 [inline]
validate_chain kernel/locking/lockdep.c:3911 [inline]
__lock_acquire+0x126f/0x1c90 kernel/locking/lockdep.c:5240
lock_acquire kernel/locking/lockdep.c:5871 [inline]
lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5828
down_read+0x9b/0x480 kernel/locking/rwsem.c:1524
kernfs_iop_getattr+0x9c/0xf0 fs/kernfs/inode.c:191
vfs_getattr_nosec+0x2ac/0x430 fs/stat.c:213
vfs_getattr+0x4a/0x60 fs/stat.c:262
loop_query_min_dio_size.isra.0+0x117/0x250 drivers/block/loop.c:455
loop_assign_backing_file drivers/block/loop.c:508 [inline]
loop_change_fd drivers/block/loop.c:586 [inline]
lo_ioctl+0x1d2e/0x2760 drivers/block/loop.c:1515
blkdev_ioctl+0x277/0x6d0 block/ioctl.c:704
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl fs/ioctl.c:893 [inline]
__x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 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_iattr_rwsem --> fs_reclaim --> &q->q_usage_counter(io)#24
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&q->q_usage_counter(io)#24);
lock(fs_reclaim);
lock(&q->q_usage_counter(io)#24);
rlock(&root->kernfs_iattr_rwsem);
*** DEADLOCK ***
3 locks held by syz.0.16/6627:
#0: ffff88814277b400 (&lo->lo_mutex){+.+.}-{4:4}, at: loop_global_lock_killable+0x30/0xb0 drivers/block/loop.c:118
#1: ffff888026446278 (&q->q_usage_counter(io)#24){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205
#2: ffff8880264462b0 (&q->q_usage_counter(queue)#20){+.+.}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205
stack backtrace:
CPU: 1 UID: 0 PID: 6627 Comm: syz.0.16 Not tainted 6.16.0-rc7-syzkaller-g89be9a83ccf1 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
__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:2046
check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2178
check_prev_add kernel/locking/lockdep.c:3168 [inline]
check_prevs_add kernel/locking/lockdep.c:3287 [inline]
validate_chain kernel/locking/lockdep.c:3911 [inline]
__lock_acquire+0x126f/0x1c90 kernel/locking/lockdep.c:5240
lock_acquire kernel/locking/lockdep.c:5871 [inline]
lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5828
down_read+0x9b/0x480 kernel/locking/rwsem.c:1524
kernfs_iop_getattr+0x9c/0xf0 fs/kernfs/inode.c:191
vfs_getattr_nosec+0x2ac/0x430 fs/stat.c:213
vfs_getattr+0x4a/0x60 fs/stat.c:262
loop_query_min_dio_size.isra.0+0x117/0x250 drivers/block/loop.c:455
loop_assign_backing_file drivers/block/loop.c:508 [inline]
loop_change_fd drivers/block/loop.c:586 [inline]
lo_ioctl+0x1d2e/0x2760 drivers/block/loop.c:1515
blkdev_ioctl+0x277/0x6d0 block/ioctl.c:704
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl fs/ioctl.c:893 [inline]
__x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9ba538e9a9
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:00007f9ba6276038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f9ba55b6080 RCX: 00007f9ba538e9a9
RDX: 0000000000000004 RSI: 0000000000004c06 RDI: 0000000000000003
RBP: 00007f9ba5410d69 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f9ba55b6080 R15: 00007ffc5d44de88
</TASK>
Tested on:
commit: 89be9a83 Linux 6.16-rc7
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=145f638c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=9f175a9275d2cdd7
dashboard link: https://syzkaller.appspot.com/bug?extid=4bb2305559463e8f6a2a
compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
Note: no patches were applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr
2025-04-10 20:33 ` syzbot
2025-07-20 23:30 ` Hillf Danton
@ 2025-07-21 1:53 ` Hillf Danton
2025-07-21 2:17 ` syzbot
1 sibling, 1 reply; 7+ messages in thread
From: Hillf Danton @ 2025-07-21 1:53 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
> Date: Thu, 10 Apr 2025 13:33:29 -0700 [thread overview]
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 2eb959eeecc6 Merge tag 'for-linus-6.15a-rc2-tag' of git://..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=16fdf23f980000
> kernel config: https://syzkaller.appspot.com/x/.config?x=4c918722cb7e3d7
> dashboard link: https://syzkaller.appspot.com/bug?extid=4bb2305559463e8f6a2a
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1352b7e4580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17499d78580000
#syz test upstream master
--- x/drivers/block/loop.c
+++ y/drivers/block/loop.c
@@ -443,9 +443,8 @@ static void loop_reread_partitions(struc
__func__, lo->lo_number, lo->lo_file_name, rc);
}
-static unsigned int loop_query_min_dio_size(struct loop_device *lo)
+static unsigned int loop_query_min_dio_size(struct file *file)
{
- struct file *file = lo->lo_backing_file;
struct block_device *sb_bdev = file->f_mapping->host->i_sb->s_bdev;
struct kstat st;
@@ -497,7 +496,8 @@ static int loop_validate_file(struct fil
return 0;
}
-static void loop_assign_backing_file(struct loop_device *lo, struct file *file)
+static void loop_assign_backing_file(struct loop_device *lo, struct file *file,
+ unsigned int min_dio_size)
{
lo->lo_backing_file = file;
lo->old_gfp_mask = mapping_gfp_mask(file->f_mapping);
@@ -505,7 +505,7 @@ static void loop_assign_backing_file(str
lo->old_gfp_mask & ~(__GFP_IO | __GFP_FS));
if (lo->lo_backing_file->f_flags & O_DIRECT)
lo->lo_flags |= LO_FLAGS_DIRECT_IO;
- lo->lo_min_dio_size = loop_query_min_dio_size(lo);
+ lo->lo_min_dio_size = min_dio_size;
}
static int loop_check_backing_file(struct file *file)
@@ -532,7 +532,7 @@ static int loop_change_fd(struct loop_de
{
struct file *file = fget(arg);
struct file *old_file;
- unsigned int memflags;
+ unsigned int memflags, blksz;
int error;
bool partscan;
bool is_loop;
@@ -581,9 +581,10 @@ static int loop_change_fd(struct loop_de
/* and ... switch */
disk_force_media_change(lo->lo_disk);
+ blksz = loop_query_min_dio_size(file);
memflags = blk_mq_freeze_queue(lo->lo_queue);
mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
- loop_assign_backing_file(lo, file);
+ loop_assign_backing_file(lo, file, blksz);
loop_update_dio(lo);
blk_mq_unfreeze_queue(lo->lo_queue, memflags);
partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
@@ -974,6 +975,7 @@ static int loop_configure(struct loop_de
{
struct file *file = fget(config->fd);
struct queue_limits lim;
+ unsigned int blksz;
int error;
loff_t size;
bool partscan;
@@ -1043,8 +1045,9 @@ static int loop_configure(struct loop_de
disk_force_media_change(lo->lo_disk);
set_disk_ro(lo->lo_disk, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
+ blksz = loop_query_min_dio_size(file);
lo->lo_device = bdev;
- loop_assign_backing_file(lo, file);
+ loop_assign_backing_file(lo, file, blksz);
lim = queue_limits_start_update(lo->lo_queue);
loop_update_limits(lo, &lim, config->block_size);
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr
2025-07-21 1:53 ` Hillf Danton
@ 2025-07-21 2:17 ` syzbot
0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-07-21 2:17 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+4bb2305559463e8f6a2a@syzkaller.appspotmail.com
Tested-by: syzbot+4bb2305559463e8f6a2a@syzkaller.appspotmail.com
Tested on:
commit: 89be9a83 Linux 6.16-rc7
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10b9d38c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=9f175a9275d2cdd7
dashboard link: https://syzkaller.appspot.com/bug?extid=4bb2305559463e8f6a2a
compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=12380fd4580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-21 2:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 8:32 [syzbot] [kernfs?] possible deadlock in kernfs_iop_getattr syzbot
2025-04-10 20:33 ` syzbot
2025-07-20 23:30 ` Hillf Danton
2025-07-21 0:21 ` syzbot
2025-07-21 1:53 ` Hillf Danton
2025-07-21 2:17 ` syzbot
2025-07-20 13:33 ` 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).