syzbot


possible deadlock in map_mft_record

Status: auto-obsoleted due to no activity on 2024/07/09 13:58
Reported-by: syzbot+7788c04db40a6dad9586@syzkaller.appspotmail.com
First crash: 631d, last: 255d
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in map_mft_record (2) 2 14h58m 88d 0/3 upstream: reported on 2024/09/14 09:25
upstream possible deadlock in map_mft_record ntfs3 C error done 845 316d 784d 25/28 fixed on 2024/03/20 11:33
linux-4.14 possible deadlock in map_mft_record ntfs C 5 664d 758d 0/1 upstream: reported C repro on 2022/11/15 01:41
upstream possible deadlock in map_mft_record (2) fs 1 250d 246d 0/28 auto-obsoleted due to no activity on 2024/07/04 04:55
linux-5.15 possible deadlock in map_mft_record 36 54d 635d 0/3 upstream: reported on 2023/03/17 18:38
linux-4.19 possible deadlock in map_mft_record ntfs C error 11 682d 794d 0/1 upstream: reported C repro on 2022/10/09 19:52

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.83-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/19332 is trying to acquire lock:
ffff88805a012290 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x48/0x630 fs/ntfs/mft.c:154

but task is already holding lock:
ffff88805a012200 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x1e3/0x2860 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}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
       ntfs_read_block fs/ntfs/aops.c:248 [inline]
       ntfs_read_folio+0x14c9/0x29d0 fs/ntfs/aops.c:436
       filemap_read_folio+0x199/0x780 mm/filemap.c:2461
       do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3598
       do_read_cache_page+0x32/0x220 mm/filemap.c:3640
       read_mapping_page include/linux/pagemap.h:791 [inline]
       ntfs_map_page fs/ntfs/aops.h:75 [inline]
       ntfs_sync_mft_mirror+0x25b/0x1ad0 fs/ntfs/mft.c:480
       write_mft_record_nolock+0x1151/0x18d0 fs/ntfs/mft.c:787
       write_mft_record+0x149/0x310 fs/ntfs/mft.h:95
       __ntfs_write_inode+0x6ff/0xbb0 fs/ntfs/inode.c:3050
       write_inode fs/fs-writeback.c:1460 [inline]
       __writeback_single_inode+0x67d/0x11e0 fs/fs-writeback.c:1677
       writeback_sb_inodes+0xc2b/0x1b20 fs/fs-writeback.c:1903
       wb_writeback+0x49d/0xe10 fs/fs-writeback.c:2077
       wb_do_writeback fs/fs-writeback.c:2220 [inline]
       wb_workfn+0x427/0x1020 fs/fs-writeback.c:2260
       process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
       worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
       kthread+0x28d/0x320 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:307

-> #0 (&ni->mrec_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       map_mft_record+0x48/0x630 fs/ntfs/mft.c:154
       ntfs_truncate+0x263/0x2860 fs/ntfs/inode.c:2383
       ntfs_truncate_vfs fs/ntfs/inode.c:2862 [inline]
       ntfs_setattr+0x2c7/0x3a0 fs/ntfs/inode.c:2914
       notify_change+0xce3/0xfc0 fs/attr.c:499
       do_truncate+0x21c/0x300 fs/open.c:65
       handle_truncate fs/namei.c:3287 [inline]
       do_open fs/namei.c:3632 [inline]
       path_openat+0x27e2/0x2e60 fs/namei.c:3785
       do_filp_open+0x230/0x480 fs/namei.c:3812
       do_sys_openat2+0x13b/0x500 fs/open.c:1318
       do_sys_open fs/open.c:1334 [inline]
       __do_sys_openat fs/open.c:1350 [inline]
       __se_sys_openat fs/open.c:1345 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1345
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

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-executor.3/19332:
 #0: ffff88806edf4460 (sb_writers#27){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
 #1: ffff88805a012570 (&sb->s_type->i_mutex_key#44){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
 #1: ffff88805a012570 (&sb->s_type->i_mutex_key#44){+.+.}-{3:3}, at: do_truncate+0x208/0x300 fs/open.c:63
 #2: ffff88805a012200 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x1e3/0x2860 fs/ntfs/inode.c:2378

stack backtrace:
CPU: 0 PID: 19332 Comm: syz-executor.3 Not tainted 6.1.83-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
 map_mft_record+0x48/0x630 fs/ntfs/mft.c:154
 ntfs_truncate+0x263/0x2860 fs/ntfs/inode.c:2383
 ntfs_truncate_vfs fs/ntfs/inode.c:2862 [inline]
 ntfs_setattr+0x2c7/0x3a0 fs/ntfs/inode.c:2914
 notify_change+0xce3/0xfc0 fs/attr.c:499
 do_truncate+0x21c/0x300 fs/open.c:65
 handle_truncate fs/namei.c:3287 [inline]
 do_open fs/namei.c:3632 [inline]
 path_openat+0x27e2/0x2e60 fs/namei.c:3785
 do_filp_open+0x230/0x480 fs/namei.c:3812
 do_sys_openat2+0x13b/0x500 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1345
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f7b4307dda9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7b43df20c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f7b431abf80 RCX: 00007f7b4307dda9
RDX: 0000000000103a42 RSI: 0000000020000380 RDI: ffffffffffffff9c
RBP: 00007f7b430ca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f7b431abf80 R15: 00007ffea9f43648
 </TASK>

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/31 13:57 linux-6.1.y e5cd595e23c1 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in map_mft_record
2023/11/20 09:59 linux-6.1.y fb2635ac69ab cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in map_mft_record
2024/01/11 23:45 linux-6.1.y 7c58bfa711cb dda5a988 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in map_mft_record
2023/12/23 17:56 linux-6.1.y 4aa6747d9352 fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in map_mft_record
2023/10/22 01:27 linux-6.1.y 7d24402875c7 361b23dc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in map_mft_record
2023/09/02 10:47 linux-6.1.y c2cbfe5f5122 696ea0d2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in map_mft_record
2023/08/13 08:54 linux-6.1.y 1321ab403b38 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in map_mft_record
2023/08/01 06:22 linux-6.1.y d2a6dc4eaf6d 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in map_mft_record
2023/07/09 02:43 linux-6.1.y 61fd484b2cf6 668cb1fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in map_mft_record
2023/07/07 04:34 linux-6.1.y 61fd484b2cf6 22ae5830 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in map_mft_record
2023/07/23 21:03 linux-6.1.y 75389113731b 27cbe77f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in map_mft_record
2023/07/01 16:01 linux-6.1.y 0f4ac6b4c5f0 bfc47836 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in map_mft_record
2023/03/21 20:17 linux-6.1.y 7eaef76fbc46 8b4eb097 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in map_mft_record
* Struck through repros no longer work on HEAD.