====================================================== WARNING: possible circular locking dependency detected 5.15.106-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/5931 is trying to acquire lock: ffff0000d0c07760 (mapping.invalidate_lock#4){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:842 [inline] ffff0000d0c07760 (mapping.invalidate_lock#4){.+.+}-{3:3}, at: filemap_fault+0x52c/0xf5c mm/filemap.c:3072 but task is already holding lock: ffff0000d1d6c618 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] ffff0000d1d6c618 (&mm->mmap_lock){++++}-{3:3}, at: do_page_fault+0x380/0xb60 arch/arm64/mm/fault.c:586 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&mm->mmap_lock){++++}-{3:3}: __might_fault+0xc8/0x128 mm/memory.c:5297 filldir64+0x2bc/0x9e4 fs/readdir.c:335 dir_emit_dot include/linux/fs.h:3605 [inline] hfsplus_readdir+0x398/0xf68 fs/hfsplus/dir.c:159 iterate_dir+0x1f4/0x4e4 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64 fs/readdir.c:354 [inline] __arm64_sys_getdents64+0x1c4/0x4c4 fs/readdir.c:354 __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:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #2 (&tree->tree_lock){+.+.}-{3:3}: __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 hfsplus_file_truncate+0x6d4/0x9cc fs/hfsplus/extents.c:595 hfsplus_setattr+0x18c/0x25c fs/hfsplus/inode.c:267 notify_change+0xac4/0xd60 fs/attr.c:488 do_truncate+0x1c0/0x28c fs/open.c:65 do_sys_ftruncate+0x288/0x31c fs/open.c:193 __do_sys_ftruncate fs/open.c:204 [inline] __se_sys_ftruncate fs/open.c:202 [inline] __arm64_sys_ftruncate+0x60/0x74 fs/open.c:202 __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:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: __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 hfsplus_get_block+0x2c4/0x1194 fs/hfsplus/extents.c:260 block_read_full_page+0x2a0/0xc4c fs/buffer.c:2290 hfsplus_readpage+0x28/0x38 fs/hfsplus/inode.c:28 read_pages+0x298/0x420 mm/readahead.c:145 page_cache_ra_unbounded+0x534/0x654 mm/readahead.c:239 do_page_cache_ra mm/readahead.c:269 [inline] ondemand_readahead+0x62c/0xd0c mm/readahead.c:552 page_cache_sync_ra+0x130/0x180 mm/readahead.c:580 page_cache_sync_readahead include/linux/pagemap.h:833 [inline] filemap_get_pages mm/filemap.c:2551 [inline] filemap_read+0x52c/0x1bd4 mm/filemap.c:2634 generic_file_read_iter+0xa0/0x3c4 mm/filemap.c:2785 __kernel_read+0x488/0x8b0 fs/read_write.c:443 kernel_read+0xd8/0x1d4 fs/read_write.c:461 prepare_binprm fs/exec.c:1664 [inline] search_binary_handler fs/exec.c:1718 [inline] exec_binprm fs/exec.c:1775 [inline] bprm_execve+0x740/0x1578 fs/exec.c:1844 do_execveat_common+0x668/0x814 fs/exec.c:1949 do_execve fs/exec.c:2019 [inline] __do_sys_execve fs/exec.c:2095 [inline] __se_sys_execve fs/exec.c:2090 [inline] __arm64_sys_execve+0x98/0xb0 fs/exec.c:2090 __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:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #0 (mapping.invalidate_lock#4){.+.+}-{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:3787 [inline] __lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622 down_read+0xbc/0x11c kernel/locking/rwsem.c:1488 filemap_invalidate_lock_shared include/linux/fs.h:842 [inline] filemap_fault+0x52c/0xf5c mm/filemap.c:3072 __do_fault+0x120/0x5d0 mm/memory.c:3871 do_read_fault mm/memory.c:4207 [inline] do_fault mm/memory.c:4335 [inline] handle_pte_fault mm/memory.c:4594 [inline] __handle_mm_fault mm/memory.c:4729 [inline] handle_mm_fault+0x21ec/0x33c4 mm/memory.c:4827 __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+0x5c/0x98 arch/arm64/kernel/entry-common.c:409 el1h_64_sync+0x78/0x7c arch/arm64/kernel/entry.S:579 do_strncpy_from_user lib/strncpy_from_user.c:41 [inline] strncpy_from_user+0x240/0x580 lib/strncpy_from_user.c:139 getname_flags+0x104/0x480 fs/namei.c:149 getname+0x28/0x38 fs/namei.c:217 do_sys_openat2+0xd4/0x3d8 fs/open.c:1205 do_sys_open fs/open.c:1227 [inline] __do_sys_openat fs/open.c:1243 [inline] __se_sys_openat fs/open.c:1238 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1238 __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:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 other info that might help us debug this: Chain exists of: mapping.invalidate_lock#4 --> &tree->tree_lock --> &mm->mmap_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock); lock(&tree->tree_lock); lock(&mm->mmap_lock); lock(mapping.invalidate_lock#4); *** DEADLOCK *** 1 lock held by syz-executor.1/5931: #0: ffff0000d1d6c618 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] #0: ffff0000d1d6c618 (&mm->mmap_lock){++++}-{3:3}, at: do_page_fault+0x380/0xb60 arch/arm64/mm/fault.c:586 stack backtrace: CPU: 0 PID: 5931 Comm: syz-executor.1 Not tainted 5.15.106-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 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:3787 [inline] __lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622 down_read+0xbc/0x11c kernel/locking/rwsem.c:1488 filemap_invalidate_lock_shared include/linux/fs.h:842 [inline] filemap_fault+0x52c/0xf5c mm/filemap.c:3072 __do_fault+0x120/0x5d0 mm/memory.c:3871 do_read_fault mm/memory.c:4207 [inline] do_fault mm/memory.c:4335 [inline] handle_pte_fault mm/memory.c:4594 [inline] __handle_mm_fault mm/memory.c:4729 [inline] handle_mm_fault+0x21ec/0x33c4 mm/memory.c:4827 __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+0x5c/0x98 arch/arm64/kernel/entry-common.c:409 el1h_64_sync+0x78/0x7c arch/arm64/kernel/entry.S:579 do_strncpy_from_user lib/strncpy_from_user.c:41 [inline] strncpy_from_user+0x240/0x580 lib/strncpy_from_user.c:139 getname_flags+0x104/0x480 fs/namei.c:149 getname+0x28/0x38 fs/namei.c:217 do_sys_openat2+0xd4/0x3d8 fs/open.c:1205 do_sys_open fs/open.c:1227 [inline] __do_sys_openat fs/open.c:1243 [inline] __se_sys_openat fs/open.c:1238 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1238 __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:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584