loop2: detected capacity change from 0 to 4096
ntfs: volume version 3.1.
======================================================
WARNING: possible circular locking dependency detected
6.1.128-syzkaller #0 Not tainted
------------------------------------------------------
syz.2.12922/2102 is trying to acquire lock:
ffff888070bf8190 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x48/0x630 fs/ntfs/mft.c:154
but task is already holding lock:
ffff888070bf8100 (&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:2489
do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3626
do_read_cache_page+0x32/0x220 mm/filemap.c:3668
read_mapping_page include/linux/pagemap.h:791 [inline]
ntfs_map_page fs/ntfs/aops.h:75 [inline]
ntfs_sync_mft_mirror+0x258/0x1ad0 fs/ntfs/mft.c:480
write_mft_record_nolock+0x13f6/0x18d0 fs/ntfs/mft.c:805
write_mft_record+0x149/0x310 fs/ntfs/mft.h:95
__ntfs_write_inode+0x6ff/0xbb0 fs/ntfs/inode.c:3050
ntfs_commit_inode fs/ntfs/inode.h:300 [inline]
ntfs_put_super+0x92/0xf80 fs/ntfs/super.c:2260
generic_shutdown_super+0x130/0x340 fs/super.c:501
kill_block_super+0x7a/0xe0 fs/super.c:1470
deactivate_locked_super+0xa0/0x110 fs/super.c:332
cleanup_mnt+0x490/0x520 fs/namespace.c:1186
task_work_run+0x246/0x300 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
do_syscall_64+0x47/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: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
vfs_truncate+0x2dd/0x3a0 fs/open.c:111
do_sys_truncate+0xda/0x190 fs/open.c:134
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/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.2.12922/2102:
#0: ffff8880520c8460 (sb_writers#30){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
#1: ffff888070bf8470 (&sb->s_type->i_mutex_key#34){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#1: ffff888070bf8470 (&sb->s_type->i_mutex_key#34){+.+.}-{3:3}, at: do_truncate+0x208/0x300 fs/open.c:63
#2: ffff888070bf8100 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x1e3/0x2860 fs/ntfs/inode.c:2378
stack backtrace:
CPU: 0 PID: 2102 Comm: syz.2.12922 Not tainted 6.1.128-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/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
vfs_truncate+0x2dd/0x3a0 fs/open.c:111
do_sys_truncate+0xda/0x190 fs/open.c:134
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f251518cde9
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:00007f25160b3038 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 00007f25153a5fa0 RCX: 00007f251518cde9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00004000000001c0
RBP: 00007f251520e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f25153a5fa0 R15: 00007fffe1d43938
</TASK>
ntfs: (device loop2): ntfs_read_block(): Failed to read from inode 0x6, attribute type 0x80, vcn 0x0, offset 0x0 because its location on disk could not be determined even after retrying (error code -5).
ntfs: (device loop2): ntfs_read_block(): Failed to read from inode 0x6, attribute type 0x80, vcn 0x0, offset 0x800 because its location on disk could not be determined even after retrying (error code -5).
ntfs: (device loop2): __ntfs_bitmap_set_bits_in_run(): Failed to map first page (error -5), aborting.
ntfs: (device loop2): __ntfs_cluster_free(): Failed to clear first run (error -5), aborting.
ntfs: (device loop2): ntfs_truncate(): Failed to release cluster(s) (error code -5). Unmount and run chkdsk to recover the lost cluster(s).