ntfs3: loop2: Different NTFS' sector size (2048) and media sector size (512) ====================================================== WARNING: possible circular locking dependency detected 6.1.21-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/5726 is trying to acquire lock: ffff888074d41058 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x8f/0x110 mm/memory.c:5640 but task is already holding lock: ffff888071358860 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline] ffff888071358860 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xfb/0x170 fs/ntfs3/file.c:1243 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ni->ni_lock/4){+.+.}-{3:3}: lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799 ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline] attr_data_get_block+0x429/0x2520 fs/ntfs3/attrib.c:921 ntfs_file_mmap+0x452/0x7e0 fs/ntfs3/file.c:387 call_mmap include/linux/fs.h:2210 [inline] mmap_region+0xf96/0x1fa0 mm/mmap.c:2625 do_mmap+0x8c5/0xf60 mm/mmap.c:1411 vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:520 ksys_mmap_pgoff+0x4f5/0x6d0 mm/mmap.c:1457 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&mm->mmap_lock#2){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669 __might_fault+0xb2/0x110 mm/memory.c:5641 _copy_to_user+0x26/0x130 lib/usercopy.c:36 copy_to_user include/linux/uaccess.h:169 [inline] fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144 ni_fiemap+0x1007/0x1230 fs/ntfs3/frecord.c:1943 ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1245 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810 __do_sys_ioctl fs/ioctl.c:868 [inline] __se_sys_ioctl+0x81/0x160 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ni->ni_lock/4); lock(&mm->mmap_lock#2); lock(&ni->ni_lock/4); lock(&mm->mmap_lock#2); *** DEADLOCK *** 1 lock held by syz-executor.2/5726: #0: ffff888071358860 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline] #0: ffff888071358860 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xfb/0x170 fs/ntfs3/file.c:1243 stack backtrace: CPU: 1 PID: 5726 Comm: syz-executor.2 Not tainted 6.1.21-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669 __might_fault+0xb2/0x110 mm/memory.c:5641 _copy_to_user+0x26/0x130 lib/usercopy.c:36 copy_to_user include/linux/uaccess.h:169 [inline] fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144 ni_fiemap+0x1007/0x1230 fs/ntfs3/frecord.c:1943 ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1245 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810 __do_sys_ioctl fs/ioctl.c:868 [inline] __se_sys_ioctl+0x81/0x160 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f2323e8c0f9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2324b55168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f2323fabf80 RCX: 00007f2323e8c0f9 RDX: 0000000020000440 RSI: 00000000c020660b RDI: 0000000000000004 RBP: 00007f2323ee7b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff2cf6f4af R14: 00007f2324b55300 R15: 0000000000022000