hfsplus: inconsistency in B*Tree (0,1,255,1,0)
hfsplus: xattr search failed
hfsplus: inconsistency in B*Tree (0,1,255,1,0)
hfsplus: xattr search failed
hfsplus: inconsistency in B*Tree (0,1,255,1,0)
hfsplus: xattr search failed
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz-executor/4648 is trying to acquire lock:
ffff88807cd768f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_free+0xbf/0x4b0 fs/hfsplus/bitmap.c:182
but task is already holding lock:
ffff888051c1c488 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x2b7/0xb60 fs/hfsplus/extents.c:574
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xaf0 kernel/locking/mutex.c:747
hfsplus_get_block+0x3a1/0x15a0 fs/hfsplus/extents.c:260
block_read_full_folio+0x3e6/0xf00 fs/buffer.c:2271
filemap_read_folio+0x16b/0x770 mm/filemap.c:2490
do_read_cache_folio+0x2a0/0x760 mm/filemap.c:3659
do_read_cache_page+0x32/0x220 mm/filemap.c:3701
read_mapping_page include/linux/pagemap.h:793 [inline]
hfsplus_block_allocate+0xdc/0x8a0 fs/hfsplus/bitmap.c:37
hfsplus_file_extend+0xb1f/0x1a50 fs/hfsplus/extents.c:466
hfsplus_get_block+0x430/0x15a0 fs/hfsplus/extents.c:245
__block_write_begin_int+0x55d/0x1a80 fs/buffer.c:1991
__block_write_begin fs/buffer.c:2041 [inline]
block_write_begin+0x96/0x1e0 fs/buffer.c:2102
cont_write_begin+0x5ea/0x800 fs/buffer.c:2456
hfsplus_write_begin+0x87/0xd0 fs/hfsplus/inode.c:52
generic_perform_write+0x2fa/0x5c0 mm/filemap.c:3862
__generic_file_write_iter+0x148/0x2a0 mm/filemap.c:3960
generic_file_write_iter+0xab/0x2e0 mm/filemap.c:3989
__kernel_write_iter+0x285/0x650 fs/read_write.c:517
__kernel_write+0x103/0x170 fs/read_write.c:537
__dump_emit+0x208/0x310 fs/coredump.c:873
elf_core_dump+0x2858/0x35d0 fs/binfmt_elf.c:2306
do_coredump+0x165b/0x22f0 fs/coredump.c:824
get_signal+0x10aa/0x1350 kernel/signal.c:2857
arch_do_signal_or_restart+0xc4/0x1350 arch/x86/kernel/signal.c:871
exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:210
irqentry_exit_to_user_mode+0x5/0x30 kernel/entry/common.c:316
exc_page_fault+0x88/0x100 arch/x86/mm/fault.c:1485
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:608
-> #0 (&sbi->alloc_mutex){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x2d07/0x7d10 kernel/locking/lockdep.c:5049
lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xaf0 kernel/locking/mutex.c:747
hfsplus_block_free+0xbf/0x4b0 fs/hfsplus/bitmap.c:182
hfsplus_free_extents+0x10d/0xa50 fs/hfsplus/extents.c:360
hfsplus_file_truncate+0x765/0xb60 fs/hfsplus/extents.c:589
hfsplus_delete_inode+0x17c/0x230 fs/hfsplus/inode.c:-1
hfsplus_unlink+0x4f7/0x7b0 fs/hfsplus/dir.c:405
vfs_unlink+0x385/0x600 fs/namei.c:4330
do_unlinkat+0x335/0x580 fs/namei.c:4398
__do_sys_unlink fs/namei.c:4446 [inline]
__se_sys_unlink fs/namei.c:4444 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4444
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
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 ***
5 locks held by syz-executor/4648:
#0: ffff8880524f2460 (sb_writers#21){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:402
#1: ffff888051c1bfc0 (&type->i_mutex_dir_key#14/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline]
#1: ffff888051c1bfc0 (&type->i_mutex_dir_key#14/1){+.+.}-{3:3}, at: do_unlinkat+0x189/0x580 fs/namei.c:4381
#2: ffff888051c1c680 (&sb->s_type->i_mutex_key#40){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#2: ffff888051c1c680 (&sb->s_type->i_mutex_key#40){+.+.}-{3:3}, at: vfs_unlink+0xee/0x600 fs/namei.c:4319
#3: ffff88807cd76998 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x175/0x7b0 fs/hfsplus/dir.c:370
#4: ffff888051c1c488 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x2b7/0xb60 fs/hfsplus/extents.c:574
stack backtrace:
CPU: 0 PID: 4648 Comm: syz-executor Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
Call Trace:
<TASK>
dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2170
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x2d07/0x7d10 kernel/locking/lockdep.c:5049
lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xaf0 kernel/locking/mutex.c:747
hfsplus_block_free+0xbf/0x4b0 fs/hfsplus/bitmap.c:182
hfsplus_free_extents+0x10d/0xa50 fs/hfsplus/extents.c:360
hfsplus_file_truncate+0x765/0xb60 fs/hfsplus/extents.c:589
hfsplus_delete_inode+0x17c/0x230 fs/hfsplus/inode.c:-1
hfsplus_unlink+0x4f7/0x7b0 fs/hfsplus/dir.c:405
vfs_unlink+0x385/0x600 fs/namei.c:4330
do_unlinkat+0x335/0x580 fs/namei.c:4398
__do_sys_unlink fs/namei.c:4446 [inline]
__se_sys_unlink fs/namei.c:4444 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4444
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f9b1239bf47
Code: 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 57 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffdeef48668 EFLAGS: 00000206 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9b1239bf47
RDX: 00007ffdeef48690 RSI: 00007ffdeef48720 RDI: 00007ffdeef48720
RBP: 00007ffdeef48720 R08: 00007ffdeef49720 R09: 00000000ffffffff
R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffdeef49810
R13: 00007f9b124321ca R14: 00000000000bbbb0 R15: 00007ffdeef4b9d0
</TASK>
hfsplus: unable to mark blocks free: error -5
hfsplus: can't free extent
hfsplus: inconsistency in B*Tree (0,1,255,1,0)
hfsplus: xattr search failed
hfsplus: unable to mark blocks free: error -5
hfsplus: can't free extent
hfsplus: inconsistency in B*Tree (0,1,255,1,0)
hfsplus: xattr search failed
hfsplus: inconsistency in B*Tree (0,1,255,1,0)
hfsplus: xattr search failed
hfsplus: unable to mark blocks free: error -5
hfsplus: can't free extent
hfsplus: inconsistency in B*Tree (0,1,255,1,0)
hfsplus: xattr search failed
hfsplus: inconsistency in B*Tree (0,1,255,1,0)
hfsplus: xattr search failed