====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc4-syzkaller-g6a71d2909427 #0 Not tainted ------------------------------------------------------ syz-executor.4/6264 is trying to acquire lock: ffff0000d1c3e190 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x9c/0x124 mm/memory.c:6219 but task is already holding lock: ffff0000eea280b0 (&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+0x62c/0x9b8 fs/hfsplus/extents.c:609 hfsplus_write_failed+0x88/0xa4 fs/hfsplus/inode.c:37 hfsplus_write_begin+0xe0/0xe4 fs/hfsplus/inode.c:51 generic_perform_write+0x28c/0x588 mm/filemap.c:3974 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4069 generic_file_write_iter+0xb8/0x2b4 mm/filemap.c:4095 call_write_iter include/linux/fs.h:2110 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x968/0xc3c fs/read_write.c:590 ksys_write+0x15c/0x26c fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:652 __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 -> #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#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_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 faultin_page mm/gup.c:958 [inline] __get_user_pages+0x3e0/0xa24 mm/gup.c:1241 populate_vma_page_range+0x258/0x338 mm/gup.c:1681 __mm_populate+0x240/0x3d8 mm/gup.c:1790 mm_populate include/linux/mm.h:3411 [inline] vm_mmap_pgoff+0x2bc/0x3d4 mm/util.c:578 ksys_mmap_pgoff+0x3c8/0x5b0 mm/mmap.c:1431 __do_sys_mmap arch/arm64/kernel/sys.c:28 [inline] __se_sys_mmap arch/arm64/kernel/sys.c:21 [inline] __arm64_sys_mmap+0xf8/0x110 arch/arm64/kernel/sys.c:21 __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.4/6264: #0: ffff0000cd3765c8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x218/0x2a4 fs/file.c:1191 #1: ffff0000d7eedac0 (&type->i_mutex_dir_key#11){++++}-{3:3}, at: iterate_dir+0x340/0x580 fs/readdir.c:103 #2: ffff0000eea280b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc stack backtrace: CPU: 0 PID: 6264 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 EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000. BTRFS info (device loop4): last unmount of filesystem c9fe44da-de57-406a-8241-57ec7d4412cf BTRFS info (device loop4): last unmount of filesystem ed167579-eb65-4e76-9a50-61ac97e9b59d EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000. XFS (loop4): Unmounting Filesystem c496e05e-540d-4c72-b591-04d79d8b4eeb