====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc4-syzkaller-g6a71d2909427 #0 Not tainted ------------------------------------------------------ syz-executor.4/7256 is trying to acquire lock: ffff0000cb701190 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x9c/0x124 mm/memory.c:6219 but task is already holding lock: ffff0000e40c80b0 (&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+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+0x14c/0x560 mm/readahead.c:241 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#7){.+.+}-{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/7256: #0: ffff0000d5b92ac8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x218/0x2a4 fs/file.c:1191 #1: ffff0000f532d400 (&type->i_mutex_dir_key#17){++++}-{3:3}, at: iterate_dir+0x340/0x580 fs/readdir.c:103 #2: ffff0000e40c80b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc stack backtrace: CPU: 1 PID: 7256 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 hfsplus: bad catalog entry type EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000. EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000. EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000. ntfs3: loop4: ino=1a, ntfs_sync_fs failed, -22. ntfs3: loop4: ino=1a, ntfs_sync_fs failed, -22. BTRFS info (device loop4): last unmount of filesystem ed167579-eb65-4e76-9a50-61ac97e9b59d BTRFS info (device loop4): last unmount of filesystem ed167579-eb65-4e76-9a50-61ac97e9b59d