====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.3.2414/15154 is trying to acquire lock: ffff8880797a40b0 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x1c3/0x240 fs/hfs/bfind.c:36 but task is already holding lock: ffff88803242c1f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xa1/0xb10 fs/hfs/extent.c:397 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 hfs_extend_file+0xa1/0xb10 fs/hfs/extent.c:397 hfs_bmap_reserve+0x2a2/0x390 fs/hfs/btree.c:269 __hfs_ext_write_extent+0x3cf/0x520 fs/hfs/extent.c:121 __hfs_ext_cache_extent fs/hfs/extent.c:174 [inline] hfs_ext_read_extent+0x807/0x9e0 fs/hfs/extent.c:202 hfs_extend_file+0x4e2/0xb10 fs/hfs/extent.c:401 hfs_get_block+0x17f/0x830 fs/hfs/extent.c:353 __block_write_begin_int+0x4f4/0x16d0 fs/buffer.c:2145 block_write_begin+0x9a/0x1d0 fs/buffer.c:2256 cont_write_begin+0x61b/0x950 fs/buffer.c:2594 hfs_write_begin+0x64/0x120 fs/hfs/inode.c:52 cont_expand_zero fs/buffer.c:2522 [inline] cont_write_begin+0x350/0x950 fs/buffer.c:2584 hfs_write_begin+0x64/0x120 fs/hfs/inode.c:52 hfs_file_truncate+0xc0f/0xfc0 fs/hfs/extent.c:494 hfs_inode_setattr+0x48e/0x5e0 fs/hfs/inode.c:654 notify_change+0x6a9/0x1230 fs/attr.c:552 do_truncate+0x1d7/0x230 fs/open.c:68 vfs_truncate+0x5d6/0x6e0 fs/open.c:118 do_sys_truncate fs/open.c:141 [inline] __do_sys_truncate fs/open.c:153 [inline] __se_sys_truncate fs/open.c:151 [inline] __x64_sys_truncate+0x172/0x1e0 fs/open.c:151 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&tree->tree_lock/1){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 hfs_find_init+0x1c3/0x240 fs/hfs/bfind.c:36 hfs_ext_read_extent+0x19b/0x9e0 fs/hfs/extent.c:200 hfs_extend_file+0x4e2/0xb10 fs/hfs/extent.c:401 hfs_bmap_reserve+0x2a2/0x390 fs/hfs/btree.c:269 hfs_cat_create+0x229/0x820 fs/hfs/catalog.c:104 hfs_create+0x6b/0xf0 fs/hfs/dir.c:202 lookup_open.isra.0+0x11d3/0x1580 fs/namei.c:3708 open_last_lookups fs/namei.c:3807 [inline] path_openat+0x893/0x2cb0 fs/namei.c:4043 do_filp_open+0x20b/0x470 fs/namei.c:4073 do_sys_openat2+0x11b/0x1d0 fs/open.c:1435 do_sys_open fs/open.c:1450 [inline] __do_sys_openat fs/open.c:1466 [inline] __se_sys_openat fs/open.c:1461 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1461 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); *** DEADLOCK *** 4 locks held by syz.3.2414/15154: #0: ffff8880797a6428 (sb_writers#12){.+.+}-{0:0}, at: open_last_lookups fs/namei.c:3796 [inline] #0: ffff8880797a6428 (sb_writers#12){.+.+}-{0:0}, at: path_openat+0x1f0f/0x2cb0 fs/namei.c:4043 #1: ffff88803242d720 (&type->i_mutex_dir_key#8){++++}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] #1: ffff88803242d720 (&type->i_mutex_dir_key#8){++++}-{4:4}, at: open_last_lookups fs/namei.c:3804 [inline] #1: ffff88803242d720 (&type->i_mutex_dir_key#8){++++}-{4:4}, at: path_openat+0x1534/0x2cb0 fs/namei.c:4043 #2: ffff8880797a20b0 (&tree->tree_lock){+.+.}-{4:4}, at: hfs_find_init+0x19c/0x240 fs/hfs/bfind.c:33 #3: ffff88803242c1f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xa1/0xb10 fs/hfs/extent.c:397 stack backtrace: CPU: 1 UID: 0 PID: 15154 Comm: syz.3.2414 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2043 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 hfs_find_init+0x1c3/0x240 fs/hfs/bfind.c:36 hfs_ext_read_extent+0x19b/0x9e0 fs/hfs/extent.c:200 hfs_extend_file+0x4e2/0xb10 fs/hfs/extent.c:401 hfs_bmap_reserve+0x2a2/0x390 fs/hfs/btree.c:269 hfs_cat_create+0x229/0x820 fs/hfs/catalog.c:104 hfs_create+0x6b/0xf0 fs/hfs/dir.c:202 lookup_open.isra.0+0x11d3/0x1580 fs/namei.c:3708 open_last_lookups fs/namei.c:3807 [inline] path_openat+0x893/0x2cb0 fs/namei.c:4043 do_filp_open+0x20b/0x470 fs/namei.c:4073 do_sys_openat2+0x11b/0x1d0 fs/open.c:1435 do_sys_open fs/open.c:1450 [inline] __do_sys_openat fs/open.c:1466 [inline] __se_sys_openat fs/open.c:1461 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1461 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc2bcd8ebe9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc2bdc85038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fc2bcfb6090 RCX: 00007fc2bcd8ebe9 RDX: 00000000000c4042 RSI: 0000200000000300 RDI: ffffffffffffff9c RBP: 00007fc2bce11e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fc2bcfb6128 R14: 00007fc2bcfb6090 R15: 00007ffec54ac308