[v5.15] possible deadlock in mi_read (2)

3 views
Skip to first unread message

syzbot

unread,
Jan 12, 2025, 9:48:24 PM1/12/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4735586da88e Linux 5.15.176
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12641cb0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=8c3b695ffd9247a0
dashboard link: https://syzkaller.appspot.com/bug?extid=c69c5ad75584648b282b
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/44a9faa53b37/disk-4735586d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2e4ec21926b2/vmlinux-4735586d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f96f554b1d28/bzImage-4735586d.xz

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

ntfs3: loop0: Mark volume as dirty due to NTFS errors
ntfs3: loop0: Failed to load $Extend.
============================================
WARNING: possible recursive locking detected
5.15.176-syzkaller #0 Not tainted
--------------------------------------------
syz.0.247/5063 is trying to acquire lock:
ffff888074bba5e0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline]
ffff888074bba5e0 (&ni->ni_lock/5){+.+.}-{3:3}, at: mi_read+0x2dd/0x5a0 fs/ntfs3/record.c:148

but task is already holding lock:
ffff888074bbe0e0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline]
ffff888074bbe0e0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_rename+0x710/0xd40 fs/ntfs3/namei.c:315

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&ni->ni_lock/5);
lock(&ni->ni_lock/5);

*** DEADLOCK ***

May be due to missing lock nesting notation

6 locks held by syz.0.247/5063:
#0: ffff888025782460 (sb_writers#24){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:377
#1: ffff888074bbb740 (&type->i_mutex_dir_key#17/1){+.+.}-{3:3}, at: do_renameat2+0x67e/0x1700 fs/namei.c:4924
#2: ffff888074bbe380 (&sb->s_type->i_mutex_key#33/4){+.+.}-{3:3}, at: vfs_rename+0x7e4/0x10f0 fs/namei.c:4803
#3: ffff888074bbb4a0 (&ni->ni_lock/6){+.+.}-{3:3}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1105 [inline]
#3: ffff888074bbb4a0 (&ni->ni_lock/6){+.+.}-{3:3}, at: ntfs_rename+0x6fa/0xd40 fs/ntfs3/namei.c:314
#4: ffff888074bbe0e0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline]
#4: ffff888074bbe0e0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_rename+0x710/0xd40 fs/ntfs3/namei.c:315
#5: ffff8880250e8120 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_look_free_mft+0x1e7/0xff0 fs/ntfs3/fsntfs.c:542

stack backtrace:
CPU: 1 PID: 5063 Comm: syz.0.247 Not tainted 5.15.176-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
print_deadlock_bug kernel/locking/lockdep.c:2946 [inline]
check_deadlock kernel/locking/lockdep.c:2989 [inline]
validate_chain+0x46d2/0x5930 kernel/locking/lockdep.c:3775
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline]
mi_read+0x2dd/0x5a0 fs/ntfs3/record.c:148
mi_format_new+0x1a7/0x5c0 fs/ntfs3/record.c:374
ni_add_subrecord+0xde/0x430 fs/ntfs3/frecord.c:372
ntfs_look_free_mft+0x7f1/0xff0 fs/ntfs3/fsntfs.c:686
ni_create_attr_list+0x9b6/0x1470 fs/ntfs3/frecord.c:850
ni_ins_attr_ext+0x364/0xb30 fs/ntfs3/frecord.c:951
ni_insert_attr fs/ntfs3/frecord.c:1105 [inline]
ni_insert_resident fs/ntfs3/frecord.c:1479 [inline]
ni_add_name+0x689/0x9d0 fs/ntfs3/frecord.c:2985
ni_rename+0xbe/0x1e0 fs/ntfs3/frecord.c:3025
ntfs_rename+0x74a/0xd40 fs/ntfs3/namei.c:318
vfs_rename+0xd32/0x10f0 fs/namei.c:4832
do_renameat2+0xe0f/0x1700 fs/namei.c:4985
__do_sys_rename fs/namei.c:5031 [inline]
__se_sys_rename fs/namei.c:5029 [inline]
__x64_sys_rename+0x82/0x90 fs/namei.c:5029
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f1af32c4d29
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:00007f1af1135038 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 00007f1af34b4fa0 RCX: 00007f1af32c4d29
RDX: 0000000000000000 RSI: 0000000020000480 RDI: 0000000020000340
RBP: 00007f1af3340b08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f1af34b4fa0 R15: 00007ffd8d4c8fe8
</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 syzk...@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

syzbot

unread,
Jan 12, 2025, 10:12:22 PM1/12/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 4735586da88e Linux 5.15.176
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13c38a18580000
kernel config: https://syzkaller.appspot.com/x/.config?x=8c3b695ffd9247a0
dashboard link: https://syzkaller.appspot.com/bug?extid=c69c5ad75584648b282b
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14c0ebc4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13b6b1df980000
mounted in repro: https://storage.googleapis.com/syzbot-assets/ef27d062a79f/mount_0.gz

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

loop0: detected capacity change from 0 to 4096
ntfs3: loop0: Mark volume as dirty due to NTFS errors
ntfs3: loop0: Failed to load $Extend.
============================================
WARNING: possible recursive locking detected
5.15.176-syzkaller #0 Not tainted
--------------------------------------------
syz-executor169/4162 is trying to acquire lock:
ffff88806f4b0100 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline]
ffff88806f4b0100 (&ni->ni_lock/5){+.+.}-{3:3}, at: mi_read+0x2dd/0x5a0 fs/ntfs3/record.c:148

but task is already holding lock:
ffff888075754ac0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline]
ffff888075754ac0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_rename+0x710/0xd40 fs/ntfs3/namei.c:315

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&ni->ni_lock/5);
lock(&ni->ni_lock/5);

*** DEADLOCK ***

May be due to missing lock nesting notation

6 locks held by syz-executor169/4162:
#0: ffff88802aa50460 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:377
#1: ffff888075754600 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: do_renameat2+0x67e/0x1700 fs/namei.c:4924
#2: ffff888075754d60 (&sb->s_type->i_mutex_key#15/4){+.+.}-{3:3}, at: vfs_rename+0x7e4/0x10f0 fs/namei.c:4803
#3: ffff888075754360 (&ni->ni_lock/6){+.+.}-{3:3}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1105 [inline]
#3: ffff888075754360 (&ni->ni_lock/6){+.+.}-{3:3}, at: ntfs_rename+0x6fa/0xd40 fs/ntfs3/namei.c:314
#4: ffff888075754ac0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline]
#4: ffff888075754ac0 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_rename+0x710/0xd40 fs/ntfs3/namei.c:315
#5: ffff88802aa52120 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_look_free_mft+0x1e7/0xff0 fs/ntfs3/fsntfs.c:542

stack backtrace:
CPU: 0 PID: 4162 Comm: syz-executor169 Not tainted 5.15.176-syzkaller #0
RIP: 0033:0x7fe151be37b9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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:00007ffd6622b238 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007fe151be37b9
RDX: 00007fe151be37b9 RSI: 0000000020000480 RDI: 0000000020000340
RBP: 00007f


---
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.
Reply all
Reply to author
Forward
0 new messages