====================================================== WARNING: possible circular locking dependency detected 5.15.173-syzkaller #0 Not tainted ------------------------------------------------------ syz.1.446/5826 is trying to acquire lock: ffff0000dda27700 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline] ffff0000dda27700 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_readpage+0x140/0x1c0 fs/ntfs3/inode.c:725 but task is already holding lock: ffff0000dda27b40 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] ffff0000dda27b40 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_update_page mm/filemap.c:2435 [inline] ffff0000dda27b40 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_get_pages mm/filemap.c:2574 [inline] ffff0000dda27b40 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_read+0x814/0x1bd8 mm/filemap.c:2634 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (mapping.invalidate_lock#8){.+.+}-{3:3}: down_read+0xc0/0x398 kernel/locking/rwsem.c:1498 filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] filemap_fault+0x52c/0xf5c mm/filemap.c:3081 __do_fault+0x120/0x5d0 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+0x21e8/0x33a8 mm/memory.c:4881 __do_page_fault arch/arm64/mm/fault.c:505 [inline] do_page_fault+0x700/0xb60 arch/arm64/mm/fault.c:605 do_translation_fault+0xe8/0x138 arch/arm64/mm/fault.c:686 do_mem_abort+0x70/0x1d8 arch/arm64/mm/fault.c:819 el1_abort+0x3c/0x5c arch/arm64/kernel/entry-common.c:358 el1h_64_sync_handler+0x60/0xac arch/arm64/kernel/entry-common.c:418 el1h_64_sync+0x78/0x7c arch/arm64/kernel/entry.S:522 fault_in_readable+0x308/0x56c mm/gup.c:1801 fault_in_iov_iter_readable+0x130/0x1b0 lib/iov_iter.c:460 generic_perform_write+0x198/0x520 mm/filemap.c:3775 __generic_file_write_iter+0x230/0x454 mm/filemap.c:3912 ntfs_file_write_iter+0x40c/0x49c fs/ntfs3/file.c:1143 call_write_iter include/linux/fs.h:2174 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x884/0xb44 fs/read_write.c:594 ksys_write+0x15c/0x26c fs/read_write.c:647 __do_sys_write fs/read_write.c:659 [inline] __se_sys_write fs/read_write.c:656 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:656 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #2 (&mm->mmap_lock){++++}-{3:3}: __might_fault+0xc8/0x128 mm/memory.c:5355 _copy_to_user include/linux/uaccess.h:174 [inline] copy_to_user include/linux/uaccess.h:200 [inline] fiemap_fill_next_extent+0x1b4/0x44c fs/ioctl.c:144 ni_fiemap+0x7dc/0xe10 fs/ntfs3/frecord.c:2019 ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1224 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x1bcc/0x2a38 fs/ioctl.c:814 __do_sys_ioctl fs/ioctl.c:872 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:860 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #1 (&ni->file.run_lock#3){++++}-{3:3}: down_write+0xbc/0x12c kernel/locking/rwsem.c:1551 ntfs_set_size+0x130/0x200 fs/ntfs3/inode.c:844 ntfs_extend+0x130/0x408 fs/ntfs3/file.c:431 ntfs_file_write_iter+0x2a0/0x49c fs/ntfs3/file.c:1138 do_iter_readv_writev+0x420/0x5f8 do_iter_write+0x1b8/0x66c fs/read_write.c:855 vfs_writev fs/read_write.c:928 [inline] do_pwritev+0x1ec/0x334 fs/read_write.c:1025 __do_sys_pwritev2 fs/read_write.c:1084 [inline] __se_sys_pwritev2 fs/read_write.c:1075 [inline] __arm64_sys_pwritev2+0xd4/0x108 fs/read_write.c:1075 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #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 kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623 __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline] ntfs_readpage+0x140/0x1c0 fs/ntfs3/inode.c:725 filemap_read_page+0x150/0x454 mm/filemap.c:2386 filemap_update_page mm/filemap.c:2464 [inline] filemap_get_pages mm/filemap.c:2574 [inline] filemap_read+0xe3c/0x1bd8 mm/filemap.c:2634 generic_file_read_iter+0xa0/0x3c4 mm/filemap.c:2794 ntfs_file_read_iter+0x184/0x1e0 fs/ntfs3/file.c:829 call_read_iter include/linux/fs.h:2168 [inline] new_sync_read fs/read_write.c:404 [inline] vfs_read+0x874/0xb18 fs/read_write.c:485 ksys_pread64 fs/read_write.c:675 [inline] __do_sys_pread64 fs/read_write.c:685 [inline] __se_sys_pread64 fs/read_write.c:682 [inline] __arm64_sys_pread64+0x188/0x220 fs/read_write.c:682 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 other info that might help us debug this: Chain exists of: &ni->ni_lock/5 --> &mm->mmap_lock --> mapping.invalidate_lock#8 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(mapping.invalidate_lock#8); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#8); lock(&ni->ni_lock/5); *** DEADLOCK *** 1 lock held by syz.1.446/5826: #0: ffff0000dda27b40 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline] #0: ffff0000dda27b40 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_update_page mm/filemap.c:2435 [inline] #0: ffff0000dda27b40 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_get_pages mm/filemap.c:2574 [inline] #0: ffff0000dda27b40 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_read+0x814/0x1bd8 mm/filemap.c:2634 stack backtrace: CPU: 1 PID: 5826 Comm: syz.1.446 Not tainted 5.15.173-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011 check_noncircular+0x2cc/0x378 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 kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623 __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline] ntfs_readpage+0x140/0x1c0 fs/ntfs3/inode.c:725 filemap_read_page+0x150/0x454 mm/filemap.c:2386 filemap_update_page mm/filemap.c:2464 [inline] filemap_get_pages mm/filemap.c:2574 [inline] filemap_read+0xe3c/0x1bd8 mm/filemap.c:2634 generic_file_read_iter+0xa0/0x3c4 mm/filemap.c:2794 ntfs_file_read_iter+0x184/0x1e0 fs/ntfs3/file.c:829 call_read_iter include/linux/fs.h:2168 [inline] new_sync_read fs/read_write.c:404 [inline] vfs_read+0x874/0xb18 fs/read_write.c:485 ksys_pread64 fs/read_write.c:675 [inline] __do_sys_pread64 fs/read_write.c:685 [inline] __se_sys_pread64 fs/read_write.c:682 [inline] __arm64_sys_pread64+0x188/0x220 fs/read_write.c:682 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584