[v6.6] possible deadlock in ntfs_read_folio

0 views
Skip to first unread message

syzbot

unread,
Aug 29, 2025, 8:49:32 AM8/29/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cc1a1c5b404a Linux 6.6.103
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=169ec262580000
kernel config: https://syzkaller.appspot.com/x/.config?x=412020841cf033b0
dashboard link: https://syzkaller.appspot.com/bug?extid=15b8b271922dac284447
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/46c06862a545/disk-cc1a1c5b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/38ddabb6fc8b/vmlinux-cc1a1c5b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b130b7d031b5/bzImage-cc1a1c5b.xz

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

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

but task is already holding lock:
ffff888059d63310 (&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_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
handle_truncate fs/namei.c:3291 [inline]
do_open fs/namei.c:3636 [inline]
path_openat+0x298c/0x3190 fs/namei.c:3789
do_filp_open+0x1c5/0x3d0 fs/namei.c:3816
do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
do_sys_open fs/open.c:1434 [inline]
__do_sys_openat fs/open.c:1450 [inline]
__se_sys_openat fs/open.c:1445 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1445
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:5/986:
#0: ffff88801a27f138 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:2609 [inline]
#0: ffff88801a27f138 ((wq_completion)writeback){+.+.}-{0:0}, at: process_scheduled_works+0x957/0x15b0 kernel/workqueue.c:2711
#1: ffffc90004297d00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:2609 [inline]
#1: ffffc90004297d00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x957/0x15b0 kernel/workqueue.c:2711
#2: ffff888059d63310 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x50/0x650 fs/ntfs/mft.c:154

stack backtrace:
CPU: 1 PID: 986 Comm: kworker/u4:5 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/14/2025
Workqueue: writeback wb_workfn (flush-7:1)
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>
ntfs: (device loop1): ntfs_write_block(): Writing beyond initialized size is not supported yet. Sorry.


---
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,
Nov 4, 2025, 11:41:32 AM11/4/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 0a805b6ea8cd Linux 6.6.116
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=166fd012580000
kernel config: https://syzkaller.appspot.com/x/.config?x=12606d4b8832c7e4
dashboard link: https://syzkaller.appspot.com/bug?extid=15b8b271922dac284447
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=132e2532580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16942114580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/13874446b4b2/disk-0a805b6e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/69a5e59e1ade/vmlinux-0a805b6e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/322c0711f976/bzImage-0a805b6e.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/661f2c646df9/mount_3.gz

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

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

but task is already holding lock:
ffff88805f855410 (&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_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
handle_truncate fs/namei.c:3299 [inline]
do_open fs/namei.c:3644 [inline]
path_openat+0x298c/0x3190 fs/namei.c:3797
do_filp_open+0x1c5/0x3d0 fs/namei.c:3824
write_inode fs/fs-writeback.c:1483 [inline]
__writeback_single_inode+0x705/0xee0 fs/fs-writeback.c:1700
writeback_sb_inodes+0x77c/0xef0 fs/fs-writeback.c:1926
wb_writeback+0x450/0xba0 fs/fs-writeback.c:2105
wb_do_writeback fs/fs-writeback.c:2252 [inline]
wb_workfn+0x3ff/0xe20 fs/fs-writeback.c:2292
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:2/36:
#0: ffff888019e6a138 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:2609 [inline]
#0: ffff888019e6a138 ((wq_completion)writeback){+.+.}-{0:0}, at: process_scheduled_works+0x957/0x15b0 kernel/workqueue.c:2711
#1: ffffc90000acfd00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:2609 [inline]
#1: ffffc90000acfd00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x957/0x15b0 kernel/workqueue.c:2711
#2: ffff88805f855410 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x50/0x650 fs/ntfs/mft.c:154

stack backtrace:
CPU: 1 PID: 36 Comm: kworker/u4:2 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Workqueue: writeback wb_workfn (flush-7:2)
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:1483 [inline]
__writeback_single_inode+0x705/0xee0 fs/fs-writeback.c:1700
writeback_sb_inodes+0x77c/0xef0 fs/fs-writeback.c:1926
wb_writeback+0x450/0xba0 fs/fs-writeback.c:2105
wb_do_writeback fs/fs-writeback.c:2252 [inline]
wb_workfn+0x3ff/0xe20 fs/fs-writeback.c:2292
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>


---
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