hfsplus: failed to load root directory loop0: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.8.0-syzkaller-08951-gfe46a7dd189e #0 Not tainted ------------------------------------------------------ syz-executor261/5167 is trying to acquire lock: ffff8880256f60b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x886/0x9e0 fs/hfsplus/extents.c:595 but task is already holding lock: ffff888028edd208 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x204/0x9e0 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}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hfsplus_get_block+0x277/0x9e0 fs/hfsplus/extents.c:260 block_read_full_folio+0x38f/0xa70 fs/buffer.c:2384 filemap_read_folio+0xe9/0x2c0 mm/filemap.c:2333 do_read_cache_folio+0x209/0x550 mm/filemap.c:3703 do_read_cache_page mm/filemap.c:3769 [inline] read_cache_page+0x5b/0x160 mm/filemap.c:3778 read_mapping_page include/linux/pagemap.h:888 [inline] __hfs_bnode_create+0x63e/0x870 fs/hfsplus/bnode.c:440 hfsplus_bnode_find+0x2c8/0xcb0 fs/hfsplus/bnode.c:486 hfsplus_brec_find+0x2b9/0x520 fs/hfsplus/bfind.c:183 hfsplus_brec_read+0x2d/0x120 fs/hfsplus/bfind.c:222 hfsplus_find_cat+0x1e3/0x4d0 fs/hfsplus/catalog.c:202 hfsplus_iget+0x3bd/0x7a0 fs/hfsplus/super.c:82 hfsplus_fill_super+0xca8/0x1bc0 fs/hfsplus/super.c:509 mount_bdev+0x1e3/0x2d0 fs/super.c:1658 legacy_get_tree+0x109/0x220 fs/fs_context.c:662 vfs_get_tree+0x8f/0x380 fs/super.c:1779 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x14e6/0x1f20 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __x64_sys_mount+0x297/0x320 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 -> #0 (&tree->tree_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+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hfsplus_file_truncate+0x886/0x9e0 fs/hfsplus/extents.c:595 hfsplus_delete_inode+0x18f/0x220 fs/hfsplus/inode.c:450 hfsplus_unlink+0x583/0x7f0 fs/hfsplus/dir.c:405 hfsplus_rename+0xbc/0x200 fs/hfsplus/dir.c:547 vfs_rename+0xf84/0x20a0 fs/namei.c:4883 do_renameat2+0xc54/0xdc0 fs/namei.c:5040 __do_sys_rename fs/namei.c:5087 [inline] __se_sys_rename fs/namei.c:5085 [inline] __x64_sys_rename+0x81/0xa0 fs/namei.c:5085 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); *** DEADLOCK *** 6 locks held by syz-executor261/5167: #0: ffff88801d53e420 (sb_writers#10){.+.+}-{0:0}, at: do_renameat2+0x3d6/0xdc0 fs/namei.c:4970 #1: ffff888028edc680 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:828 [inline] #1: ffff888028edc680 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: lock_rename fs/namei.c:3066 [inline] #1: ffff888028edc680 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: lock_rename fs/namei.c:3063 [inline] #1: ffff888028edc680 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: do_renameat2+0xad9/0xdc0 fs/namei.c:4975 #2: ffff888028edcd40 (&sb->s_type->i_mutex_key#17){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:793 [inline] #2: ffff888028edcd40 (&sb->s_type->i_mutex_key#17){+.+.}-{3:3}, at: lock_two_nondirectories+0x195/0x200 fs/inode.c:1111 #3: ffff888028edd400 (&sb->s_type->i_mutex_key#17/4){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:828 [inline] #3: ffff888028edd400 (&sb->s_type->i_mutex_key#17/4){+.+.}-{3:3}, at: lock_two_nondirectories+0xed/0x200 fs/inode.c:1113 #4: ffff888024432198 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x184/0x7f0 fs/hfsplus/dir.c:370 #5: ffff888028edd208 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x204/0x9e0 fs/hfsplus/extents.c:576 stack backtrace: CPU: 0 PID: 5167 Comm: syz-executor261 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 check_noncircular+0x31a/0x400 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+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hfsplus_file_truncate+0x886/0x9e0 fs/hfsplus/extents.c:595 hfsplus_delete_inode+0x18f/0x220 fs/hfsplus/inode.c:450 hfsplus_unlink+0x583/0x7f0 fs/hfsplus/dir.c:405 hfsplus_rename+0xbc/0x200 fs/hfsplus/dir.c:547 vfs_rename+0xf84/0x20a0 fs/namei.c:4883 do_renameat2+0xc54/0xdc0 fs/namei.c:5040 __do_sys_rename fs/namei.c:5087 [inline] __se_sys_rename fs/namei.c:5085 [inline] __x64_sys_rename+0x81/0xa0 fs/namei.c:5085 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 RIP: 0033:0x7f86219aecf9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 21 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffcaf4aaee8 EFLAGS: 00000246 ORIG_RAX: 0000000000000052 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f86219aecf9 RDX: 0030656c69662f30 RSI: 00000000200001c0 RDI: 0000000020000180 RBP: 736f706d6f636564 R08: 00000000000005fb R09: 0000000000000140 R10: 00007ffcaf4aadb0 R11: 0000000000000246 R12: 0030656c69662f2e R13: 0073756c70736668 R14: 0000000000000001 R15: 0000000000000001