====================================================== WARNING: possible circular locking dependency detected 6.9.0-next-20240517-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/7011 is trying to acquire lock: ffff88802d9fc0b0 (&tree->tree_lock#2/2){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 but task is already holding lock: ffff88802d4ec0b0 (&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:3308 [inline] do_open fs/namei.c:3654 [inline] path_openat+0x2a3d/0x3280 fs/namei.c:3807 do_filp_open+0x235/0x490 fs/namei.c:3834 do_sys_openat2+0x13e/0x1d0 fs/open.c:1405 do_sys_open fs/open.c:1420 [inline] __do_sys_creat fs/open.c:1496 [inline] __se_sys_creat fs/open.c:1490 [inline] __x64_sys_creat+0x123/0x170 fs/open.c:1490 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+0x42e/0xe10 fs/buffer.c:2407 filemap_read_folio+0x1a0/0x790 mm/filemap.c:2355 do_read_cache_folio+0x134/0x820 mm/filemap.c:3789 do_read_cache_page+0x30/0x200 mm/filemap.c:3855 read_mapping_page include/linux/pagemap.h:889 [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:520 hfsplus_getxattr+0x9c/0xd0 fs/hfsplus/xattr.c:588 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:3652 [inline] path_openat+0x28f6/0x3280 fs/namei.c:3807 do_filp_open+0x235/0x490 fs/namei.c:3834 do_sys_openat2+0x13e/0x1d0 fs/open.c:1405 do_sys_open fs/open.c:1420 [inline] __do_sys_openat fs/open.c:1436 [inline] __se_sys_openat fs/open.c:1431 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1431 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/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 hfsplus_setxattr+0xb0/0xe0 fs/hfsplus/xattr.c:432 hfsplus_trusted_setxattr+0x40/0x60 fs/hfsplus/xattr_trusted.c:30 __vfs_setxattr+0x468/0x4a0 fs/xattr.c:200 __vfs_setxattr_noperm+0x12e/0x660 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_lsetxattr fs/xattr.c:694 [inline] __se_sys_lsetxattr fs/xattr.c:690 [inline] __x64_sys_lsetxattr+0xb8/0xd0 fs/xattr.c:690 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/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 *** 3 locks held by syz-executor.0/7011: #0: ffff88805d1d2420 (sb_writers#30){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:409 #1: ffff8880655f89c0 (&sb->s_type->i_mutex_key#35){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:791 [inline] #1: ffff8880655f89c0 (&sb->s_type->i_mutex_key#35){+.+.}-{3:3}, at: vfs_setxattr+0x1e1/0x430 fs/xattr.c:320 #2: ffff88802d4ec0b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 stack backtrace: CPU: 1 PID: 7011 Comm: syz-executor.0 Not tainted 6.9.0-next-20240517-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/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 hfsplus_setxattr+0xb0/0xe0 fs/hfsplus/xattr.c:432 hfsplus_trusted_setxattr+0x40/0x60 fs/hfsplus/xattr_trusted.c:30 __vfs_setxattr+0x468/0x4a0 fs/xattr.c:200 __vfs_setxattr_noperm+0x12e/0x660 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_lsetxattr fs/xattr.c:694 [inline] __se_sys_lsetxattr fs/xattr.c:690 [inline] __x64_sys_lsetxattr+0xb8/0xd0 fs/xattr.c:690 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:0x7f1be5e7cee9 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:00007f1be6be80c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd RAX: ffffffffffffffda RBX: 00007f1be5fac050 RCX: 00007f1be5e7cee9 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000020000100 RBP: 00007f1be5ec949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007f1be5fac050 R15: 00007ffd6ee3ffc8 syz-executor.0: attempt to access beyond end of device loop0: rw=0, sector=78, nr_sectors = 2 limit=0 Buffer I/O error on dev loop0, logical block 39, async page read syz-executor.0: attempt to access beyond end of device loop0: rw=0, sector=80, nr_sectors = 2 limit=0 Buffer I/O error on dev loop0, logical block 40, async page read syz-executor.0: attempt to access beyond end of device loop0: rw=0, sector=82, nr_sectors = 2 limit=0 Buffer I/O error on dev loop0, logical block 41, async page read syz-executor.0: attempt to access beyond end of device loop0: rw=0, sector=84, nr_sectors = 2 limit=0 Buffer I/O error on dev loop0, logical block 42, async page read syz-executor.0: attempt to access beyond end of device loop0: rw=0, sector=86, nr_sectors = 2 limit=0 Buffer I/O error on dev loop0, logical block 43, async page read syz-executor.0: attempt to access beyond end of device loop0: rw=0, sector=88, nr_sectors = 2 limit=0 Buffer I/O error on dev loop0, logical block 44, async page read syz-executor.0: attempt to access beyond end of device loop0: rw=0, sector=90, nr_sectors = 2 limit=0 Buffer I/O error on dev loop0, logical block 45, async page read syz-executor.0: attempt to access beyond end of device loop0: rw=0, sector=92, nr_sectors = 2 limit=0 Buffer I/O error on dev loop0, logical block 46, async page read