====================================================== WARNING: possible circular locking dependency detected 6.1.97-syzkaller #0 Not tainted ------------------------------------------------------ syz.4.239/5025 is trying to acquire lock: ffff0000dfbec040 (mapping.invalidate_lock#4){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:813 [inline] ffff0000dfbec040 (mapping.invalidate_lock#4){.+.+}-{3:3}, at: filemap_fault+0x58c/0xf7c mm/filemap.c:3191 but task is already holding lock: ffff0000d47a8d48 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] ffff0000d47a8d48 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5304 [inline] ffff0000d47a8d48 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x38/0x2e8 mm/memory.c:5366 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&mm->mmap_lock){++++}-{3:3}: __might_fault+0xc4/0x124 mm/memory.c:5835 _copy_to_user include/linux/uaccess.h:143 [inline] copy_to_user include/linux/uaccess.h:169 [inline] fiemap_fill_next_extent+0x1b4/0x424 fs/ioctl.c:144 ni_fiemap+0x744/0xe10 fs/ntfs3/frecord.c:2045 ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1247 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x194c/0x26f8 fs/ioctl.c:810 __do_sys_ioctl fs/ioctl.c:868 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #2 (&ni->file.run_lock){.+.+}-{3:3}: down_read+0x64/0x308 kernel/locking/rwsem.c:1520 ni_fiemap+0x2c4/0xe10 fs/ntfs3/frecord.c:1962 ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1247 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x194c/0x26f8 fs/ioctl.c:810 __do_sys_ioctl fs/ioctl.c:868 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #1 (&ni->ni_lock/4){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 ni_lock fs/ntfs3/ntfs_fs.h:1099 [inline] attr_data_get_block+0x330/0x1bdc fs/ntfs3/attrib.c:921 ntfs_get_block_vbo+0x2f4/0xd14 fs/ntfs3/inode.c:591 ntfs_get_block+0x84/0xc4 fs/ntfs3/inode.c:687 do_mpage_readpage+0x5d8/0x1748 fs/mpage.c:208 mpage_readahead+0x360/0x644 fs/mpage.c:361 ntfs_readahead+0x1a4/0x1f4 fs/ntfs3/inode.c:760 read_pages+0x168/0x6a0 mm/readahead.c:161 page_cache_ra_unbounded+0x14c/0x58c mm/readahead.c:242 do_page_cache_ra mm/readahead.c:300 [inline] page_cache_ra_order+0x850/0xa74 mm/readahead.c:564 do_sync_mmap_readahead+0x3a4/0x844 filemap_fault+0x604/0xf7c mm/filemap.c:3199 __do_fault+0x11c/0x3d8 mm/memory.c:4261 do_read_fault mm/memory.c:4612 [inline] do_fault mm/memory.c:4741 [inline] handle_pte_fault mm/memory.c:5013 [inline] __handle_mm_fault mm/memory.c:5155 [inline] handle_mm_fault+0x1f90/0x3ef0 mm/memory.c:5276 __do_page_fault arch/arm64/mm/fault.c:499 [inline] do_page_fault+0x330/0x890 arch/arm64/mm/fault.c:583 do_translation_fault+0x94/0xc8 arch/arm64/mm/fault.c:667 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:803 el1_abort+0x3c/0x5c arch/arm64/kernel/entry-common.c:367 el1h_64_sync_handler+0x60/0xac arch/arm64/kernel/entry-common.c:427 el1h_64_sync+0x64/0x68 arch/arm64/kernel/entry.S:580 fault_in_readable+0x370/0x5f0 mm/gup.c:1898 fault_in_iov_iter_readable+0xcc/0x22c lib/iov_iter.c:356 generic_perform_write+0x1c8/0x55c mm/filemap.c:3807 __generic_file_write_iter+0x168/0x388 mm/filemap.c:3945 ntfs_file_write_iter+0x4d4/0x580 fs/ntfs3/file.c:1166 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x610/0x914 fs/read_write.c:584 ksys_write+0x15c/0x26c fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:646 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #0 (mapping.invalidate_lock#4){.+.+}-{3:3}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 down_read+0x64/0x308 kernel/locking/rwsem.c:1520 filemap_invalidate_lock_shared include/linux/fs.h:813 [inline] filemap_fault+0x58c/0xf7c mm/filemap.c:3191 __do_fault+0x11c/0x3d8 mm/memory.c:4261 do_read_fault mm/memory.c:4612 [inline] do_fault mm/memory.c:4741 [inline] handle_pte_fault mm/memory.c:5013 [inline] __handle_mm_fault mm/memory.c:5155 [inline] handle_mm_fault+0x1f90/0x3ef0 mm/memory.c:5276 __do_page_fault arch/arm64/mm/fault.c:499 [inline] do_page_fault+0x330/0x890 arch/arm64/mm/fault.c:583 do_translation_fault+0x94/0xc8 arch/arm64/mm/fault.c:667 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:803 el1_abort+0x3c/0x5c arch/arm64/kernel/entry-common.c:367 el1h_64_sync_handler+0x60/0xac arch/arm64/kernel/entry-common.c:427 el1h_64_sync+0x64/0x68 arch/arm64/kernel/entry.S:580 fault_in_readable+0x370/0x5f0 mm/gup.c:1898 fault_in_iov_iter_readable+0xcc/0x22c lib/iov_iter.c:356 generic_perform_write+0x1c8/0x55c mm/filemap.c:3807 __generic_file_write_iter+0x168/0x388 mm/filemap.c:3945 ntfs_file_write_iter+0x4d4/0x580 fs/ntfs3/file.c:1166 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x610/0x914 fs/read_write.c:584 ksys_write+0x15c/0x26c fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:646 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 other info that might help us debug this: Chain exists of: mapping.invalidate_lock#4 --> &ni->file.run_lock --> &mm->mmap_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock); lock(&ni->file.run_lock); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#4); *** DEADLOCK *** 4 locks held by syz.4.239/5025: #0: ffff0000d95dc5e8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x124/0x16c fs/file.c:1062 #1: ffff0000eff7a460 (sb_writers#19){.+.+}-{0:0}, at: vfs_write+0x244/0x914 fs/read_write.c:580 #2: ffff0000dfbebea0 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:778 [inline] #2: ffff0000dfbebea0 (&sb->s_type->i_mutex_key#27){+.+.}-{3:3}, at: ntfs_file_write_iter+0x190/0x580 fs/ntfs3/file.c:1145 #3: ffff0000d47a8d48 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] #3: ffff0000d47a8d48 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5304 [inline] #3: ffff0000d47a8d48 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x38/0x2e8 mm/memory.c:5366 stack backtrace: CPU: 0 PID: 5025 Comm: syz.4.239 Not tainted 6.1.97-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x5c lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2170 check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 down_read+0x64/0x308 kernel/locking/rwsem.c:1520 filemap_invalidate_lock_shared include/linux/fs.h:813 [inline] filemap_fault+0x58c/0xf7c mm/filemap.c:3191 __do_fault+0x11c/0x3d8 mm/memory.c:4261 do_read_fault mm/memory.c:4612 [inline] do_fault mm/memory.c:4741 [inline] handle_pte_fault mm/memory.c:5013 [inline] __handle_mm_fault mm/memory.c:5155 [inline] handle_mm_fault+0x1f90/0x3ef0 mm/memory.c:5276 __do_page_fault arch/arm64/mm/fault.c:499 [inline] do_page_fault+0x330/0x890 arch/arm64/mm/fault.c:583 do_translation_fault+0x94/0xc8 arch/arm64/mm/fault.c:667 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:803 el1_abort+0x3c/0x5c arch/arm64/kernel/entry-common.c:367 el1h_64_sync_handler+0x60/0xac arch/arm64/kernel/entry-common.c:427 el1h_64_sync+0x64/0x68 arch/arm64/kernel/entry.S:580 fault_in_readable+0x370/0x5f0 mm/gup.c:1898 fault_in_iov_iter_readable+0xcc/0x22c lib/iov_iter.c:356 generic_perform_write+0x1c8/0x55c mm/filemap.c:3807 __generic_file_write_iter+0x168/0x388 mm/filemap.c:3945 ntfs_file_write_iter+0x4d4/0x580 fs/ntfs3/file.c:1166 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x610/0x914 fs/read_write.c:584 ksys_write+0x15c/0x26c fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:646 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585