syzbot


possible deadlock in map_mft_record

Status: upstream: reported on 2025/12/14 19:45
Reported-by: syzbot+32fcc4e8de09159962b2@syzkaller.appspotmail.com
First crash: 9d07h, last: 9d07h
Similar bugs (7)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in map_mft_record 4 13 632d 1008d 0/3 auto-obsoleted due to no activity on 2024/07/09 13:58
linux-6.1 possible deadlock in map_mft_record (2) 4 15 2d07h 465d 0/3 upstream: reported on 2024/09/14 09:25
upstream possible deadlock in map_mft_record ntfs3 4 C error done 845 692d 1161d 25/29 fixed on 2024/03/20 11:33
linux-4.14 possible deadlock in map_mft_record ntfs 4 C 5 1041d 1135d 0/1 upstream: reported C repro on 2022/11/15 01:41
upstream possible deadlock in map_mft_record (2) fs 4 1 627d 623d 0/29 auto-obsoleted due to no activity on 2024/07/04 04:55
linux-5.15 possible deadlock in map_mft_record 4 52 37d 1012d 0/3 upstream: reported on 2023/03/17 18:38
linux-4.19 possible deadlock in map_mft_record ntfs 4 C error 11 1059d 1171d 0/1 upstream: reported C repro on 2022/10/09 19:52

Sample crash report:
ntfs: volume version 3.1.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.9.289/8583 is trying to acquire lock:
ffff88805cc8c390 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x50/0x650 fs/ntfs/mft.c:154

but task is already holding lock:
ffff88805cc8c300 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x218/0x28a0 fs/ntfs/inode.c:2378

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&rl->lock){++++}-{3:3}:
       down_read+0x46/0x2e0 kernel/locking/rwsem.c:1520
       ntfs_read_block fs/ntfs/aops.c:248 [inline]
       ntfs_read_folio+0x144d/0x2980 fs/ntfs/aops.c:436
       filemap_read_folio+0x167/0x760 mm/filemap.c:2420
       do_read_cache_folio+0x470/0x7e0 mm/filemap.c:3804
       do_read_cache_page+0x32/0x250 mm/filemap.c:3870
       read_mapping_page include/linux/pagemap.h:892 [inline]
       ntfs_map_page fs/ntfs/aops.h:75 [inline]
       ntfs_sync_mft_mirror+0x236/0x1aa0 fs/ntfs/mft.c:480
       write_mft_record_nolock+0x1407/0x18c0 fs/ntfs/mft.c:805
       write_mft_record+0x136/0x300 fs/ntfs/mft.h:95
       __ntfs_write_inode+0x731/0xc00 fs/ntfs/inode.c:3051
       ntfs_commit_inode fs/ntfs/inode.h:300 [inline]
       ntfs_put_super+0xeea/0x1070 fs/ntfs/super.c:2315
       generic_shutdown_super+0x134/0x2b0 fs/super.c:693
       kill_block_super+0x44/0x90 fs/super.c:1660
       deactivate_locked_super+0x97/0x100 fs/super.c:481
       cleanup_mnt+0x429/0x4c0 fs/namespace.c:1259
       task_work_run+0x1ce/0x250 kernel/task_work.c:239
       exit_task_work include/linux/task_work.h:43 [inline]
       do_exit+0x90b/0x23c0 kernel/exit.c:883
       do_group_exit+0x21b/0x2d0 kernel/exit.c:1024
       get_signal+0x12fc/0x1400 kernel/signal.c:2902
       arch_do_signal_or_restart+0x9c/0x7b0 arch/x86/kernel/signal.c:310
       exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174
       exit_to_user_mode_prepare+0xf6/0x180 kernel/entry/common.c:210
       __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
       syscall_exit_to_user_mode+0x1a/0x50 kernel/entry/common.c:302
       do_syscall_64+0x61/0xb0 arch/x86/entry/common.c:87
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&ni->mrec_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
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       map_mft_record+0x50/0x650 fs/ntfs/mft.c:154
       ntfs_truncate+0x28a/0x28a0 fs/ntfs/inode.c:2383
       ntfs_truncate_vfs fs/ntfs/inode.c:2863 [inline]
       ntfs_setattr+0x34a/0x430 fs/ntfs/inode.c:2915
       notify_change+0xb0d/0xe10 fs/attr.c:499
       do_truncate+0x19b/0x220 fs/open.c:66
       vfs_truncate+0x266/0x300 fs/open.c:112
       do_sys_truncate+0xe0/0x1a0 fs/open.c:135
       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(&rl->lock);
                               lock(&ni->mrec_lock);
                               lock(&rl->lock);
  lock(&ni->mrec_lock);

 *** DEADLOCK ***

3 locks held by syz.9.289/8583:
 #0: ffff888058d6a418 (sb_writers#16){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412
 #1: ffff88805cc8c680 (&sb->s_type->i_mutex_key#23){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
 #1: ffff88805cc8c680 (&sb->s_type->i_mutex_key#23){+.+.}-{3:3}, at: do_truncate+0x187/0x220 fs/open.c:64
 #2: ffff88805cc8c300 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x218/0x28a0 fs/ntfs/inode.c:2378

stack backtrace:
CPU: 1 PID: 8583 Comm: syz.9.289 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/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
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
 map_mft_record+0x50/0x650 fs/ntfs/mft.c:154
 ntfs_truncate+0x28a/0x28a0 fs/ntfs/inode.c:2383
 ntfs_truncate_vfs fs/ntfs/inode.c:2863 [inline]
 ntfs_setattr+0x34a/0x430 fs/ntfs/inode.c:2915
 notify_change+0xb0d/0xe10 fs/attr.c:499
 do_truncate+0x19b/0x220 fs/open.c:66
 vfs_truncate+0x266/0x300 fs/open.c:112
 do_sys_truncate+0xe0/0x1a0 fs/open.c:135
 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:0x7f112b58f749
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:00007f112c3f5038 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 00007f112b7e5fa0 RCX: 00007f112b58f749
RDX: 0000000000000000 RSI: 0000000000081c04 RDI: 0000200000000040
RBP: 00007f112b613f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f112b7e6038 R14: 00007f112b7e5fa0 R15: 00007ffcaa6acb98
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/12/14 19:45 linux-6.6.y 5fa4793a2d2d d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in map_mft_record
* Struck through repros no longer work on HEAD.