loop0: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc6-syzkaller-00234-g7367539ad4b0 #0 Not tainted ------------------------------------------------------ syz-executor.0/10730 is trying to acquire lock: ffff8880295e40b0 (&tree->tree_lock/2){+.+.}-{3:3}, at: hfsplus_find_init+0x195/0x200 fs/hfsplus/bfind.c:36 but task is already holding lock: ffff8880295e60b0 (&tree->tree_lock){+.+.}-{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){+.+.}-{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+0x130/0x190 fs/open.c:134 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #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/0x250 fs/hfsplus/attributes.c:153 __hfsplus_getxattr+0x321/0x5f0 fs/hfsplus/xattr.c:522 hfsplus_getxattr+0x91/0xe0 fs/hfsplus/xattr.c:590 hfsplus_security_getxattr+0x39/0x50 fs/hfsplus/xattr_security.c:20 vfs_getxattr_alloc+0x1b6/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_compat_sys_open fs/open.c:1472 [inline] __se_compat_sys_open fs/open.c:1470 [inline] __ia32_compat_sys_open+0x147/0x1e0 fs/open.c:1470 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #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 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+0x110/0x3f0 fs/hfsplus/attributes.c:366 hfsplus_delete_cat+0x844/0xdd0 fs/hfsplus/catalog.c:425 hfsplus_rmdir+0x106/0x1b0 fs/hfsplus/dir.c:425 hfsplus_rename+0x1a2/0x200 fs/hfsplus/dir.c:545 vfs_rename+0xf84/0x20a0 fs/namei.c:4880 do_renameat2+0xc54/0xdc0 fs/namei.c:5037 __do_sys_renameat2 fs/namei.c:5071 [inline] __se_sys_renameat2 fs/namei.c:5068 [inline] __ia32_sys_renameat2+0xeb/0x130 fs/namei.c:5068 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e 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 *** 5 locks held by syz-executor.0/10730: #0: ffff8880259ba420 (sb_writers#18){.+.+}-{0:0}, at: do_renameat2+0x3d6/0xdc0 fs/namei.c:4967 #1: ffff88805c0f3240 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:830 [inline] #1: ffff88805c0f3240 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: lock_rename fs/namei.c:3066 [inline] #1: ffff88805c0f3240 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: lock_rename fs/namei.c:3063 [inline] #1: ffff88805c0f3240 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: do_renameat2+0xad9/0xdc0 fs/namei.c:4972 #2: ffff88805c0f5400 (&sb->s_type->i_mutex_key#33){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline] #2: ffff88805c0f5400 (&sb->s_type->i_mutex_key#33){+.+.}-{3:3}, at: vfs_rename+0x136f/0x20a0 fs/namei.c:4845 #3: ffff888053104198 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_rmdir+0xdc/0x1b0 fs/hfsplus/dir.c:424 #4: ffff8880295e60b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x1a7/0x200 fs/hfsplus/bfind.c:30 stack backtrace: CPU: 3 PID: 10730 Comm: syz-executor.0 Not tainted 6.9.0-rc6-syzkaller-00234-g7367539ad4b0 #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/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+0x110/0x3f0 fs/hfsplus/attributes.c:366 hfsplus_delete_cat+0x844/0xdd0 fs/hfsplus/catalog.c:425 hfsplus_rmdir+0x106/0x1b0 fs/hfsplus/dir.c:425 hfsplus_rename+0x1a2/0x200 fs/hfsplus/dir.c:545 vfs_rename+0xf84/0x20a0 fs/namei.c:4880 do_renameat2+0xc54/0xdc0 fs/namei.c:5037 __do_sys_renameat2 fs/namei.c:5071 [inline] __se_sys_renameat2 fs/namei.c:5068 [inline] __ia32_sys_renameat2+0xeb/0x130 fs/namei.c:5068 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf72f2579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f5ee45ac EFLAGS: 00000292 ORIG_RAX: 0000000000000161 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000020000240 RDX: 0000000000000005 RSI: 0000000020000280 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi