loop1: detected capacity change from 0 to 4096 ntfs3(loop1): Different NTFS sector size (1024) and media sector size (512). ====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc5-next-20241104-syzkaller #0 Not tainted ------------------------------------------------------ syz.1.1082/8810 is trying to acquire lock: ffff8880555f4270 (&wnd->rw_lock){++++}-{4:4}, at: ntfs_look_for_free_space+0x100/0x690 fs/ntfs3/fsntfs.c:362 but task is already holding lock: ffff888055c20908 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_extend_mft+0x160/0x4b0 fs/ntfs3/fsntfs.c:511 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ni->file.run_lock#2){++++}-{4:4}: 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 ntfs_dir_emit fs/ntfs3/dir.c:335 [inline] ntfs_read_hdr+0x700/0xb80 fs/ntfs3/dir.c:383 ntfs_readdir+0x91f/0xf00 fs/ntfs3/dir.c:494 iterate_dir+0x571/0x800 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:407 [inline] __se_sys_getdents64+0x1d3/0x4a0 fs/readdir.c:392 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 (&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+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_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_extend_mft+0x188/0x4b0 fs/ntfs3/fsntfs.c:512 ntfs_look_free_mft+0x77c/0x10c0 fs/ntfs3/fsntfs.c:709 ni_create_attr_list+0x9bd/0x1480 fs/ntfs3/frecord.c:878 ni_ins_attr_ext+0x369/0xbe0 fs/ntfs3/frecord.c:976 ni_insert_attr fs/ntfs3/frecord.c:1143 [inline] ni_insert_resident fs/ntfs3/frecord.c:1527 [inline] ni_add_name+0x809/0xe90 fs/ntfs3/frecord.c:3038 ni_rename+0xc2/0x1e0 fs/ntfs3/frecord.c:3078 ntfs_rename+0x7c1/0xd10 fs/ntfs3/namei.c:317 vfs_rename+0xbdb/0xf00 fs/namei.c:5054 do_renameat2+0xd94/0x13f0 fs/namei.c:5211 __do_sys_renameat2 fs/namei.c:5245 [inline] __se_sys_renameat2 fs/namei.c:5242 [inline] __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5242 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(&ni->file.run_lock#2); lock(&wnd->rw_lock); lock(&ni->file.run_lock#2); lock(&wnd->rw_lock); *** DEADLOCK *** 7 locks held by syz.1.1082/8810: #0: ffff8880555f2420 (sb_writers#21){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515 #1: ffff888077fd20f8 (&type->i_mutex_dir_key#13/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:852 [inline] #1: ffff888077fd20f8 (&type->i_mutex_dir_key#13/1){+.+.}-{4:4}, at: lock_rename fs/namei.c:3202 [inline] #1: ffff888077fd20f8 (&type->i_mutex_dir_key#13/1){+.+.}-{4:4}, at: do_renameat2+0x62c/0x13f0 fs/namei.c:5146 #2: ffff888077fd71c0 (&sb->s_type->i_mutex_key#31/4){+.+.}-{4:4}, at: vfs_rename+0x6a2/0xf00 fs/namei.c:5025 #3: ffff888077fd1e60 (&ni->ni_lock#2/6){+.+.}-{4:4}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1115 [inline] #3: ffff888077fd1e60 (&ni->ni_lock#2/6){+.+.}-{4:4}, at: ntfs_rename+0x72f/0xd10 fs/ntfs3/namei.c:311 #4: ffff888077fd6f28 (&ni->ni_lock/5){+.+.}-{4:4}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline] #4: ffff888077fd6f28 (&ni->ni_lock/5){+.+.}-{4:4}, at: ntfs_rename+0x74a/0xd10 fs/ntfs3/namei.c:312 #5: ffff8880555f4128 (&wnd->rw_lock/1){+.+.}-{4:4}, at: ntfs_look_free_mft+0x1e5/0x10c0 fs/ntfs3/fsntfs.c:571 #6: ffff888055c20908 (&ni->file.run_lock#2){++++}-{4:4}, at: ntfs_extend_mft+0x160/0x4b0 fs/ntfs3/fsntfs.c:511 stack backtrace: CPU: 0 UID: 0 PID: 8810 Comm: syz.1.1082 Not tainted 6.12.0-rc5-next-20241104-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_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_extend_mft+0x188/0x4b0 fs/ntfs3/fsntfs.c:512 ntfs_look_free_mft+0x77c/0x10c0 fs/ntfs3/fsntfs.c:709 ni_create_attr_list+0x9bd/0x1480 fs/ntfs3/frecord.c:878 ni_ins_attr_ext+0x369/0xbe0 fs/ntfs3/frecord.c:976 ni_insert_attr fs/ntfs3/frecord.c:1143 [inline] ni_insert_resident fs/ntfs3/frecord.c:1527 [inline] ni_add_name+0x809/0xe90 fs/ntfs3/frecord.c:3038 ni_rename+0xc2/0x1e0 fs/ntfs3/frecord.c:3078 ntfs_rename+0x7c1/0xd10 fs/ntfs3/namei.c:317 vfs_rename+0xbdb/0xf00 fs/namei.c:5054 do_renameat2+0xd94/0x13f0 fs/namei.c:5211 __do_sys_renameat2 fs/namei.c:5245 [inline] __se_sys_renameat2 fs/namei.c:5242 [inline] __x64_sys_renameat2+0xce/0xe0 fs/namei.c:5242 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:0x7f2ecb97e719 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:00007f2ecc82b038 EFLAGS: 00000246 ORIG_RAX: 000000000000013c RAX: ffffffffffffffda RBX: 00007f2ecbb35f80 RCX: 00007f2ecb97e719 RDX: 0000000000000005 RSI: 0000000020000080 RDI: ffffffffffffff9c RBP: 00007f2ecb9f139e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020000980 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f2ecbb35f80 R15: 00007ffd5b2bc188 ntfs3(loop1): ino=0, attr_set_size ntfs3(loop1): Mark volume as dirty due to NTFS errors