====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.3.340/8709 is trying to acquire lock: ffff0000d8e778f8 (&sbi->alloc_mutex){+.+.}-{4:4}, at: hfsplus_block_allocate+0x94/0x9ac fs/hfsplus/bitmap.c:35 but task is already holding lock: ffff0000cbebd208 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_extend+0x1b8/0x159c fs/hfsplus/extents.c:453 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}: __mutex_lock_common+0x1d0/0x2678 kernel/locking/mutex.c:614 __mutex_lock kernel/locking/mutex.c:776 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:828 hfsplus_get_block+0x2d4/0x1268 fs/hfsplus/extents.c:260 block_read_full_folio+0x2ec/0x824 fs/buffer.c:2420 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 filemap_read_folio+0xec/0x2f8 mm/filemap.c:2496 do_read_cache_folio+0x370/0x5c8 mm/filemap.c:4096 do_read_cache_page mm/filemap.c:4162 [inline] read_cache_page+0x6c/0x160 mm/filemap.c:4171 read_mapping_page include/linux/pagemap.h:1011 [inline] hfsplus_block_allocate+0xe4/0x9ac fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x774/0x159c fs/hfsplus/extents.c:464 hfsplus_get_block+0x32c/0x1268 fs/hfsplus/extents.c:245 __block_write_begin_int+0x53c/0x15e8 fs/buffer.c:2145 block_write_begin fs/buffer.c:2256 [inline] cont_write_begin+0x630/0x96c fs/buffer.c:2594 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:48 generic_perform_write+0x244/0x7bc mm/filemap.c:4314 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4431 generic_file_write_iter+0x10c/0x47c mm/filemap.c:4457 __kernel_write_iter+0x310/0x738 fs/read_write.c:619 __kernel_write+0xe0/0x130 fs/read_write.c:639 __dump_emit fs/coredump.c:1220 [inline] dump_emit+0x220/0x31c fs/coredump.c:1258 elf_core_dump+0x2328/0x2fbc fs/binfmt_elf.c:2063 coredump_write+0x1084/0x1900 fs/coredump.c:1049 do_coredump fs/coredump.c:1126 [inline] vfs_coredump+0x2674/0x30ac fs/coredump.c:1200 get_signal+0xe38/0x12f8 kernel/signal.c:3019 arch_do_signal_or_restart+0x1b8/0x46d4 arch/arm64/kernel/signal.c:1619 __exit_to_user_mode_loop kernel/entry/common.c:41 [inline] exit_to_user_mode_loop+0x88/0x18c kernel/entry/common.c:75 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] exit_to_user_mode_prepare_legacy include/linux/irq-entry-common.h:242 [inline] arm64_exit_to_user_mode arch/arm64/kernel/entry-common.c:81 [inline] el0_da+0x180/0x248 arch/arm64/kernel/entry-common.c:541 el0t_64_sync_handler+0x90/0x12c arch/arm64/kernel/entry-common.c:746 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596 -> #0 (&sbi->alloc_mutex){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x1774/0x30a4 kernel/locking/lockdep.c:5237 lock_acquire+0x140/0x2e0 kernel/locking/lockdep.c:5868 __mutex_lock_common+0x1d0/0x2678 kernel/locking/mutex.c:614 __mutex_lock kernel/locking/mutex.c:776 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:828 hfsplus_block_allocate+0x94/0x9ac fs/hfsplus/bitmap.c:35 hfsplus_file_extend+0x774/0x159c fs/hfsplus/extents.c:464 hfsplus_get_block+0x32c/0x1268 fs/hfsplus/extents.c:245 __block_write_begin_int+0x53c/0x15e8 fs/buffer.c:2145 block_write_begin fs/buffer.c:2256 [inline] cont_write_begin+0x630/0x96c fs/buffer.c:2594 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:48 cont_expand_zero fs/buffer.c:2522 [inline] cont_write_begin+0x26c/0x96c fs/buffer.c:2584 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:48 generic_cont_expand_simple+0x12c/0x1fc fs/buffer.c:2485 hfsplus_setattr+0x140/0x24c fs/hfsplus/inode.c:280 notify_change+0xa0c/0xcb8 fs/attr.c:546 do_truncate+0x198/0x210 fs/open.c:68 vfs_truncate+0x398/0x444 fs/open.c:118 do_sys_truncate+0xe4/0x1a8 fs/open.c:141 __do_sys_truncate fs/open.c:153 [inline] __se_sys_truncate fs/open.c:151 [inline] __arm64_sys_truncate+0x5c/0x74 fs/open.c:151 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x254 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xe8/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x5c/0x26c arch/arm64/kernel/entry-common.c:724 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:743 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); *** DEADLOCK *** 3 locks held by syz.3.340/8709: #0: ffff0000f9ee0420 (sb_writers#15){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:499 #1: ffff0000cbebd3f8 (&sb->s_type->i_mutex_key#35){+.+.}-{4:4}, at: inode_lock_killable include/linux/fs.h:1032 [inline] #1: ffff0000cbebd3f8 (&sb->s_type->i_mutex_key#35){+.+.}-{4:4}, at: do_truncate+0x164/0x210 fs/open.c:63 #2: ffff0000cbebd208 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_extend+0x1b8/0x159c fs/hfsplus/extents.c:453 stack backtrace: CPU: 0 UID: 0 PID: 8709 Comm: syz.3.340 Not tainted syzkaller #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/03/2025 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:499 (C) __dump_stack+0x30/0x40 lib/dump_stack.c:94 dump_stack_lvl+0xd8/0x12c lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x324/0x32c kernel/locking/lockdep.c:2043 check_noncircular+0x154/0x174 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x1774/0x30a4 kernel/locking/lockdep.c:5237 lock_acquire+0x140/0x2e0 kernel/locking/lockdep.c:5868 __mutex_lock_common+0x1d0/0x2678 kernel/locking/mutex.c:614 __mutex_lock kernel/locking/mutex.c:776 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:828 hfsplus_block_allocate+0x94/0x9ac fs/hfsplus/bitmap.c:35 hfsplus_file_extend+0x774/0x159c fs/hfsplus/extents.c:464 hfsplus_get_block+0x32c/0x1268 fs/hfsplus/extents.c:245 __block_write_begin_int+0x53c/0x15e8 fs/buffer.c:2145 block_write_begin fs/buffer.c:2256 [inline] cont_write_begin+0x630/0x96c fs/buffer.c:2594 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:48 cont_expand_zero fs/buffer.c:2522 [inline] cont_write_begin+0x26c/0x96c fs/buffer.c:2584 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:48 generic_cont_expand_simple+0x12c/0x1fc fs/buffer.c:2485 hfsplus_setattr+0x140/0x24c fs/hfsplus/inode.c:280 notify_change+0xa0c/0xcb8 fs/attr.c:546 do_truncate+0x198/0x210 fs/open.c:68 vfs_truncate+0x398/0x444 fs/open.c:118 do_sys_truncate+0xe4/0x1a8 fs/open.c:141 __do_sys_truncate fs/open.c:153 [inline] __se_sys_truncate fs/open.c:151 [inline] __arm64_sys_truncate+0x5c/0x74 fs/open.c:151 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x254 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xe8/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x5c/0x26c arch/arm64/kernel/entry-common.c:724 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:743 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596