loop3: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc6-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/8990 is trying to acquire lock: ffff88807c8e00b0 (&tree->tree_lock/2){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 but task is already holding lock: ffff88807c8e20b0 (&tree->tree_lock){+.+.}-{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){+.+.}-{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+0xb9f/0xe70 fs/attr.c:497 do_truncate+0x220/0x310 fs/open.c:65 vfs_truncate+0x2e1/0x3b0 fs/open.c:111 do_sys_truncate+0xde/0x190 fs/open.c:134 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 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+0x430/0xe10 fs/buffer.c:2384 filemap_read_folio+0x1a2/0x790 mm/filemap.c:2331 do_read_cache_folio+0x134/0x820 mm/filemap.c:3747 do_read_cache_page+0x30/0x200 mm/filemap.c:3813 read_mapping_page include/linux/pagemap.h:888 [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+0x474/0x5c0 fs/xattr.c:393 ima_read_xattr+0x38/0x60 security/integrity/ima/ima_appraise.c:229 process_measurement+0x11d5/0x1f60 security/integrity/ima/ima_main.c:340 ima_file_check+0xf2/0x170 security/integrity/ima/ima_main.c:559 security_file_post_open+0x6f/0xa0 security/security.c:2981 do_open fs/namei.c:3644 [inline] path_openat+0x28b7/0x3240 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:52 [inline] do_syscall_64+0xf5/0x240 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: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_attr_exists+0xff/0x1d0 fs/hfsplus/attributes.c:178 __hfsplus_setxattr+0x476/0x22d0 fs/hfsplus/xattr.c:336 __vfs_setxattr+0x46a/0x4a0 fs/xattr.c:200 __vfs_setxattr_noperm+0x12e/0x5e0 fs/xattr.c:234 vfs_setxattr+0x221/0x430 fs/xattr.c:321 do_setxattr fs/xattr.c:629 [inline] setxattr+0x25d/0x2f0 fs/xattr.c:652 path_setxattr+0x1c0/0x2a0 fs/xattr.c:671 __do_sys_setxattr fs/xattr.c:687 [inline] __se_sys_setxattr fs/xattr.c:683 [inline] __x64_sys_setxattr+0xbb/0xd0 fs/xattr.c:683 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 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 --> &HFSPLUS_I(inode)->extents_lock --> &tree->tree_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); lock(&tree->tree_lock/2); *** DEADLOCK *** 3 locks held by syz-executor.3/8990: #0: ffff88805758a420 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:409 #1: ffff88805dd9ef00 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline] #1: ffff88805dd9ef00 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: vfs_setxattr+0x1e1/0x430 fs/xattr.c:320 #2: ffff88807c8e20b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 stack backtrace: CPU: 0 PID: 8990 Comm: syz-executor.3 Not tainted 6.9.0-rc6-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_attr_exists+0xff/0x1d0 fs/hfsplus/attributes.c:178 __hfsplus_setxattr+0x476/0x22d0 fs/hfsplus/xattr.c:336 __vfs_setxattr+0x46a/0x4a0 fs/xattr.c:200 __vfs_setxattr_noperm+0x12e/0x5e0 fs/xattr.c:234 vfs_setxattr+0x221/0x430 fs/xattr.c:321 do_setxattr fs/xattr.c:629 [inline] setxattr+0x25d/0x2f0 fs/xattr.c:652 path_setxattr+0x1c0/0x2a0 fs/xattr.c:671 __do_sys_setxattr fs/xattr.c:687 [inline] __se_sys_setxattr fs/xattr.c:683 [inline] __x64_sys_setxattr+0xbb/0xd0 fs/xattr.c:683 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc9b1c7dea9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc9b29280c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc RAX: ffffffffffffffda RBX: 00007fc9b1dabf80 RCX: 00007fc9b1c7dea9 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000020000040 RBP: 00007fc9b1cca4a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fc9b1dabf80 R15: 00007ffc357e5178