loop0: detected capacity change from 0 to 4096 ====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc6-next-20241105-syzkaller #0 Not tainted ------------------------------------------------------ syz.0.1780/10881 is trying to acquire lock: ffff88807888e880 (&ni->file.run_lock#2){++++}-{4:4}, at: run_unpack_ex+0x55e/0x9e0 fs/ntfs3/run.c:1119 but task is already holding lock: ffff88805e222270 (&wnd->rw_lock){++++}-{4:4}, at: run_unpack_ex+0x47a/0x9e0 fs/ntfs3/run.c:1100 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&wnd->rw_lock){++++}-{4:4}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 down_write_nested+0xa2/0x220 kernel/locking/rwsem.c:1693 ntfs_look_for_free_space+0x100/0x690 fs/ntfs3/fsntfs.c:362 attr_allocate_clusters+0x1d6/0x990 fs/ntfs3/attrib.c:159 attr_set_size+0x2053/0x4300 fs/ntfs3/attrib.c:574 ntfs_set_size+0x161/0x200 fs/ntfs3/inode.c:854 ntfs_extend+0x1d1/0xad0 fs/ntfs3/file.c:409 ntfs_file_write_iter+0x403/0x7a0 fs/ntfs3/file.c:1262 __kernel_write_iter+0x42a/0x940 fs/read_write.c:612 __kernel_write+0x120/0x180 fs/read_write.c:632 do_acct_process+0x11ff/0x1870 kernel/acct.c:539 acct_pin_kill+0x2b/0x130 kernel/acct.c:192 pin_kill+0x2e1/0x5e0 fs/fs_pin.c:44 __do_sys_acct kernel/acct.c:309 [inline] __se_sys_acct+0x2d2/0x760 kernel/acct.c:291 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&ni->file.run_lock#2){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524 run_unpack_ex+0x55e/0x9e0 fs/ntfs3/run.c:1119 ntfs_read_mft fs/ntfs3/inode.c:401 [inline] ntfs_iget5+0x1f9a/0x37b0 fs/ntfs3/inode.c:537 dir_search_u+0x2fe/0x3a0 fs/ntfs3/dir.c:264 ntfs_lookup+0x106/0x1f0 fs/ntfs3/namei.c:85 lookup_one_qstr_excl+0x11f/0x260 fs/namei.c:1692 do_renameat2+0x670/0x13f0 fs/namei.c:5165 __do_sys_rename fs/namei.c:5271 [inline] __se_sys_rename fs/namei.c:5269 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5269 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 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(&wnd->rw_lock); lock(&ni->file.run_lock#2); lock(&wnd->rw_lock); rlock(&ni->file.run_lock#2); *** DEADLOCK *** 4 locks held by syz.0.1780/10881: #0: ffff888011d52420 (sb_writers#17){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515 #1: ffff88807888a850 (&type->i_mutex_dir_key#12/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:852 [inline] #1: ffff88807888a850 (&type->i_mutex_dir_key#12/1){+.+.}-{4:4}, at: lock_rename fs/namei.c:3215 [inline] #1: ffff88807888a850 (&type->i_mutex_dir_key#12/1){+.+.}-{4:4}, at: do_renameat2+0x62c/0x13f0 fs/namei.c:5159 #2: ffff88807888a5b8 (&ni->ni_lock#2/6){+.+.}-{4:4}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1115 [inline] #2: ffff88807888a5b8 (&ni->ni_lock#2/6){+.+.}-{4:4}, at: ntfs_lookup+0xf9/0x1f0 fs/ntfs3/namei.c:84 #3: ffff88805e222270 (&wnd->rw_lock){++++}-{4:4}, at: run_unpack_ex+0x47a/0x9e0 fs/ntfs3/run.c:1100 stack backtrace: CPU: 1 UID: 0 PID: 10881 Comm: syz.0.1780 Not tainted 6.12.0-rc6-next-20241105-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 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+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524 run_unpack_ex+0x55e/0x9e0 fs/ntfs3/run.c:1119 ntfs_read_mft fs/ntfs3/inode.c:401 [inline] ntfs_iget5+0x1f9a/0x37b0 fs/ntfs3/inode.c:537 dir_search_u+0x2fe/0x3a0 fs/ntfs3/dir.c:264 ntfs_lookup+0x106/0x1f0 fs/ntfs3/namei.c:85 lookup_one_qstr_excl+0x11f/0x260 fs/namei.c:1692 do_renameat2+0x670/0x13f0 fs/namei.c:5165 __do_sys_rename fs/namei.c:5271 [inline] __se_sys_rename fs/namei.c:5269 [inline] __x64_sys_rename+0x82/0x90 fs/namei.c:5269 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fad5697e719 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:00007fad5772f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000052 RAX: ffffffffffffffda RBX: 00007fad56b35f80 RCX: 00007fad5697e719 RDX: 0000000000000000 RSI: 000000002003f280 RDI: 000000002003f200 RBP: 00007fad569f139e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fad56b35f80 R15: 00007ffdc8dc7ca8 ntfs3(loop0): ino=1f, "file2" ntfs_rename