====================================================== WARNING: possible circular locking dependency detected 5.15.173-syzkaller #0 Not tainted ------------------------------------------------------ syz.6.613/8022 is trying to acquire lock: ffff88805ca0c360 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline] ffff88805ca0c360 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:725 but task is already holding lock: ffff88805ca0c7a0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] ffff88805ca0c7a0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_update_page mm/filemap.c:2435 [inline] ffff88805ca0c7a0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_get_pages mm/filemap.c:2574 [inline] ffff88805ca0c7a0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_read+0xaef/0x2980 mm/filemap.c:2634 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (mapping.invalidate_lock#3){.+.+}-{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:3926 do_read_fault mm/memory.c:4262 [inline] do_fault mm/memory.c:4390 [inline] handle_pte_fault mm/memory.c:4648 [inline] __handle_mm_fault mm/memory.c:4783 [inline] handle_mm_fault+0x376f/0x5960 mm/memory.c:4881 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:606 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] __do_sys_prlimit64 kernel/sys.c:1676 [inline] __se_sys_prlimit64+0x128/0xb40 kernel/sys.c:1662 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:5355 _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:2019 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 -> #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: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:2174 [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 -> #0 (&ni->ni_lock/5){+.+.}-{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:1100 [inline] ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:725 filemap_read_page+0x166/0x4b0 mm/filemap.c:2386 filemap_update_page mm/filemap.c:2464 [inline] filemap_get_pages mm/filemap.c:2574 [inline] filemap_read+0x15dc/0x2980 mm/filemap.c:2634 call_read_iter include/linux/fs.h:2168 [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 generic_copy_file_range fs/read_write.c:1385 [inline] vfs_copy_file_range+0xb63/0x14e0 fs/read_write.c:1531 __do_sys_copy_file_range fs/read_write.c:1588 [inline] __se_sys_copy_file_range+0x3ea/0x5d0 fs/read_write.c:1551 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/5 --> &mm->mmap_lock --> mapping.invalidate_lock#3 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(mapping.invalidate_lock#3); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#3); lock(&ni->ni_lock/5); *** DEADLOCK *** 2 locks held by syz.6.613/8022: #0: ffff8880769c4460 (sb_writers#13){.+.+}-{0:0}, at: vfs_copy_file_range+0x923/0x14e0 fs/read_write.c:1494 #1: ffff88805ca0c7a0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] #1: ffff88805ca0c7a0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_update_page mm/filemap.c:2435 [inline] #1: ffff88805ca0c7a0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_get_pages mm/filemap.c:2574 [inline] #1: ffff88805ca0c7a0 (mapping.invalidate_lock#3){.+.+}-{3:3}, at: filemap_read+0xaef/0x2980 mm/filemap.c:2634 stack backtrace: CPU: 0 PID: 8022 Comm: syz.6.613 Not tainted 5.15.173-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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:1100 [inline] ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:725 filemap_read_page+0x166/0x4b0 mm/filemap.c:2386 filemap_update_page mm/filemap.c:2464 [inline] filemap_get_pages mm/filemap.c:2574 [inline] filemap_read+0x15dc/0x2980 mm/filemap.c:2634 call_read_iter include/linux/fs.h:2168 [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 generic_copy_file_range fs/read_write.c:1385 [inline] vfs_copy_file_range+0xb63/0x14e0 fs/read_write.c:1531 __do_sys_copy_file_range fs/read_write.c:1588 [inline] __se_sys_copy_file_range+0x3ea/0x5d0 fs/read_write.c:1551 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:0x7f69446edf19 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6942564058 EFLAGS: 00000246 ORIG_RAX: 0000000000000146 RAX: ffffffffffffffda RBX: 00007f69448b3fa0 RCX: 00007f69446edf19 RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 00007f6944761cc8 R08: ffffffffa003e459 R09: 0700000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f69448b3fa0 R15: 00007ffcddab3078