====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc6-syzkaller-g78186bd77b47 #0 Not tainted ------------------------------------------------------ syz-executor.3/8212 is trying to acquire lock: ffff0000d96c0190 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x9c/0x124 mm/memory.c:6219 but task is already holding lock: ffff0000c860e0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&tree->tree_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_file_truncate+0x6d0/0x9b8 fs/hfsplus/extents.c:595 hfsplus_file_release+0xe8/0x3a0 fs/hfsplus/inode.c:234 __fput+0x30c/0x738 fs/file_table.c:422 ____fput+0x20/0x30 fs/file_table.c:450 task_work_run+0x230/0x2e0 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x4e4/0x1ac8 kernel/exit.c:878 do_group_exit+0x194/0x22c kernel/exit.c:1027 get_signal+0x1414/0x1530 kernel/signal.c:2911 do_signal+0x238/0x3e8c arch/arm64/kernel/signal.c:1308 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:713 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 -> #2 (&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 -> #1 (mapping.invalidate_lock#5){.+.+}-{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 arch/arm64/mm/fault.c:505 [inline] do_page_fault+0x550/0xaec arch/arm64/mm/fault.c:620 do_translation_fault+0xc4/0x114 arch/arm64/mm/fault.c:704 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:840 el1_abort+0x3c/0x5c arch/arm64/kernel/entry-common.c:432 el1h_64_sync_handler+0x60/0xac arch/arm64/kernel/entry-common.c:492 el1h_64_sync+0x64/0x68 arch/arm64/kernel/entry.S:593 __arch_copy_to_user+0x190/0x234 arch/arm64/lib/copy_template.S:158 copy_page_to_iter+0x204/0x2fc lib/iov_iter.c:362 copy_folio_to_iter include/linux/uio.h:180 [inline] filemap_read+0x6c0/0xc84 mm/filemap.c:2652 generic_file_read_iter+0x9c/0x34c mm/filemap.c:2782 do_iter_readv_writev+0x438/0x658 vfs_readv+0x230/0x800 fs/read_write.c:932 do_preadv fs/read_write.c:1049 [inline] __do_sys_preadv fs/read_write.c:1099 [inline] __se_sys_preadv fs/read_write.c:1094 [inline] __arm64_sys_preadv+0x18c/0x29c fs/read_write.c:1094 __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 -> #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 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock); lock(&hip->extents_lock); lock(&tree->tree_lock); rlock(&mm->mmap_lock); *** DEADLOCK *** 3 locks held by syz-executor.3/8212: #0: ffff0000d0167748 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x218/0x2a4 fs/file.c:1191 #1: ffff0000d6ddab80 (&type->i_mutex_dir_key#12){++++}-{3:3}, at: iterate_dir+0x340/0x580 fs/readdir.c:103 #2: ffff0000c860e0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc stack backtrace: CPU: 1 PID: 8212 Comm: syz-executor.3 Not tainted 6.9.0-rc6-syzkaller-g78186bd77b47 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/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 hfsplus: bad catalog entry type hfsplus: bad catalog entry type