ntfs3: loop7: Different NTFS' sector size (4096) and media sector size (512) ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.7.1681/9720 is trying to acquire lock: ffff888074a72d40 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline] ffff888074a72d40 (&ni->ni_lock/5){+.+.}-{3:3}, at: attr_data_get_block+0x2df/0x1880 fs/ntfs3/attrib.c:849 but task is already holding lock: ffff888077f14e28 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline] ffff888077f14e28 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x15d/0x2b0 mm/util.c:549 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&mm->mmap_lock){++++}-{3:3}: __might_fault+0xb3/0x110 mm/memory.c:5357 _copy_to_user+0x29/0x130 lib/usercopy.c:35 copy_to_user include/linux/uaccess.h:200 [inline] fiemap_fill_next_extent+0x19d/0x360 fs/ioctl.c:144 ni_fiemap+0x878/0xc20 fs/ntfs3/frecord.c:1998 ntfs_fiemap+0xd7/0x130 fs/ntfs3/file.c:1236 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x1464/0x1de0 fs/ioctl.c:814 __do_sys_ioctl fs/ioctl.c:872 [inline] __se_sys_ioctl+0x83/0x170 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (&ni->file.run_lock){++++}-{3:3}: down_write+0x38/0x60 kernel/locking/rwsem.c:1551 ntfs_set_size+0x13c/0x1f0 fs/ntfs3/inode.c:844 ntfs_extend+0x15c/0x510 fs/ntfs3/file.c:434 ntfs3_setattr+0x2fa/0xc00 fs/ntfs3/file.c:774 notify_change+0xbcd/0xee0 fs/attr.c:505 do_truncate+0x197/0x220 fs/open.c:65 vfs_truncate+0x262/0x2f0 fs/open.c:111 do_sys_truncate+0xdc/0x190 fs/open.c:134 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&ni->ni_lock/5){+.+.}-{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+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline] attr_data_get_block+0x2df/0x1880 fs/ntfs3/attrib.c:849 ntfs_extend_initialized_size+0x2db/0x740 fs/ntfs3/file.c:125 ntfs_file_mmap+0x556/0x740 fs/ntfs3/file.c:405 call_mmap include/linux/fs.h:2177 [inline] mmap_file+0x5d/0xb0 mm/util.c:1092 __mmap_region mm/mmap.c:1796 [inline] mmap_region+0xf8f/0x1660 mm/mmap.c:2933 do_mmap+0x81f/0xea0 mm/mmap.c:1586 vm_mmap_pgoff+0x1b2/0x2b0 mm/util.c:551 ksys_mmap_pgoff+0x542/0x780 mm/mmap.c:1635 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: &ni->ni_lock/5 --> &ni->file.run_lock --> &mm->mmap_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock); lock(&ni->file.run_lock); lock(&mm->mmap_lock); lock(&ni->ni_lock/5); *** DEADLOCK *** 2 locks held by syz.7.1681/9720: #0: ffff888077f14e28 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline] #0: ffff888077f14e28 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x15d/0x2b0 mm/util.c:549 #1: ffff888074a72fe0 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:807 [inline] #1: ffff888074a72fe0 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: ntfs_file_mmap+0x516/0x740 fs/ntfs3/file.c:401 stack backtrace: CPU: 0 PID: 9720 Comm: syz.7.1681 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 check_noncircular+0x274/0x310 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+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline] attr_data_get_block+0x2df/0x1880 fs/ntfs3/attrib.c:849 ntfs_extend_initialized_size+0x2db/0x740 fs/ntfs3/file.c:125 ntfs_file_mmap+0x556/0x740 fs/ntfs3/file.c:405 call_mmap include/linux/fs.h:2177 [inline] mmap_file+0x5d/0xb0 mm/util.c:1092 __mmap_region mm/mmap.c:1796 [inline] mmap_region+0xf8f/0x1660 mm/mmap.c:2933 do_mmap+0x81f/0xea0 mm/mmap.c:1586 vm_mmap_pgoff+0x1b2/0x2b0 mm/util.c:551 ksys_mmap_pgoff+0x542/0x780 mm/mmap.c:1635 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f56a4522be9 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:00007f56a278a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007f56a4749fa0 RCX: 00007f56a4522be9 RDX: 00000000037ffff7 RSI: 0000000000004000 RDI: 0000200000237000 RBP: 00007f56a45a5e19 R08: 0000000000000004 R09: 00000000edb80000 R10: 0000000004012011 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f56a474a038 R14: 00007f56a4749fa0 R15: 00007ffecbc99228