====================================================== WARNING: possible circular locking dependency detected 5.15.168-syzkaller #0 Not tainted ------------------------------------------------------ syz.2.1122/8603 is trying to acquire lock: ffff0000ee4a9a50 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x6c/0x738 fs/ntfs/mft.c:154 but task is already holding lock: ffff0000ee4a99c0 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x178/0x224c 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+0xc0/0x398 kernel/locking/rwsem.c:1498 ntfs_read_block fs/ntfs/aops.c:248 [inline] ntfs_readpage+0xf3c/0x1e04 fs/ntfs/aops.c:435 do_read_cache_page+0x60c/0x950 read_cache_page+0x68/0x84 mm/filemap.c:3574 read_mapping_page include/linux/pagemap.h:515 [inline] ntfs_map_page fs/ntfs/aops.h:75 [inline] ntfs_sync_mft_mirror+0x1e4/0x18f0 fs/ntfs/mft.c:480 write_mft_record_nolock+0x104c/0x16ec fs/ntfs/mft.c:787 write_mft_record fs/ntfs/mft.h:95 [inline] __ntfs_write_inode+0x720/0xdc8 fs/ntfs/inode.c:3050 ntfs_write_inode+0x68/0x90 fs/ntfs/super.c:2656 write_inode fs/fs-writeback.c:1495 [inline] __writeback_single_inode+0x584/0x13a4 fs/fs-writeback.c:1705 writeback_sb_inodes+0x94c/0x1654 fs/fs-writeback.c:1930 __writeback_inodes_wb+0x110/0x39c fs/fs-writeback.c:2001 wb_writeback+0x410/0xfc8 fs/fs-writeback.c:2106 wb_check_start_all fs/fs-writeback.c:2228 [inline] wb_do_writeback fs/fs-writeback.c:2254 [inline] wb_workfn+0x9c8/0x1070 fs/fs-writeback.c:2288 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 -> #0 (&ni->mrec_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623 __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 map_mft_record+0x6c/0x738 fs/ntfs/mft.c:154 ntfs_truncate+0x1e8/0x224c fs/ntfs/inode.c:2383 ntfs_truncate_vfs fs/ntfs/inode.c:2862 [inline] ntfs_setattr+0x260/0x320 fs/ntfs/inode.c:2914 notify_change+0xa34/0xcf8 fs/attr.c:505 do_truncate+0x1c0/0x28c fs/open.c:65 handle_truncate fs/namei.c:3265 [inline] do_open fs/namei.c:3612 [inline] path_openat+0x20c4/0x26cc fs/namei.c:3742 do_filp_open+0x1a8/0x3b4 fs/namei.c:3769 do_sys_openat2+0x128/0x3e0 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1280 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 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.1122/8603: #0: ffff0000e78dc460 (sb_writers#37){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:377 #1: ffff0000ee4a9d30 (&sb->s_type->i_mutex_key#37){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] #1: ffff0000ee4a9d30 (&sb->s_type->i_mutex_key#37){+.+.}-{3:3}, at: do_truncate+0x1ac/0x28c fs/open.c:63 #2: ffff0000ee4a99c0 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x178/0x224c fs/ntfs/inode.c:2378 stack backtrace: CPU: 1 PID: 8603 Comm: syz.2.1122 Not tainted 5.15.168-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623 __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 map_mft_record+0x6c/0x738 fs/ntfs/mft.c:154 ntfs_truncate+0x1e8/0x224c fs/ntfs/inode.c:2383 ntfs_truncate_vfs fs/ntfs/inode.c:2862 [inline] ntfs_setattr+0x260/0x320 fs/ntfs/inode.c:2914 notify_change+0xa34/0xcf8 fs/attr.c:505 do_truncate+0x1c0/0x28c fs/open.c:65 handle_truncate fs/namei.c:3265 [inline] do_open fs/namei.c:3612 [inline] path_openat+0x20c4/0x26cc fs/namei.c:3742 do_filp_open+0x1a8/0x3b4 fs/namei.c:3769 do_sys_openat2+0x128/0x3e0 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1280 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584