====================================================== WARNING: possible circular locking dependency detected 5.15.166-syzkaller #0 Not tainted ------------------------------------------------------ syz.0.541/6373 is trying to acquire lock: ffff888061c238e0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] ffff888061c238e0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_fault+0x708/0x1470 mm/filemap.c:3081 but task is already holding lock: ffff88801ee9b228 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] ffff88801ee9b228 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1298 [inline] ffff88801ee9b228 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1445 [inline] ffff88801ee9b228 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x181/0x700 arch/x86/mm/fault.c:1501 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&mm->mmap_lock){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __might_fault+0xb4/0x110 mm/memory.c:5327 _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:1224 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 -> #2 (&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:844 ntfs_extend+0x15a/0x4c0 fs/ntfs3/file.c:431 ntfs_file_write_iter+0x2eb/0x540 fs/ntfs3/file.c:1138 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacd/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 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->ni_lock/4){+.+.}-{3:3}: 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:1100 [inline] ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:725 filemap_read_page+0x166/0x4b0 mm/filemap.c:2386 filemap_create_page mm/filemap.c:2506 [inline] filemap_get_pages mm/filemap.c:2558 [inline] filemap_read+0xfad/0x2980 mm/filemap.c:2634 call_read_iter include/linux/fs.h:2166 [inline] generic_file_splice_read+0x4ad/0x790 fs/splice.c:311 do_splice_to fs/splice.c:796 [inline] splice_direct_to_actor+0x448/0xc10 fs/splice.c:870 do_splice_direct+0x285/0x3d0 fs/splice.c:979 do_sendfile+0x622/0x1000 fs/read_write.c:1249 __do_sys_sendfile64 fs/read_write.c:1317 [inline] __se_sys_sendfile64+0x178/0x1e0 fs/read_write.c:1303 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 (mapping.invalidate_lock#3){.+.+}-{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 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_shared_fault mm/memory.c:4288 [inline] do_fault mm/memory.c:4366 [inline] handle_pte_fault mm/memory.c:4620 [inline] __handle_mm_fault mm/memory.c:4755 [inline] handle_mm_fault+0x275d/0x5960 mm/memory.c:4853 do_user_addr_fault arch/x86/mm/fault.c:1357 [inline] handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 other info that might help us debug this: Chain exists of: mapping.invalidate_lock#3 --> &ni->file.run_lock#3 --> &mm->mmap_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock); lock(&ni->file.run_lock#3); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#3); *** DEADLOCK *** 1 lock held by syz.0.541/6373: #0: ffff88801ee9b228 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] #0: ffff88801ee9b228 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1298 [inline] #0: ffff88801ee9b228 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1445 [inline] #0: ffff88801ee9b228 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x181/0x700 arch/x86/mm/fault.c:1501 stack backtrace: CPU: 1 PID: 6373 Comm: syz.0.541 Not tainted 5.15.166-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/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 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_shared_fault mm/memory.c:4288 [inline] do_fault mm/memory.c:4366 [inline] handle_pte_fault mm/memory.c:4620 [inline] __handle_mm_fault mm/memory.c:4755 [inline] handle_mm_fault+0x275d/0x5960 mm/memory.c:4853 do_user_addr_fault arch/x86/mm/fault.c:1357 [inline] handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 RIP: 0033:0x7f7804c4e0e4 Code: c0 08 0f b7 c0 48 8b 54 24 10 66 89 02 e9 71 fd ff ff 48 8b 44 24 08 48 85 c0 0f 85 6c fe ff ff 48 8b 44 24 10 0f b6 54 24 18 <88> 10 e9 52 fd ff ff 48 8b 44 24 20 48 0b 44 24 28 75 31 48 8b 54 RSP: 002b:00007ffc08748980 EFLAGS: 00010246 RAX: 0000000020000080 RBX: 0000000000000001 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000055557f8f53c8 RBP: 00007ffc08748a98 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000029b6d R13: 00007ffc08748ac0 R14: 0000000000000032 R15: fffffffffffffffe