====================================================== WARNING: possible circular locking dependency detected 5.15.159-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/8191 is trying to acquire lock: ffff8880555734a0 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1098 [inline] ffff8880555734a0 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:724 but task is already holding lock: ffff8880555738e0 (mapping.invalidate_lock#9){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] ffff8880555738e0 (mapping.invalidate_lock#9){.+.+}-{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#9){.+.+}-{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 do_sys_openat2+0xd2/0x500 fs/open.c:1247 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 -> #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+0xa5a/0x1230 fs/ntfs3/frecord.c:2017 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_set_size+0x139/0x1f0 fs/ntfs3/inode.c:843 ntfs_fallocate+0x36f/0xee0 fs/ntfs3/file.c:670 vfs_fallocate+0x54a/0x6b0 fs/open.c:308 ksys_fallocate fs/open.c:331 [inline] __do_sys_fallocate fs/open.c:339 [inline] __se_sys_fallocate fs/open.c:337 [inline] __x64_sys_fallocate+0xb9/0x100 fs/open.c:337 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_from_bpfptr_offset include/linux/bpfptr.h:52 [inline] copy_from_bpfptr include/linux/bpfptr.h:58 [inline] __sys_bpf+0x1d5/0x670 kernel/bpf/syscall.c:4624 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline] __se_sys_bpf kernel/bpf/syscall.c:4753 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753 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#9 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(mapping.invalidate_lock#9); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#9); lock(&ni->ni_lock/4); *** DEADLOCK *** 1 lock held by syz-executor.4/8191: #0: ffff8880555738e0 (mapping.invalidate_lock#9){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] #0: ffff8880555738e0 (mapping.invalidate_lock#9){.+.+}-{3:3}, at: filemap_fault+0x8df/0x1470 mm/filemap.c:3096 stack backtrace: CPU: 1 PID: 8191 Comm: syz-executor.4 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:ffffc90002ea7d88 EFLAGS: 00050202 RAX: ffffffff8408dd01 RBX: 0000000020000190 RCX: 0000000000000002 RDX: 0000000000000000 RSI: 0000000020000180 RDI: ffffc90002ea7e00 RBP: ffffc90002ea7ef8 R08: dffffc0000000000 R09: fffff520005d4fc2 R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000010 R13: 00007ffffffff000 R14: ffffc90002ea7e00 R15: 0000000020000180 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_from_bpfptr_offset include/linux/bpfptr.h:52 [inline] copy_from_bpfptr include/linux/bpfptr.h:58 [inline] __sys_bpf+0x1d5/0x670 kernel/bpf/syscall.c:4624 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline] __se_sys_bpf kernel/bpf/syscall.c:4753 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753 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:0x7f59adcb1ee9 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:00007f59ac2250c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f59adde0f80 RCX: 00007f59adcb1ee9 RDX: 0000000000000010 RSI: 0000000020000180 RDI: 0000000000000011 RBP: 00007f59adcfe49e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f59adde0f80 R15: 00007ffc9e36f878 ---------------- 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