====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc7-syzkaller-gfda5695d692c #0 Not tainted ------------------------------------------------------ syz-executor.1/9255 is trying to acquire lock: ffff0000cc554990 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x9c/0x124 mm/memory.c:6219 but task is already holding lock: ffff0000d992c0b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&tree->tree_lock#2){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hfsplus_file_truncate+0x6d0/0x9b8 fs/hfsplus/extents.c:595 hfsplus_setattr+0x184/0x238 fs/hfsplus/inode.c:265 notify_change+0x9d4/0xc84 fs/attr.c:497 do_truncate fs/open.c:65 [inline] do_ftruncate+0x3e4/0x4cc fs/open.c:181 do_sys_ftruncate fs/open.c:199 [inline] __do_sys_ftruncate fs/open.c:207 [inline] __se_sys_ftruncate fs/open.c:205 [inline] __arm64_sys_ftruncate+0x94/0xec fs/open.c:205 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 -> #3 (&hip->extents_lock){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hfsplus_get_block+0x2c4/0x1168 fs/hfsplus/extents.c:260 block_read_full_folio+0x3e0/0xc6c fs/buffer.c:2384 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 read_pages+0x4b8/0x694 mm/readahead.c:180 page_cache_ra_unbounded+0x460/0x560 mm/readahead.c:269 do_page_cache_ra mm/readahead.c:299 [inline] page_cache_ra_order+0x74c/0x8d0 mm/readahead.c:539 do_sync_mmap_readahead+0x368/0x74c filemap_fault+0x584/0x1004 mm/filemap.c:3289 __do_fault+0x11c/0x374 mm/memory.c:4531 do_shared_fault mm/memory.c:4954 [inline] do_fault mm/memory.c:5028 [inline] do_pte_missing+0x6a0/0x3378 mm/memory.c:3880 handle_pte_fault mm/memory.c:5300 [inline] __handle_mm_fault mm/memory.c:5441 [inline] handle_mm_fault+0x1568/0x2aa4 mm/memory.c:5606 do_page_fault+0x390/0xaec arch/arm64/mm/fault.c:593 do_translation_fault+0xc4/0x114 arch/arm64/mm/fault.c:704 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:840 el0_da+0x60/0x178 arch/arm64/kernel/entry-common.c:580 el0t_64_sync_handler+0xcc/0xfc arch/arm64/kernel/entry-common.c:733 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 -> #2 (mapping.invalidate_lock#3){.+.+}-{3:3}: down_read+0x58/0x2fc kernel/locking/rwsem.c:1526 filemap_invalidate_lock_shared include/linux/fs.h:850 [inline] filemap_fault+0x4f8/0x1004 mm/filemap.c:3277 __do_fault+0x11c/0x374 mm/memory.c:4531 do_shared_fault mm/memory.c:4954 [inline] do_fault mm/memory.c:5028 [inline] do_pte_missing+0x6a0/0x3378 mm/memory.c:3880 handle_pte_fault mm/memory.c:5300 [inline] __handle_mm_fault mm/memory.c:5441 [inline] handle_mm_fault+0x1568/0x2aa4 mm/memory.c:5606 do_page_fault+0x390/0xaec arch/arm64/mm/fault.c:593 do_translation_fault+0xc4/0x114 arch/arm64/mm/fault.c:704 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:840 el0_da+0x60/0x178 arch/arm64/kernel/entry-common.c:580 el0t_64_sync_handler+0xcc/0xfc arch/arm64/kernel/entry-common.c:733 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 -> #1 (&vma->vm_lock->lock){++++}-{3:3}: down_write+0x50/0xc0 kernel/locking/rwsem.c:1579 vma_start_write include/linux/mm.h:730 [inline] vma_link+0x268/0x4bc mm/mmap.c:416 insert_vm_struct+0x2bc/0x3c0 mm/mmap.c:3339 __bprm_mm_init fs/exec.c:282 [inline] bprm_mm_init fs/exec.c:384 [inline] alloc_bprm+0x488/0x934 fs/exec.c:1580 kernel_execve+0xa4/0x7e8 fs/exec.c:2004 run_init_process+0x1bc/0x1ec init/main.c:1366 try_to_run_init_process init/main.c:1373 [inline] kernel_init+0xd8/0x29c init/main.c:1500 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 -> #0 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x3384/0x763c kernel/locking/lockdep.c:5137 lock_acquire+0x248/0x73c kernel/locking/lockdep.c:5754 __might_fault+0xc4/0x124 mm/memory.c:6220 filldir64+0x2d4/0x948 fs/readdir.c:375 dir_emit_dot include/linux/fs.h:3574 [inline] hfsplus_readdir+0x398/0xf28 fs/hfsplus/dir.c:159 iterate_dir+0x3f8/0x580 fs/readdir.c:110 __do_sys_getdents64 fs/readdir.c:409 [inline] __se_sys_getdents64 fs/readdir.c:394 [inline] __arm64_sys_getdents64+0x1c4/0x4a0 fs/readdir.c:394 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 other info that might help us debug this: Chain exists of: &mm->mmap_lock --> &hip->extents_lock --> &tree->tree_lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock#2); lock(&hip->extents_lock); lock(&tree->tree_lock#2); rlock(&mm->mmap_lock); *** DEADLOCK *** 3 locks held by syz-executor.1/9255: #0: ffff0000d617e348 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x218/0x2a4 fs/file.c:1191 #1: ffff0000d43c9080 (&type->i_mutex_dir_key#14){++++}-{3:3}, at: iterate_dir+0x340/0x580 fs/readdir.c:103 #2: ffff0000d992c0b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc stack backtrace: CPU: 1 PID: 9255 Comm: syz-executor.1 Not tainted 6.9.0-rc7-syzkaller-gfda5695d692c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:317 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:324 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:114 dump_stack+0x1c/0x28 lib/dump_stack.c:123 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2060 check_noncircular+0x310/0x404 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x3384/0x763c kernel/locking/lockdep.c:5137 lock_acquire+0x248/0x73c kernel/locking/lockdep.c:5754 __might_fault+0xc4/0x124 mm/memory.c:6220 filldir64+0x2d4/0x948 fs/readdir.c:375 dir_emit_dot include/linux/fs.h:3574 [inline] hfsplus_readdir+0x398/0xf28 fs/hfsplus/dir.c:159 iterate_dir+0x3f8/0x580 fs/readdir.c:110 __do_sys_getdents64 fs/readdir.c:409 [inline] __se_sys_getdents64 fs/readdir.c:394 [inline] __arm64_sys_getdents64+0x1c4/0x4a0 fs/readdir.c:394 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598