====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc5-syzkaller-00296-g5eb4573ea63d #0 Not tainted ------------------------------------------------------ syz-executor.4/6772 is trying to acquire lock: ffff8880293440b0 (&tree->tree_lock#2/2){+.+.}-{3:3}, at: hfsplus_find_init+0x195/0x200 fs/hfsplus/bfind.c:36 but task is already holding lock: ffff88806df780b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x1a7/0x200 fs/hfsplus/bfind.c:30 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&tree->tree_lock#2){+.+.}-{3:3}: __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_setattr+0x1eb/0x310 fs/hfsplus/inode.c:265 notify_change+0x742/0x11c0 fs/attr.c:497 do_truncate+0x15c/0x220 fs/open.c:65 vfs_truncate+0x3ef/0x4e0 fs/open.c:111 do_sys_truncate fs/open.c:134 [inline] __do_sys_truncate fs/open.c:146 [inline] __se_sys_truncate fs/open.c:144 [inline] __x64_sys_truncate+0x177/0x1f0 fs/open.c:144 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #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+0xe5/0x2c0 mm/filemap.c:2331 do_read_cache_folio+0x203/0x540 mm/filemap.c:3747 do_read_cache_page mm/filemap.c:3813 [inline] read_cache_page+0x5b/0x160 mm/filemap.c:3822 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_find_attr+0xe6/0x190 fs/hfsplus/attributes.c:153 __hfsplus_getxattr+0x321/0x5f0 fs/hfsplus/xattr.c:522 hfsplus_getxattr+0x102/0x180 fs/hfsplus/xattr.c:590 hfsplus_security_getxattr+0x39/0x50 fs/hfsplus/xattr_security.c:20 vfs_getxattr_alloc+0x1be/0x340 fs/xattr.c:393 ima_read_xattr+0x38/0x60 security/integrity/ima/ima_appraise.c:229 process_measurement+0x1130/0x2100 security/integrity/ima/ima_main.c:340 ima_file_check+0xc1/0x110 security/integrity/ima/ima_main.c:559 security_file_post_open+0x6d/0xc0 security/security.c:2981 do_open fs/namei.c:3644 [inline] path_openat+0x17ad/0x2990 fs/namei.c:3799 do_filp_open+0x1dc/0x430 fs/namei.c:3826 do_sys_openat2+0x17a/0x1e0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_open fs/open.c:1429 [inline] __se_sys_open fs/open.c:1425 [inline] __x64_sys_open+0x154/0x1e0 fs/open.c:1425 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&tree->tree_lock#2/2){+.+.}-{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/0x560 kernel/locking/lockdep.c:5719 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hfsplus_find_init+0x195/0x200 fs/hfsplus/bfind.c:36 hfsplus_delete_all_attrs+0x113/0x330 fs/hfsplus/attributes.c:366 hfsplus_delete_cat+0x844/0xdd0 fs/hfsplus/catalog.c:425 hfsplus_file_release+0x1ca/0x230 fs/hfsplus/inode.c:236 __fput+0x270/0xb80 fs/file_table.c:422 __fput_sync+0x47/0x50 fs/file_table.c:507 __do_sys_close fs/open.c:1556 [inline] __se_sys_close fs/open.c:1541 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1541 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &tree->tree_lock#2/2 --> &HFSPLUS_I(inode)->extents_lock --> &tree->tree_lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock#2); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock#2); lock(&tree->tree_lock#2/2); *** DEADLOCK *** 2 locks held by syz-executor.4/6772: #0: ffff88807a255400 (&sb->s_type->i_mutex_key#33){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline] #0: ffff88807a255400 (&sb->s_type->i_mutex_key#33){+.+.}-{3:3}, at: hfsplus_file_release+0xfb/0x230 fs/hfsplus/inode.c:233 #1: ffff88806df780b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x1a7/0x200 fs/hfsplus/bfind.c:30 stack backtrace: CPU: 1 PID: 6772 Comm: syz-executor.4 Not tainted 6.9.0-rc5-syzkaller-00296-g5eb4573ea63d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 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/0x560 kernel/locking/lockdep.c:5719 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hfsplus_find_init+0x195/0x200 fs/hfsplus/bfind.c:36 hfsplus_delete_all_attrs+0x113/0x330 fs/hfsplus/attributes.c:366 hfsplus_delete_cat+0x844/0xdd0 fs/hfsplus/catalog.c:425 hfsplus_file_release+0x1ca/0x230 fs/hfsplus/inode.c:236 __fput+0x270/0xb80 fs/file_table.c:422 __fput_sync+0x47/0x50 fs/file_table.c:507 __do_sys_close fs/open.c:1556 [inline] __se_sys_close fs/open.c:1541 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1541 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f9d9b47cd9a Code: 48 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c 24 0c e8 03 7f 02 00 8b 7c 24 0c 89 c2 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 36 89 d7 89 44 24 0c e8 63 7f 02 00 8b 44 24 RSP: 002b:00007ffd362aceb0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000007 RCX: 00007f9d9b47cd9a RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000006 RBP: 00007f9d9b5ad980 R08: 0000001b31b20000 R09: 0000000000000b58 R10: 00000000813d1dda R11: 0000000000000293 R12: 00000000000290ce R13: 0000000000028f55 R14: 00007ffd362ad070 R15: 00007f9d9b434cb0