======================================================
WARNING: possible circular locking dependency detected
6.1.21-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/31972 is trying to acquire lock:
ffff88801d434c58 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x8f/0x110 mm/memory.c:5640

but task is already holding lock:
ffff8880418b97d0 (&ni->file.run_lock){++++}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1956

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&ni->file.run_lock){++++}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       down_write+0x36/0x60 kernel/locking/rwsem.c:1573
       attr_data_get_block+0x433/0x2520 fs/ntfs3/attrib.c:922
       ntfs_get_block_vbo+0x373/0xe60 fs/ntfs3/inode.c:580
       do_mpage_readpage+0x8d2/0x2040 fs/mpage.c:208
       mpage_read_folio+0x104/0x1d0 fs/mpage.c:379
       filemap_read_folio+0x199/0x780 mm/filemap.c:2407
       do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3535
       do_read_cache_page+0x32/0x220 mm/filemap.c:3577
       read_mapping_page include/linux/pagemap.h:756 [inline]
       ntfs_map_page+0x1d/0x60 fs/ntfs3/ntfs_fs.h:899
       ntfs_fill_super+0x3e3f/0x4500 fs/ntfs3/super.c:1210
       get_tree_bdev+0x3fe/0x620 fs/super.c:1337
       vfs_get_tree+0x88/0x270 fs/super.c:1544
       do_new_mount+0x28b/0xad0 fs/namespace.c:3040
       do_mount fs/namespace.c:3383 [inline]
       __do_sys_mount fs/namespace.c:3591 [inline]
       __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568
       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

-> #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+0x9ae/0x1230 fs/ntfs3/frecord.c:2039
       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:

Chain exists of:
  &mm->mmap_lock#2 --> &ni->ni_lock/4 --> &ni->file.run_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ni->file.run_lock);
                               lock(&ni->ni_lock/4);
                               lock(&ni->file.run_lock);
  lock(&mm->mmap_lock#2);

 *** DEADLOCK ***

2 locks held by syz-executor.1/31972:
 #0: ffff8880418b9720 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
 #0: ffff8880418b9720 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xfb/0x170 fs/ntfs3/file.c:1243
 #1: ffff8880418b97d0 (&ni->file.run_lock){++++}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1956

stack backtrace:
CPU: 1 PID: 31972 Comm: syz-executor.1 Not tainted 6.1.21-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/17/2023
Call Trace:
 <TASK>
 __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+0x9ae/0x1230 fs/ntfs3/frecord.c:2039
 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:0x7ff350e8c0f9
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:00007ff351b39168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ff350fabf80 RCX: 00007ff350e8c0f9
RDX: 0000000020000100 RSI: 00000000c020660b RDI: 0000000000000004
RBP: 00007ff350ee7b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdfc7de21f R14: 00007ff351b39300 R15: 0000000000022000
 </TASK>