[v6.6] possible deadlock in ntfs_fiemap

2 views
Skip to first unread message

syzbot

unread,
Jul 8, 2025, 5:32:23 PM7/8/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: a5df3a702b2c Linux 6.6.96
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13c9ca8c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2632deddafa957e8
dashboard link: https://syzkaller.appspot.com/bug?extid=349ef4875b811300cb58
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9ba5b19f9f4d/disk-a5df3a70.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2cd779015729/vmlinux-a5df3a70.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b56fc39e5cb8/bzImage-a5df3a70.xz

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

loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.6.96-syzkaller #0 Not tainted
------------------------------------------------------
syz.0.296/7582 is trying to acquire lock:
ffff88807b5094a0 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0xaa/0x120 mm/memory.c:5946

but task is already holding lock:
ffff88805a379720 (&ni->ni_lock#3/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1120 [inline]
ffff88805a379720 (&ni->ni_lock#3/5){+.+.}-{3:3}, at: ntfs_fiemap+0xc8/0x130 fs/ntfs3/file.c:1211

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->ni_lock#3/5){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
ni_lock fs/ntfs3/ntfs_fs.h:1120 [inline]
attr_data_get_block+0x2ed/0x1eb0 fs/ntfs3/attrib.c:918
ntfs_file_mmap+0x4b8/0x730 fs/ntfs3/file.c:294
call_mmap include/linux/fs.h:2023 [inline]
mmap_file mm/internal.h:98 [inline]
__mmap_region mm/mmap.c:2786 [inline]
mmap_region+0xe57/0x1f80 mm/mmap.c:2937
do_mmap+0x8d1/0xfd0 mm/mmap.c:1381
vm_mmap_pgoff+0x1c0/0x400 mm/util.c:556
ksys_mmap_pgoff+0x520/0x700 mm/mmap.c:1427
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
__might_fault+0xc6/0x120 mm/memory.c:5946
_copy_to_user+0x2a/0xa0 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:191 [inline]
fiemap_fill_next_extent+0x1c1/0x390 fs/ioctl.c:145
ni_fiemap+0x7e6/0xbe0 fs/ntfs3/frecord.c:2038
ntfs_fiemap+0xdb/0x130 fs/ntfs3/file.c:1213
ioctl_fiemap fs/ioctl.c:220 [inline]
do_vfs_ioctl+0x140c/0x1bb0 fs/ioctl.c:811
__do_sys_ioctl fs/ioctl.c:869 [inline]
__se_sys_ioctl+0x83/0x170 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ni->ni_lock#3/5);
lock(&mm->mmap_lock);
lock(&ni->ni_lock#3/5);
rlock(&mm->mmap_lock);

*** DEADLOCK ***

1 lock held by syz.0.296/7582:
#0: ffff88805a379720 (&ni->ni_lock#3/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1120 [inline]
#0: ffff88805a379720 (&ni->ni_lock#3/5){+.+.}-{3:3}, at: ntfs_fiemap+0xc8/0x130 fs/ntfs3/file.c:1211

stack backtrace:
CPU: 0 PID: 7582 Comm: syz.0.296 Not tainted 6.6.96-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
check_noncircular+0x2bd/0x3c0 kernel/locking/lockdep.c:2187
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
__might_fault+0xc6/0x120 mm/memory.c:5946
_copy_to_user+0x2a/0xa0 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:191 [inline]
fiemap_fill_next_extent+0x1c1/0x390 fs/ioctl.c:145
ni_fiemap+0x7e6/0xbe0 fs/ntfs3/frecord.c:2038
ntfs_fiemap+0xdb/0x130 fs/ntfs3/file.c:1213
ioctl_fiemap fs/ioctl.c:220 [inline]
do_vfs_ioctl+0x140c/0x1bb0 fs/ioctl.c:811
__do_sys_ioctl fs/ioctl.c:869 [inline]
__se_sys_ioctl+0x83/0x170 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f190c58e929
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:00007f190d32d038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f190c7b5fa0 RCX: 00007f190c58e929
RDX: 0000200000000080 RSI: 00000000c020660b RDI: 0000000000000004
RBP: 00007f190c610b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f190c7b5fa0 R15: 00007ffca1c43368
</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,
Oct 7, 2025, 4:04:36 PM10/7/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: e617101e5626 Linux 6.6.110
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11cd0542580000
kernel config: https://syzkaller.appspot.com/x/.config?x=12606d4b8832c7e4
dashboard link: https://syzkaller.appspot.com/bug?extid=349ef4875b811300cb58
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17ab41e2580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=135b792f980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5e096b5ec298/disk-e617101e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/074307bb1464/vmlinux-e617101e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/68e0d6ffb47c/bzImage-e617101e.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/a154ab1ea436/mount_0.gz

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

syz.0.17[5949]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set
loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.17/5949 is trying to acquire lock:
ffff8880787501a0 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0xaa/0x120 mm/memory.c:5946

but task is already holding lock:
ffff888060642d40 (&ni->ni_lock#3/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1119 [inline]
ffff888060642d40 (&ni->ni_lock#3/5){+.+.}-{3:3}, at: ntfs_fiemap+0xc8/0x130 fs/ntfs3/file.c:1214

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->ni_lock#3/5){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
ni_lock fs/ntfs3/ntfs_fs.h:1119 [inline]
attr_data_get_block+0x2ed/0x1eb0 fs/ntfs3/attrib.c:918
ntfs_file_mmap+0x4c0/0x760 fs/ntfs3/file.c:294
call_mmap include/linux/fs.h:2023 [inline]
mmap_file mm/internal.h:98 [inline]
__mmap_region mm/mmap.c:2790 [inline]
mmap_region+0xfa5/0x2020 mm/mmap.c:2941
do_mmap+0x92f/0x10a0 mm/mmap.c:1385
vm_mmap_pgoff+0x1c0/0x400 mm/util.c:556
ksys_mmap_pgoff+0x520/0x700 mm/mmap.c:1431
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
__might_fault+0xc6/0x120 mm/memory.c:5946
_copy_to_user+0x2a/0xa0 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:191 [inline]
fiemap_fill_next_extent+0x1c1/0x390 fs/ioctl.c:145
ni_fiemap+0x89d/0xbe0 fs/ntfs3/frecord.c:2060
ntfs_fiemap+0xdb/0x130 fs/ntfs3/file.c:1216
ioctl_fiemap fs/ioctl.c:220 [inline]
do_vfs_ioctl+0x140c/0x1bb0 fs/ioctl.c:811
__do_sys_ioctl fs/ioctl.c:869 [inline]
__se_sys_ioctl+0x83/0x170 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ni->ni_lock#3/5);
lock(&mm->mmap_lock);
lock(&ni->ni_lock#3/5);
rlock(&mm->mmap_lock);

*** DEADLOCK ***

1 lock held by syz.0.17/5949:
#0: ffff888060642d40 (&ni->ni_lock#3/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1119 [inline]
#0: ffff888060642d40 (&ni->ni_lock#3/5){+.+.}-{3:3}, at: ntfs_fiemap+0xc8/0x130 fs/ntfs3/file.c:1214

stack backtrace:
CPU: 1 PID: 5949 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
check_noncircular+0x2bd/0x3c0 kernel/locking/lockdep.c:2187
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
__might_fault+0xc6/0x120 mm/memory.c:5946
_copy_to_user+0x2a/0xa0 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:191 [inline]
fiemap_fill_next_extent+0x1c1/0x390 fs/ioctl.c:145
ni_fiemap+0x89d/0xbe0 fs/ntfs3/frecord.c:2060
ntfs_fiemap+0xdb/0x130 fs/ntfs3/file.c:1216
ioctl_fiemap fs/ioctl.c:220 [inline]
do_vfs_ioctl+0x140c/0x1bb0 fs/ioctl.c:811
__do_sys_ioctl fs/ioctl.c:869 [inline]
__se_sys_ioctl+0x83/0x170 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fc45778eec9
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:00007fc4585e5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fc4579e5fa0 RCX: 00007fc45778eec9
RDX: 0000200000000340 RSI: 00000000c020660b RDI: 0000000000000006
RBP: 00007fc457811f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fc4579e6038 R14: 00007fc4579e5fa0 R15: 00007ffd7d8b9fb8
</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.
Reply all
Reply to author
Forward
0 new messages