syzbot


possible deadlock in ntfs_read_folio

Status: upstream: reported on 2025/08/29 12:49
Reported-by: syzbot+15b8b271922dac284447@syzkaller.appspotmail.com
First crash: 54d, last: 34d
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in ntfs_read_folio origin:upstream missing-backport 4 C unreliable 176 6d06h 952d 0/3 upstream: reported C repro on 2023/03/14 17:51
upstream possible deadlock in ntfs_read_folio ntfs3 4 C inconclusive done 5562 2h21m 1117d 0/29 upstream: reported C repro on 2022/10/01 13:48

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
kworker/u4:8/1088 is trying to acquire lock:
ffff88805cef0100 (&rl->lock){++++}-{3:3}, at: ntfs_read_block fs/ntfs/aops.c:248 [inline]
ffff88805cef0100 (&rl->lock){++++}-{3:3}, at: ntfs_read_folio+0x144d/0x2980 fs/ntfs/aops.c:436

but task is already holding lock:
ffff88805cef2ad0 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x50/0x650 fs/ntfs/mft.c:154

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->mrec_lock){+.+.}-{3:3}:
       __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_attr_extend_allocation+0x549/0x44a0 fs/ntfs/attrib.c:2002
       ntfs_prepare_file_for_write fs/ntfs/file.c:391 [inline]
       ntfs_file_write_iter+0x33f/0x19c0 fs/ntfs/file.c:1914
       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

-> #0 (&rl->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
       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:3789
       do_read_cache_page+0x32/0x250 mm/filemap.c:3855
       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+0x116f/0x18c0 fs/ntfs/mft.c:787
       write_mft_record+0x136/0x300 fs/ntfs/mft.h:95
       __ntfs_write_inode+0x731/0xc00 fs/ntfs/inode.c:3051
       write_inode fs/fs-writeback.c:1473 [inline]
       __writeback_single_inode+0x705/0xee0 fs/fs-writeback.c:1690
       writeback_sb_inodes+0x77c/0xef0 fs/fs-writeback.c:1916
       wb_writeback+0x450/0xba0 fs/fs-writeback.c:2095
       wb_do_writeback fs/fs-writeback.c:2242 [inline]
       wb_workfn+0x3ff/0xe20 fs/fs-writeback.c:2282
       process_one_work kernel/workqueue.c:2634 [inline]
       process_scheduled_works+0xa45/0x15b0 kernel/workqueue.c:2711
       worker_thread+0xa55/0xfc0 kernel/workqueue.c:2792
       kthread+0x2fa/0x390 kernel/kthread.c:388
       ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
       ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ni->mrec_lock);
                               lock(&rl->lock);
                               lock(&ni->mrec_lock);
  rlock(&rl->lock);

 *** DEADLOCK ***

3 locks held by kworker/u4:8/1088:
 #0: ffff88801a27a138 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:2609 [inline]
 #0: ffff88801a27a138 ((wq_completion)writeback){+.+.}-{0:0}, at: process_scheduled_works+0x957/0x15b0 kernel/workqueue.c:2711
 #1: ffffc900045dfd00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:2609 [inline]
 #1: ffffc900045dfd00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x957/0x15b0 kernel/workqueue.c:2711
 #2: ffff88805cef2ad0 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x50/0x650 fs/ntfs/mft.c:154

stack backtrace:
CPU: 0 PID: 1088 Comm: kworker/u4:8 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Workqueue: writeback wb_workfn (flush-7:0)
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
 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:3789
 do_read_cache_page+0x32/0x250 mm/filemap.c:3855
 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+0x116f/0x18c0 fs/ntfs/mft.c:787
 write_mft_record+0x136/0x300 fs/ntfs/mft.h:95
 __ntfs_write_inode+0x731/0xc00 fs/ntfs/inode.c:3051
 write_inode fs/fs-writeback.c:1473 [inline]
 __writeback_single_inode+0x705/0xee0 fs/fs-writeback.c:1690
 writeback_sb_inodes+0x77c/0xef0 fs/fs-writeback.c:1916
 wb_writeback+0x450/0xba0 fs/fs-writeback.c:2095
 wb_do_writeback fs/fs-writeback.c:2242 [inline]
 wb_workfn+0x3ff/0xe20 fs/fs-writeback.c:2282
 process_one_work kernel/workqueue.c:2634 [inline]
 process_scheduled_works+0xa45/0x15b0 kernel/workqueue.c:2711
 worker_thread+0xa55/0xfc0 kernel/workqueue.c:2792
 kthread+0x2fa/0x390 kernel/kthread.c:388
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293
 </TASK>

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/09/18 11:34 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ntfs_read_folio
2025/08/29 12:48 linux-6.6.y cc1a1c5b404a 3e1beec6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ntfs_read_folio
* Struck through repros no longer work on HEAD.