hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed ====================================================== WARNING: possible circular locking dependency detected 6.10.0-rc2-next-20240607-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/14056 is trying to acquire lock: ffff888063cd60b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_file_truncate+0x811/0xb50 fs/hfsplus/extents.c:595 but task is already holding lock: ffff888079335f88 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x2da/0xb50 fs/hfsplus/extents.c:576 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5817 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_get_block+0x383/0x14f0 fs/hfsplus/extents.c:260 block_read_full_folio+0x418/0xcd0 fs/buffer.c:2404 filemap_read_folio+0x1a0/0x790 mm/filemap.c:2355 do_read_cache_folio+0x134/0x820 mm/filemap.c:3789 do_read_cache_page+0x30/0x200 mm/filemap.c:3855 read_mapping_page include/linux/pagemap.h:896 [inline] __hfs_bnode_create+0x487/0x770 fs/hfsplus/bnode.c:440 hfsplus_bnode_create+0x124/0x440 fs/hfsplus/bnode.c:576 hfsplus_bmap_alloc+0x59a/0x640 fs/hfsplus/btree.c:415 hfs_btree_inc_height+0x11e/0xdc0 fs/hfsplus/brec.c:475 hfsplus_brec_insert+0x77a/0xde0 fs/hfsplus/brec.c:148 hfsplus_create_cat+0x49f/0x1b70 fs/hfsplus/catalog.c:292 hfsplus_fill_super+0x13ee/0x1ca0 fs/hfsplus/super.c:566 mount_bdev+0x20a/0x2d0 fs/super.c:1659 legacy_get_tree+0xee/0x190 fs/fs_context.c:662 vfs_get_tree+0x90/0x2a0 fs/super.c:1780 do_new_mount+0x2be/0xb40 fs/namespace.c:3352 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&tree->tree_lock#2){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3159 [inline] check_prevs_add kernel/locking/lockdep.c:3278 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3902 __lock_acquire+0x1359/0x2000 kernel/locking/lockdep.c:5194 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5817 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_file_truncate+0x811/0xb50 fs/hfsplus/extents.c:595 hfsplus_delete_inode+0x174/0x220 hfsplus_unlink+0x512/0x790 fs/hfsplus/dir.c:405 vfs_unlink+0x365/0x650 fs/namei.c:4354 do_unlinkat+0x4ae/0x830 fs/namei.c:4418 __do_sys_unlink fs/namei.c:4466 [inline] __se_sys_unlink fs/namei.c:4464 [inline] __x64_sys_unlink+0x47/0x50 fs/namei.c:4464 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock#2); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock#2); *** DEADLOCK *** 5 locks held by syz-executor.1/14056: #0: ffff88802f0a8420 (sb_writers#28){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:409 #1: ffff888079334d38 (&type->i_mutex_dir_key#21/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:830 [inline] #1: ffff888079334d38 (&type->i_mutex_dir_key#21/1){+.+.}-{3:3}, at: do_unlinkat+0x26a/0x830 fs/namei.c:4405 #2: ffff888079336178 (&sb->s_type->i_mutex_key#37){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline] #2: ffff888079336178 (&sb->s_type->i_mutex_key#37){+.+.}-{3:3}, at: vfs_unlink+0xe4/0x650 fs/namei.c:4343 #3: ffff88802a759998 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x161/0x790 fs/hfsplus/dir.c:370 #4: ffff888079335f88 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x2da/0xb50 fs/hfsplus/extents.c:576 stack backtrace: CPU: 1 PID: 14056 Comm: syz-executor.1 Not tainted 6.10.0-rc2-next-20240607-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:91 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:117 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2075 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2204 check_prev_add kernel/locking/lockdep.c:3159 [inline] check_prevs_add kernel/locking/lockdep.c:3278 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3902 __lock_acquire+0x1359/0x2000 kernel/locking/lockdep.c:5194 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5817 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_file_truncate+0x811/0xb50 fs/hfsplus/extents.c:595 hfsplus_delete_inode+0x174/0x220 hfsplus_unlink+0x512/0x790 fs/hfsplus/dir.c:405 vfs_unlink+0x365/0x650 fs/namei.c:4354 do_unlinkat+0x4ae/0x830 fs/namei.c:4418 __do_sys_unlink fs/namei.c:4466 [inline] __se_sys_unlink fs/namei.c:4464 [inline] __x64_sys_unlink+0x47/0x50 fs/namei.c:4464 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fd05087c717 Code: 73 01 c3 48 c7 c1 b0 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 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffeee536078 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd05087c717 RDX: 00007ffeee5360a0 RSI: 00007ffeee536130 RDI: 00007ffeee536130 RBP: 00007ffeee536130 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffeee537220 R13: 00007fd0508d9636 R14: 00000000000ce97b R15: 0000000000000007 hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed