====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc7-next-20240508-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/17985 is trying to acquire lock: ffff888050a62d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1123 [inline] ffff888050a62d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_read_folio+0x193/0x210 fs/ntfs3/inode.c:730 but task is already holding lock: ffff888050a63180 (mapping.invalidate_lock#5){++++}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:846 [inline] ffff888050a63180 (mapping.invalidate_lock#5){++++}-{3:3}, at: filemap_fault+0xaf4/0x16a0 mm/filemap.c:3321 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (mapping.invalidate_lock#5){++++}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1526 filemap_invalidate_lock_shared include/linux/fs.h:846 [inline] page_cache_ra_unbounded+0xf7/0x7f0 mm/readahead.c:225 do_sync_mmap_readahead+0x444/0x850 filemap_fault+0x7e8/0x16a0 mm/filemap.c:3314 __do_fault+0x135/0x460 mm/memory.c:4562 do_cow_fault mm/memory.c:4956 [inline] do_fault mm/memory.c:5058 [inline] do_pte_missing mm/memory.c:3903 [inline] handle_pte_fault+0xdc1/0x70f0 mm/memory.c:5380 __handle_mm_fault mm/memory.c:5523 [inline] handle_mm_fault+0x10df/0x1ba0 mm/memory.c:5688 faultin_page mm/gup.c:1290 [inline] __get_user_pages+0x6ef/0x1590 mm/gup.c:1589 __get_user_pages_locked mm/gup.c:1857 [inline] __gup_longterm_locked+0x4b0/0x2a80 mm/gup.c:2561 pin_user_pages+0x137/0x1f0 mm/gup.c:3647 xdp_umem_pin_pages net/xdp/xdp_umem.c:105 [inline] xdp_umem_reg net/xdp/xdp_umem.c:227 [inline] xdp_umem_create+0x955/0xf30 net/xdp/xdp_umem.c:260 xsk_setsockopt+0x732/0x950 net/xdp/xsk.c:1402 do_sock_setsockopt+0x3af/0x720 net/socket.c:2311 __sys_setsockopt+0x1ae/0x250 net/socket.c:2334 __do_sys_setsockopt net/socket.c:2343 [inline] __se_sys_setsockopt net/socket.c:2340 [inline] __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2340 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (&mm->mmap_lock){++++}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __might_fault+0xc6/0x120 mm/memory.c:6240 _copy_to_user+0x2a/0xb0 lib/usercopy.c:36 copy_to_user include/linux/uaccess.h:191 [inline] fiemap_fill_next_extent+0x235/0x410 fs/ioctl.c:145 ni_fiemap+0xa5e/0x1230 fs/ntfs3/frecord.c:2065 ntfs_fiemap+0x132/0x180 fs/ntfs3/file.c:1215 ioctl_fiemap fs/ioctl.c:220 [inline] do_vfs_ioctl+0x1c07/0x2e50 fs/ioctl.c:841 __do_sys_ioctl fs/ioctl.c:905 [inline] __se_sys_ioctl+0x81/0x170 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&indx->run_lock){.+.+}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1526 indx_read+0x2a5/0xc50 fs/ntfs3/index.c:1066 indx_find+0x47a/0xbf0 fs/ntfs3/index.c:1181 dir_search_u+0x1b7/0x3a0 fs/ntfs3/dir.c:254 ntfs_lookup+0x106/0x1f0 fs/ntfs3/namei.c:85 lookup_open fs/namei.c:3483 [inline] open_last_lookups fs/namei.c:3574 [inline] path_openat+0x1033/0x3280 fs/namei.c:3804 do_filp_open+0x235/0x490 fs/namei.c:3834 do_sys_openat2+0x13e/0x1d0 fs/open.c:1405 do_sys_open fs/open.c:1420 [inline] __do_sys_open fs/open.c:1428 [inline] __se_sys_open fs/open.c:1424 [inline] __x64_sys_open+0x225/0x270 fs/open.c:1424 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&ni->ni_lock/4){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 ni_lock fs/ntfs3/ntfs_fs.h:1123 [inline] ntfs_read_folio+0x193/0x210 fs/ntfs3/inode.c:730 filemap_read_folio+0x1a0/0x790 mm/filemap.c:2355 filemap_fault+0xed3/0x16a0 mm/filemap.c:3406 __do_fault+0x135/0x460 mm/memory.c:4562 do_read_fault mm/memory.c:4926 [inline] do_fault mm/memory.c:5056 [inline] do_pte_missing mm/memory.c:3903 [inline] handle_pte_fault+0x3d79/0x70f0 mm/memory.c:5380 __handle_mm_fault mm/memory.c:5523 [inline] handle_mm_fault+0x10df/0x1ba0 mm/memory.c:5688 do_user_addr_fault arch/x86/mm/fault.c:1389 [inline] handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x2b9/0x8c0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 rep_movs_alternative+0x30/0x70 arch/x86/lib/copy_user_64.S:50 copy_user_generic arch/x86/include/asm/uaccess_64.h:110 [inline] raw_copy_from_user arch/x86/include/asm/uaccess_64.h:125 [inline] _copy_from_user+0x8c/0xe0 lib/usercopy.c:23 copy_from_user include/linux/uaccess.h:183 [inline] copy_from_bpfptr_offset include/linux/bpfptr.h:53 [inline] copy_from_bpfptr include/linux/bpfptr.h:59 [inline] __sys_bpf+0x1a4/0x810 kernel/bpf/syscall.c:5660 __do_sys_bpf kernel/bpf/syscall.c:5794 [inline] __se_sys_bpf kernel/bpf/syscall.c:5792 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5792 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &ni->ni_lock/4 --> &mm->mmap_lock --> mapping.invalidate_lock#5 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(mapping.invalidate_lock#5); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#5); lock(&ni->ni_lock/4); *** DEADLOCK *** 1 lock held by syz-executor.1/17985: #0: ffff888050a63180 (mapping.invalidate_lock#5){++++}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:846 [inline] #0: ffff888050a63180 (mapping.invalidate_lock#5){++++}-{3:3}, at: filemap_fault+0xaf4/0x16a0 mm/filemap.c:3321 stack backtrace: CPU: 0 PID: 17985 Comm: syz-executor.1 Not tainted 6.9.0-rc7-next-20240508-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+0x241/0x360 lib/dump_stack.c:114 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 ni_lock fs/ntfs3/ntfs_fs.h:1123 [inline] ntfs_read_folio+0x193/0x210 fs/ntfs3/inode.c:730 filemap_read_folio+0x1a0/0x790 mm/filemap.c:2355 filemap_fault+0xed3/0x16a0 mm/filemap.c:3406 __do_fault+0x135/0x460 mm/memory.c:4562 do_read_fault mm/memory.c:4926 [inline] do_fault mm/memory.c:5056 [inline] do_pte_missing mm/memory.c:3903 [inline] handle_pte_fault+0x3d79/0x70f0 mm/memory.c:5380 __handle_mm_fault mm/memory.c:5523 [inline] handle_mm_fault+0x10df/0x1ba0 mm/memory.c:5688 do_user_addr_fault arch/x86/mm/fault.c:1389 [inline] handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x2b9/0x8c0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0010:rep_movs_alternative+0x30/0x70 arch/x86/lib/copy_user_64.S:57 Code: f9 40 73 40 83 f9 08 73 21 85 c9 74 0f 8a 06 88 07 48 ff c7 48 ff c6 48 ff c9 75 f1 c3 cc cc cc cc 66 0f 1f 84 00 00 00 00 00 <48> 8b 06 48 89 07 48 83 c6 08 48 83 c7 08 83 e9 08 74 df 83 f9 08 RSP: 0018:ffffc9000a05fd30 EFLAGS: 00050212 RAX: ffffffff84afdf01 RBX: 0000000020000190 RCX: 0000000000000010 RDX: 0000000000000001 RSI: 0000000020000180 RDI: ffffc9000a05fda0 RBP: ffffc9000a05fed8 R08: ffffc9000a05fdaf R09: 1ffff9200140bfb5 R10: dffffc0000000000 R11: fffff5200140bfb6 R12: 0000000020000180 R13: ffffc9000a05fda0 R14: ffffc9000a05fda0 R15: 0000000000000010 copy_user_generic arch/x86/include/asm/uaccess_64.h:110 [inline] raw_copy_from_user arch/x86/include/asm/uaccess_64.h:125 [inline] _copy_from_user+0x8c/0xe0 lib/usercopy.c:23 copy_from_user include/linux/uaccess.h:183 [inline] copy_from_bpfptr_offset include/linux/bpfptr.h:53 [inline] copy_from_bpfptr include/linux/bpfptr.h:59 [inline] __sys_bpf+0x1a4/0x810 kernel/bpf/syscall.c:5660 __do_sys_bpf kernel/bpf/syscall.c:5794 [inline] __se_sys_bpf kernel/bpf/syscall.c:5792 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5792 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f1cc547dd69 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:00007f1cc62970c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f1cc55abf80 RCX: 00007f1cc547dd69 RDX: 0000000000000010 RSI: 0000000020000180 RDI: 0000000000000011 RBP: 00007f1cc54ca49e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f1cc55abf80 R15: 00007fffdd01e748 ---------------- Code disassembly (best guess): 0: f9 stc 1: 40 73 40 rex jae 0x44 4: 83 f9 08 cmp $0x8,%ecx 7: 73 21 jae 0x2a 9: 85 c9 test %ecx,%ecx b: 74 0f je 0x1c d: 8a 06 mov (%rsi),%al f: 88 07 mov %al,(%rdi) 11: 48 ff c7 inc %rdi 14: 48 ff c6 inc %rsi 17: 48 ff c9 dec %rcx 1a: 75 f1 jne 0xd 1c: c3 ret 1d: cc int3 1e: cc int3 1f: cc int3 20: cc int3 21: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1) 28: 00 00 * 2a: 48 8b 06 mov (%rsi),%rax <-- trapping instruction 2d: 48 89 07 mov %rax,(%rdi) 30: 48 83 c6 08 add $0x8,%rsi 34: 48 83 c7 08 add $0x8,%rdi 38: 83 e9 08 sub $0x8,%ecx 3b: 74 df je 0x1c 3d: 83 f9 08 cmp $0x8,%ecx