loop0: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.10.0-rc5-syzkaller-g8fcad59bb267 #0 Not tainted ------------------------------------------------------ syz.0.741/9043 is trying to acquire lock: ffff0000c2760188 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x9c/0x124 mm/memory.c:6232 but task is already holding lock: ffff0000d815a0b0 (&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:4015 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4110 generic_file_write_iter+0xb8/0x2b4 mm/filemap.c:4136 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x828/0xc78 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:2407 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 read_pages+0x4b8/0x694 mm/readahead.c:180 page_cache_ra_unbounded+0x484/0x584 mm/readahead.c:273 do_page_cache_ra mm/readahead.c:303 [inline] page_cache_ra_order+0x7f0/0xa10 mm/readahead.c:547 do_sync_mmap_readahead+0x3a8/0x834 filemap_fault+0x5b4/0x10a0 mm/filemap.c:3313 __do_fault+0x11c/0x374 mm/memory.c:4556 do_shared_fault mm/memory.c:4980 [inline] do_fault mm/memory.c:5054 [inline] do_pte_missing mm/memory.c:3897 [inline] handle_pte_fault+0x112c/0x5714 mm/memory.c:5380 __handle_mm_fault mm/memory.c:5523 [inline] handle_mm_fault+0xe84/0x15cc mm/memory.c:5688 do_page_fault+0x38c/0xb1c arch/arm64/mm/fault.c:578 do_translation_fault+0xc4/0x114 arch/arm64/mm/fault.c:690 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:826 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#11){.+.+}-{3:3}: down_read+0x58/0x2fc kernel/locking/rwsem.c:1526 filemap_invalidate_lock_shared include/linux/fs.h:846 [inline] filemap_fault+0x528/0x10a0 mm/filemap.c:3301 __do_fault+0x11c/0x374 mm/memory.c:4556 do_read_fault mm/memory.c:4920 [inline] do_fault mm/memory.c:5050 [inline] do_pte_missing mm/memory.c:3897 [inline] handle_pte_fault+0x3160/0x5714 mm/memory.c:5380 __handle_mm_fault mm/memory.c:5523 [inline] handle_mm_fault+0xe84/0x15cc mm/memory.c:5688 do_page_fault+0x428/0xb1c arch/arm64/mm/fault.c:613 do_translation_fault+0xc4/0x114 arch/arm64/mm/fault.c:690 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:826 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_from_user+0x1b4/0x230 arch/arm64/lib/copy_template.S:164 copy_from_iter include/linux/uio.h:204 [inline] copy_from_iter_full include/linux/uio.h:221 [inline] memcpy_from_msg include/linux/skbuff.h:4035 [inline] netlink_sendmsg+0x598/0xa84 net/netlink/af_netlink.c:1890 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] ____sys_sendmsg+0x56c/0x840 net/socket.c:2585 ___sys_sendmsg net/socket.c:2639 [inline] __sys_sendmsg+0x26c/0x33c net/socket.c:2668 __do_sys_sendmsg net/socket.c:2677 [inline] __se_sys_sendmsg net/socket.c:2675 [inline] __arm64_sys_sendmsg+0x80/0x94 net/socket.c:2675 __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+0x240/0x728 kernel/locking/lockdep.c:5754 __might_fault+0xc4/0x124 mm/memory.c:6233 filldir64+0x2d4/0x948 fs/readdir.c:375 dir_emit_dot include/linux/fs.h:3571 [inline] hfsplus_readdir+0x398/0xf28 fs/hfsplus/dir.c:159 iterate_dir+0x4b8/0x640 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.0.741/9043: #0: ffff0000c755d748 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x218/0x2a4 fs/file.c:1191 #1: ffff0000d677c680 (&type->i_mutex_dir_key#16){++++}-{3:3}, at: iterate_dir+0x400/0x640 fs/readdir.c:103 #2: ffff0000d815a0b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc stack backtrace: CPU: 1 PID: 9043 Comm: syz.0.741 Not tainted 6.10.0-rc5-syzkaller-g8fcad59bb267 #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+0x240/0x728 kernel/locking/lockdep.c:5754 __might_fault+0xc4/0x124 mm/memory.c:6233 filldir64+0x2d4/0x948 fs/readdir.c:375 dir_emit_dot include/linux/fs.h:3571 [inline] hfsplus_readdir+0x398/0xf28 fs/hfsplus/dir.c:159 iterate_dir+0x4b8/0x640 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