====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc3-syzkaller #0 Not tainted ------------------------------------------------------ syz.3.223/5863 is trying to acquire lock: ffff888103f33270 (&wnd->rw_lock){++++}-{4:4}, at: mark_as_free_ex+0x37/0x190 fs/ntfs3/fsntfs.c:2484 but task is already holding lock: ffff88810ef6db10 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_truncate fs/ntfs3/file.c:503 [inline] ffff88810ef6db10 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_setattr+0x1bf/0x2d0 fs/ntfs3/file.c:822 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ni->file.run_lock#2){++++}-{4:4}: down_read+0x4a/0x440 kernel/locking/rwsem.c:1524 run_unpack_ex+0x244/0x380 fs/ntfs3/run.c:1119 ntfs_read_mft fs/ntfs3/inode.c:401 [inline] ntfs_iget5+0xb61/0xe30 fs/ntfs3/inode.c:537 ntfs_dir_emit fs/ntfs3/dir.c:335 [inline] ntfs_read_hdr+0x1be/0x270 fs/ntfs3/dir.c:383 ntfs_readdir+0x2b5/0x410 fs/ntfs3/dir.c:494 iterate_dir+0xb6/0x1b0 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:407 [inline] __se_sys_getdents64+0x67/0x110 fs/readdir.c:392 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa0/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&wnd->rw_lock){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x1236/0x2570 kernel/locking/lockdep.c:5202 lock_acquire+0xeb/0x270 kernel/locking/lockdep.c:5825 down_write_nested+0x2c/0xb0 kernel/locking/rwsem.c:1693 mark_as_free_ex+0x37/0x190 fs/ntfs3/fsntfs.c:2484 run_deallocate_ex+0xb0/0x150 fs/ntfs3/attrib.c:122 attr_set_size+0x549/0x1130 fs/ntfs3/attrib.c:753 ntfs_truncate fs/ntfs3/file.c:504 [inline] ntfs_setattr+0x1fc/0x2d0 fs/ntfs3/file.c:822 notify_change+0x30c/0x380 fs/attr.c:503 do_truncate+0xe1/0x120 fs/open.c:65 handle_truncate fs/namei.c:3395 [inline] do_open fs/namei.c:3778 [inline] path_openat+0xc4b/0xdf0 fs/namei.c:3933 do_filp_open+0xad/0x150 fs/namei.c:3960 do_sys_openat2+0x7e/0xe0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_open fs/open.c:1438 [inline] __se_sys_open fs/open.c:1434 [inline] __x64_sys_open+0x7a/0xa0 fs/open.c:1434 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa0/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->file.run_lock#2); lock(&wnd->rw_lock); lock(&ni->file.run_lock#2); lock(&wnd->rw_lock); *** DEADLOCK *** 4 locks held by syz.3.223/5863: #0: ffff888103f34420 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x12/0x40 fs/namespace.c:515 #1: ffff88810ef6dcf8 (&sb->s_type->i_mutex_key#20){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:815 [inline] #1: ffff88810ef6dcf8 (&sb->s_type->i_mutex_key#20){+.+.}-{4:4}, at: do_truncate+0xd1/0x120 fs/open.c:63 #2: ffff88810ef6da60 (&ni->ni_lock#2/5){+.+.}-{4:4}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline] #2: ffff88810ef6da60 (&ni->ni_lock#2/5){+.+.}-{4:4}, at: ntfs_truncate fs/ntfs3/file.c:501 [inline] #2: ffff88810ef6da60 (&ni->ni_lock#2/5){+.+.}-{4:4}, at: ntfs_setattr+0x1ae/0x2d0 fs/ntfs3/file.c:822 #3: ffff88810ef6db10 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_truncate fs/ntfs3/file.c:503 [inline] #3: ffff88810ef6db10 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_setattr+0x1bf/0x2d0 fs/ntfs3/file.c:822 stack backtrace: CPU: 0 UID: 0 PID: 5863 Comm: syz.3.223 Not tainted 6.12.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/25/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xa3/0x100 lib/dump_stack.c:120 print_circular_bug+0x28d/0x2a0 kernel/locking/lockdep.c:2074 check_noncircular+0x119/0x140 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x1236/0x2570 kernel/locking/lockdep.c:5202 lock_acquire+0xeb/0x270 kernel/locking/lockdep.c:5825 down_write_nested+0x2c/0xb0 kernel/locking/rwsem.c:1693 mark_as_free_ex+0x37/0x190 fs/ntfs3/fsntfs.c:2484 run_deallocate_ex+0xb0/0x150 fs/ntfs3/attrib.c:122 attr_set_size+0x549/0x1130 fs/ntfs3/attrib.c:753 ntfs_truncate fs/ntfs3/file.c:504 [inline] ntfs_setattr+0x1fc/0x2d0 fs/ntfs3/file.c:822 notify_change+0x30c/0x380 fs/attr.c:503 do_truncate+0xe1/0x120 fs/open.c:65 handle_truncate fs/namei.c:3395 [inline] do_open fs/namei.c:3778 [inline] path_openat+0xc4b/0xdf0 fs/namei.c:3933 do_filp_open+0xad/0x150 fs/namei.c:3960 do_sys_openat2+0x7e/0xe0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_open fs/open.c:1438 [inline] __se_sys_open fs/open.c:1434 [inline] __x64_sys_open+0x7a/0xa0 fs/open.c:1434 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa0/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fbe5b185d19 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:00007fbe5c030038 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007fbe5b375fa0 RCX: 00007fbe5b185d19 RDX: 00000000000001d8 RSI: 0000000000147383 RDI: 0000000020000240 RBP: 00007fbe5b201a20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fbe5b375fa0 R15: 00007ffd072ad068