====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc3-next-20240412-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/6516 is trying to acquire lock: ffff88801bbf00b0 (&tree->tree_lock#2/2){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 but task is already holding lock: ffff88801bbf60b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&tree->tree_lock#2){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __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_setattr+0x1ce/0x280 fs/hfsplus/inode.c:265 notify_change+0xb9d/0xe70 fs/attr.c:497 do_truncate+0x220/0x310 fs/open.c:65 handle_truncate fs/namei.c:3300 [inline] do_open fs/namei.c:3646 [inline] path_openat+0x2a3d/0x3280 fs/namei.c:3799 do_filp_open+0x235/0x490 fs/namei.c:3826 do_sys_openat2+0x13e/0x1d0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:74 [inline] do_syscall_64+0xfa/0x250 arch/x86/entry/common.c:105 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __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+0x42e/0xe10 fs/buffer.c:2384 filemap_read_folio+0x1a0/0x790 mm/filemap.c:2355 do_read_cache_folio+0x134/0x820 mm/filemap.c:3782 do_read_cache_page+0x30/0x200 mm/filemap.c:3848 read_mapping_page include/linux/pagemap.h:892 [inline] __hfs_bnode_create+0x487/0x770 fs/hfsplus/bnode.c:440 hfsplus_bnode_find+0x237/0x10c0 fs/hfsplus/bnode.c:486 hfsplus_brec_find+0x183/0x570 fs/hfsplus/bfind.c:183 __hfsplus_getxattr+0x364/0xb10 fs/hfsplus/xattr.c:522 hfsplus_getxattr+0x9c/0xd0 fs/hfsplus/xattr.c:590 vfs_getxattr_alloc+0x472/0x5c0 fs/xattr.c:393 ima_read_xattr+0x38/0x60 security/integrity/ima/ima_appraise.c:229 process_measurement+0x1180/0x1fb0 security/integrity/ima/ima_main.c:353 ima_file_check+0xf2/0x170 security/integrity/ima/ima_main.c:572 security_file_post_open+0x6d/0xa0 security/security.c:2982 do_open fs/namei.c:3644 [inline] path_openat+0x28f6/0x3280 fs/namei.c:3799 do_filp_open+0x235/0x490 fs/namei.c:3826 do_sys_openat2+0x13e/0x1d0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:74 [inline] do_syscall_64+0xfa/0x250 arch/x86/entry/common.c:105 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+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_find_init+0x14a/0x1c0 hfsplus_delete_all_attrs+0x10b/0x3d0 fs/hfsplus/attributes.c:366 hfsplus_delete_cat+0xb37/0xf70 fs/hfsplus/catalog.c:425 hfsplus_unlink+0x363/0x790 fs/hfsplus/dir.c:385 vfs_unlink+0x365/0x650 fs/namei.c:4335 do_unlinkat+0x4ae/0x830 fs/namei.c:4399 __do_sys_unlink fs/namei.c:4447 [inline] __se_sys_unlink fs/namei.c:4445 [inline] __x64_sys_unlink+0x49/0x60 fs/namei.c:4445 do_syscall_x64 arch/x86/entry/common.c:74 [inline] do_syscall_64+0xfa/0x250 arch/x86/entry/common.c:105 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 *** 5 locks held by syz-executor.0/6516: #0: ffff8880775ba420 (sb_writers#19){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:409 #1: ffff88806d563900 (&type->i_mutex_dir_key#14/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:826 [inline] #1: ffff88806d563900 (&type->i_mutex_dir_key#14/1){+.+.}-{3:3}, at: do_unlinkat+0x26a/0x830 fs/namei.c:4386 #2: ffff8880775b5400 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:791 [inline] #2: ffff8880775b5400 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: vfs_unlink+0xe4/0x650 fs/namei.c:4324 #3: ffff8880250f9998 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x161/0x790 fs/hfsplus/dir.c:370 #4: ffff88801bbf60b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 stack backtrace: CPU: 0 PID: 6516 Comm: syz-executor.0 Not tainted 6.9.0-rc3-next-20240412-syzkaller #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+0x241/0x360 lib/dump_stack.c:114 check_noncircular+0x36a/0x4a0 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+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_find_init+0x14a/0x1c0 hfsplus_delete_all_attrs+0x10b/0x3d0 fs/hfsplus/attributes.c:366 hfsplus_delete_cat+0xb37/0xf70 fs/hfsplus/catalog.c:425 hfsplus_unlink+0x363/0x790 fs/hfsplus/dir.c:385 vfs_unlink+0x365/0x650 fs/namei.c:4335 do_unlinkat+0x4ae/0x830 fs/namei.c:4399 __do_sys_unlink fs/namei.c:4447 [inline] __se_sys_unlink fs/namei.c:4445 [inline] __x64_sys_unlink+0x49/0x60 fs/namei.c:4445 do_syscall_x64 arch/x86/entry/common.c:74 [inline] do_syscall_64+0xfa/0x250 arch/x86/entry/common.c:105 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f891887d617 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:00007ffd6acb4e38 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f891887d617 RDX: 00007ffd6acb4e60 RSI: 00007ffd6acb4ef0 RDI: 00007ffd6acb4ef0 RBP: 00007ffd6acb4ef0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffd6acb5fe0 R13: 00007f89188c93b9 R14: 000000000003f90f R15: 000000000000001e