[v6.6] possible deadlock in ntfs_file_write_iter

3 views
Skip to first unread message

syzbot

unread,
Jun 26, 2025, 10:52:30 AM6/26/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6282921b6825 Linux 6.6.94
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10c8008c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=96da6b2210cda427
dashboard link: https://syzkaller.appspot.com/bug?extid=2a58b3031895d04feb3a
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a3bf0d8e22b2/disk-6282921b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d1d442f782d0/vmlinux-6282921b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a8378f4b7e1b/bzImage-6282921b.xz

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

loop6: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.6.94-syzkaller #0 Not tainted
------------------------------------------------------
syz.6.3223/14011 is trying to acquire lock:
ffff8880178694a0 (&mm->mmap_lock){++++}-{3:3}, at: internal_get_user_pages_fast+0x204/0x2730 mm/gup.c:3195

but task is already holding lock:
ffff888057876af0 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:824 [inline]
ffff888057876af0 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: ntfs_file_write_iter+0x23e/0x700 fs/ntfs3/file.c:1093

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}:
down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:804 [inline]
ntfs_file_mmap+0x54c/0x730 fs/ntfs3/file.c:302
call_mmap include/linux/fs.h:2023 [inline]
mmap_file mm/internal.h:98 [inline]
__mmap_region mm/mmap.c:2780 [inline]
mmap_region+0xe57/0x1f80 mm/mmap.c:2931
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
internal_get_user_pages_fast+0x21d/0x2730 mm/gup.c:3195
iov_iter_extract_user_pages lib/iov_iter.c:1785 [inline]
iov_iter_extract_pages+0x393/0x790 lib/iov_iter.c:1848
dio_refill_pages fs/direct-io.c:173 [inline]
dio_get_page fs/direct-io.c:214 [inline]
do_direct_IO fs/direct-io.c:914 [inline]
__blockdev_direct_IO+0x10d6/0x3420 fs/direct-io.c:1248
blockdev_direct_IO include/linux/fs.h:3047 [inline]
ntfs_direct_IO+0x196/0x3a0 fs/ntfs3/inode.c:801
generic_file_direct_write+0x1d4/0x3e0 mm/filemap.c:3941
__generic_file_write_iter+0x11b/0x230 mm/filemap.c:4097
ntfs_file_write_iter+0x61c/0x700 fs/ntfs3/file.c:1120
do_iter_readv_writev fs/read_write.c:-1 [inline]
do_iter_write+0x79a/0xc70 fs/read_write.c:860
vfs_writev fs/read_write.c:933 [inline]
do_pwritev+0x205/0x340 fs/read_write.c:1030
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(&sb->s_type->i_mutex_key#25);
lock(&mm->mmap_lock);
lock(&sb->s_type->i_mutex_key#25);
rlock(&mm->mmap_lock);

*** DEADLOCK ***

2 locks held by syz.6.3223/14011:
#0: ffff888078580418 (sb_writers#17){.+.+}-{0:0}, at: vfs_writev fs/read_write.c:932 [inline]
#0: ffff888078580418 (sb_writers#17){.+.+}-{0:0}, at: do_pwritev+0x1f3/0x340 fs/read_write.c:1030
#1: ffff888057876af0 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:824 [inline]
#1: ffff888057876af0 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: ntfs_file_write_iter+0x23e/0x700 fs/ntfs3/file.c:1093

stack backtrace:
CPU: 1 PID: 14011 Comm: syz.6.3223 Not tainted 6.6.94-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
internal_get_user_pages_fast+0x21d/0x2730 mm/gup.c:3195
iov_iter_extract_user_pages lib/iov_iter.c:1785 [inline]
iov_iter_extract_pages+0x393/0x790 lib/iov_iter.c:1848
dio_refill_pages fs/direct-io.c:173 [inline]
dio_get_page fs/direct-io.c:214 [inline]
do_direct_IO fs/direct-io.c:914 [inline]
__blockdev_direct_IO+0x10d6/0x3420 fs/direct-io.c:1248
blockdev_direct_IO include/linux/fs.h:3047 [inline]
ntfs_direct_IO+0x196/0x3a0 fs/ntfs3/inode.c:801
generic_file_direct_write+0x1d4/0x3e0 mm/filemap.c:3941
__generic_file_write_iter+0x11b/0x230 mm/filemap.c:4097
ntfs_file_write_iter+0x61c/0x700 fs/ntfs3/file.c:1120
do_iter_readv_writev fs/read_write.c:-1 [inline]
do_iter_write+0x79a/0xc70 fs/read_write.c:860
vfs_writev fs/read_write.c:933 [inline]
do_pwritev+0x205/0x340 fs/read_write.c:1030
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:0x7f640ed8e929
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:00007f640fbe5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f640efb5fa0 RCX: 00007f640ed8e929
RDX: 0000000000000001 RSI: 0000200000000240 RDI: 0000000000000004
RBP: 00007f640ee10b39 R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000002000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f640efb5fa0 R15: 00007fffc3c7f408
</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 21, 2025, 5:30:20 PM10/21/25
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages