====================================================== WARNING: possible circular locking dependency detected 5.15.159-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/13668 is trying to acquire lock: ffff8880553cbc00 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1098 [inline] ffff8880553cbc00 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:724 but task is already holding lock: ffff8880553cc040 (mapping.invalidate_lock#13){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] ffff8880553cc040 (mapping.invalidate_lock#13){.+.+}-{3:3}, at: filemap_fault+0x8df/0x1470 mm/filemap.c:3096 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (mapping.invalidate_lock#13){.+.+}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498 filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] filemap_fault+0x708/0x1470 mm/filemap.c:3081 __do_fault+0x139/0x340 mm/memory.c:3898 do_read_fault mm/memory.c:4234 [inline] do_fault mm/memory.c:4362 [inline] handle_pte_fault mm/memory.c:4621 [inline] __handle_mm_fault mm/memory.c:4756 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4854 do_user_addr_fault arch/x86/mm/fault.c:1388 [inline] handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x271/0x740 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 strncpy_from_user+0x170/0x370 lib/strncpy_from_user.c:139 getname_flags+0xf5/0x4e0 fs/namei.c:149 getname fs/namei.c:217 [inline] __do_sys_mkdirat fs/namei.c:4105 [inline] __se_sys_mkdirat fs/namei.c:4103 [inline] __x64_sys_mkdirat+0x78/0x90 fs/namei.c:4103 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #2 (&mm->mmap_lock){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __might_fault+0xb4/0x110 mm/memory.c:5328 _copy_to_user+0x28/0x130 lib/usercopy.c:35 copy_to_user include/linux/uaccess.h:200 [inline] fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144 ni_fiemap+0x9ae/0x1230 fs/ntfs3/frecord.c:1996 ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1227 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x1934/0x2b70 fs/ioctl.c:814 __do_sys_ioctl fs/ioctl.c:872 [inline] __se_sys_ioctl+0x81/0x160 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (&ni->file.run_lock#3){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 down_write+0x38/0x60 kernel/locking/rwsem.c:1551 ntfs_truncate fs/ntfs3/file.c:495 [inline] ntfs3_setattr+0x55c/0xb70 fs/ntfs3/file.c:771 notify_change+0xc6d/0xf50 fs/attr.c:505 do_truncate+0x21c/0x300 fs/open.c:65 handle_truncate fs/namei.c:3265 [inline] do_open fs/namei.c:3612 [inline] path_openat+0x28a3/0x2f20 fs/namei.c:3742 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13b/0x500 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1280 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&ni->ni_lock/4){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 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:1098 [inline] ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:724 filemap_read_page+0x166/0x4b0 mm/filemap.c:2386 filemap_fault+0xdd0/0x1470 mm/filemap.c:3174 __do_fault+0x139/0x340 mm/memory.c:3898 do_read_fault mm/memory.c:4234 [inline] do_fault mm/memory.c:4362 [inline] handle_pte_fault mm/memory.c:4621 [inline] __handle_mm_fault mm/memory.c:4756 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4854 do_user_addr_fault arch/x86/mm/fault.c:1388 [inline] handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x271/0x740 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:90 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline] raw_copy_from_user arch/x86/include/asm/uaccess_64.h:52 [inline] _copy_from_user+0xf9/0x170 lib/usercopy.c:23 copy_from_user include/linux/uaccess.h:192 [inline] copy_iovec_from_user lib/iov_iter.c:1892 [inline] iovec_from_user+0x13b/0x390 lib/iov_iter.c:1927 __import_iovec+0x72/0x4b0 lib/iov_iter.c:1945 import_iovec+0xe6/0x120 lib/iov_iter.c:2010 process_vm_rw+0x18a/0xcc0 mm/process_vm_access.c:272 __do_sys_process_vm_readv mm/process_vm_access.c:295 [inline] __se_sys_process_vm_readv mm/process_vm_access.c:291 [inline] __x64_sys_process_vm_readv+0xdc/0xf0 mm/process_vm_access.c:291 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 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/4 --> &mm->mmap_lock --> mapping.invalidate_lock#13 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(mapping.invalidate_lock#13); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#13); lock(&ni->ni_lock/4); *** DEADLOCK *** 1 lock held by syz-executor.3/13668: #0: ffff8880553cc040 (mapping.invalidate_lock#13){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] #0: ffff8880553cc040 (mapping.invalidate_lock#13){.+.+}-{3:3}, at: filemap_fault+0x8df/0x1470 mm/filemap.c:3096 stack backtrace: CPU: 1 PID: 13668 Comm: syz-executor.3 Not tainted 5.15.159-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 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+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 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:1098 [inline] ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:724 filemap_read_page+0x166/0x4b0 mm/filemap.c:2386 filemap_fault+0xdd0/0x1470 mm/filemap.c:3174 __do_fault+0x139/0x340 mm/memory.c:3898 do_read_fault mm/memory.c:4234 [inline] do_fault mm/memory.c:4362 [inline] handle_pte_fault mm/memory.c:4621 [inline] __handle_mm_fault mm/memory.c:4756 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4854 do_user_addr_fault arch/x86/mm/fault.c:1388 [inline] handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x271/0x740 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 RIP: 0010:copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:91 Code: 4c 8b 5e 38 4c 89 47 20 4c 89 4f 28 4c 89 57 30 4c 89 5f 38 48 8d 76 40 48 8d 7f 40 ff c9 75 b6 89 d1 83 e2 07 c1 e9 03 74 12 <4c> 8b 06 4c 89 07 48 8d 76 08 48 8d 7f 08 ff c9 75 ee 21 d2 74 10 RSP: 0018:ffffc900030c79e0 EFLAGS: 00050202 RAX: ffffffff8408dd01 RBX: 0000000020000210 RCX: 0000000000000002 RDX: 0000000000000000 RSI: 0000000020000200 RDI: ffffc900030c7cd0 RBP: 0000000000000010 R08: dffffc0000000000 R09: fffff52000618f9c R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000010 R13: 00007ffffffff000 R14: ffffc900030c7cd0 R15: 0000000020000200 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline] raw_copy_from_user arch/x86/include/asm/uaccess_64.h:52 [inline] _copy_from_user+0xf9/0x170 lib/usercopy.c:23 copy_from_user include/linux/uaccess.h:192 [inline] copy_iovec_from_user lib/iov_iter.c:1892 [inline] iovec_from_user+0x13b/0x390 lib/iov_iter.c:1927 __import_iovec+0x72/0x4b0 lib/iov_iter.c:1945 import_iovec+0xe6/0x120 lib/iov_iter.c:2010 process_vm_rw+0x18a/0xcc0 mm/process_vm_access.c:272 __do_sys_process_vm_readv mm/process_vm_access.c:295 [inline] __se_sys_process_vm_readv mm/process_vm_access.c:291 [inline] __x64_sys_process_vm_readv+0xdc/0xf0 mm/process_vm_access.c:291 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7ffa0c947ee9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffa0ae9a0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000136 RAX: ffffffffffffffda RBX: 00007ffa0ca77050 RCX: 00007ffa0c947ee9 RDX: 0000000000000001 RSI: 0000000020000200 RDI: 0000000000000000 RBP: 00007ffa0c99449e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007ffa0ca77050 R15: 00007ffc188b5518 ---------------- Code disassembly (best guess): 0: 4c 8b 5e 38 mov 0x38(%rsi),%r11 4: 4c 89 47 20 mov %r8,0x20(%rdi) 8: 4c 89 4f 28 mov %r9,0x28(%rdi) c: 4c 89 57 30 mov %r10,0x30(%rdi) 10: 4c 89 5f 38 mov %r11,0x38(%rdi) 14: 48 8d 76 40 lea 0x40(%rsi),%rsi 18: 48 8d 7f 40 lea 0x40(%rdi),%rdi 1c: ff c9 dec %ecx 1e: 75 b6 jne 0xffffffd6 20: 89 d1 mov %edx,%ecx 22: 83 e2 07 and $0x7,%edx 25: c1 e9 03 shr $0x3,%ecx 28: 74 12 je 0x3c * 2a: 4c 8b 06 mov (%rsi),%r8 <-- trapping instruction 2d: 4c 89 07 mov %r8,(%rdi) 30: 48 8d 76 08 lea 0x8(%rsi),%rsi 34: 48 8d 7f 08 lea 0x8(%rdi),%rdi 38: ff c9 dec %ecx 3a: 75 ee jne 0x2a 3c: 21 d2 and %edx,%edx 3e: 74 10 je 0x50