====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc4-syzkaller-g6a71d2909427 #0 Not tainted ------------------------------------------------------ syz-executor.4/10034 is trying to acquire lock: ffff0000c2c2b990 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x9c/0x124 mm/memory.c:6219 but task is already holding lock: ffff0000c970e0b0 (&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: -> #3 (&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_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_read_fault mm/memory.c:4894 [inline] do_fault mm/memory.c:5024 [inline] do_pte_missing mm/memory.c:3880 [inline] handle_pte_fault mm/memory.c:5300 [inline] __handle_mm_fault+0x36d0/0x5920 mm/memory.c:5441 handle_mm_fault+0x1e8/0x63c 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 con_set_trans_old+0x154/0x25c drivers/tty/vt/consolemap.c:359 vt_io_ioctl drivers/tty/vt/vt_ioctl.c:525 [inline] vt_ioctl+0xe24/0x24f8 drivers/tty/vt/vt_ioctl.c:755 tty_ioctl+0x8a4/0xd8c drivers/tty/tty_io.c:2803 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:904 [inline] __se_sys_ioctl fs/ioctl.c:890 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:890 __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 -> #1 (mapping.invalidate_lock#8){.+.+}-{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_read_fault mm/memory.c:4894 [inline] do_fault mm/memory.c:5024 [inline] do_pte_missing mm/memory.c:3880 [inline] handle_pte_fault mm/memory.c:5300 [inline] __handle_mm_fault+0x36d0/0x5920 mm/memory.c:5441 handle_mm_fault+0x1e8/0x63c 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 do_strncpy_from_user lib/strncpy_from_user.c:41 [inline] strncpy_from_user+0x224/0x54c lib/strncpy_from_user.c:139 getname_flags+0x104/0x48c fs/namei.c:150 getname+0x28/0x38 fs/namei.c:218 do_sys_openat2+0xd0/0x1b8 fs/open.c:1400 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1432 __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#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.4/10034: #0: ffff0000d5e045c8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x218/0x2a4 fs/file.c:1191 #1: ffff0000eef6c680 (&type->i_mutex_dir_key#17){++++}-{3:3}, at: iterate_dir+0x340/0x580 fs/readdir.c:103 #2: ffff0000c970e0b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc stack backtrace: CPU: 1 PID: 10034 Comm: syz-executor.4 Not tainted 6.9.0-rc4-syzkaller-g6a71d2909427 #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