====================================================== WARNING: possible circular locking dependency detected 6.3.0-syzkaller-11025-g89d77f71f493 #0 Not tainted ------------------------------------------------------ syz-executor104/5000 is trying to acquire lock: ffff88807a8707c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x1d6/0x1b10 fs/hfsplus/extents.c:457 but task is already holding lock: ffff88807c4840b0 (&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: -> #1 (&tree->tree_lock){+.+.}-{3:3}: lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 hfsplus_file_truncate+0x811/0xb40 fs/hfsplus/extents.c:595 hfsplus_setattr+0x1bd/0x280 fs/hfsplus/inode.c:269 notify_change+0xc8b/0xf40 fs/attr.c:483 do_truncate+0x220/0x300 fs/open.c:66 handle_truncate fs/namei.c:3219 [inline] do_open fs/namei.c:3564 [inline] path_openat+0x294e/0x3170 fs/namei.c:3715 do_filp_open+0x234/0x490 fs/namei.c:3742 do_sys_openat2+0x13f/0x500 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_creat fs/open.c:1448 [inline] __se_sys_creat fs/open.c:1442 [inline] __x64_sys_creat+0x123/0x160 fs/open.c:1442 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3842 __lock_acquire+0x1295/0x2000 kernel/locking/lockdep.c:5074 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 hfsplus_file_extend+0x1d6/0x1b10 fs/hfsplus/extents.c:457 hfsplus_bmap_reserve+0x105/0x4e0 fs/hfsplus/btree.c:358 hfsplus_rename_cat+0x1d3/0x1090 fs/hfsplus/catalog.c:456 hfsplus_unlink+0x308/0x7f0 fs/hfsplus/dir.c:376 vfs_unlink+0x35d/0x5f0 fs/namei.c:4250 do_unlinkat+0x4a1/0x940 fs/namei.c:4316 do_coredump+0x2148/0x2980 fs/coredump.c:673 get_signal+0x145e/0x17e0 kernel/signal.c:2860 arch_do_signal_or_restart+0x91/0x670 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 irqentry_exit_to_user_mode+0x9/0x40 kernel/entry/common.c:310 exc_page_fault+0x71e/0x910 arch/x86/mm/fault.c:1593 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); *** DEADLOCK *** 5 locks held by syz-executor104/5000: #0: ffff88807c9f6460 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:394 #1: ffff888076498300 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:796 [inline] #1: ffff888076498300 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: do_unlinkat+0x264/0x940 fs/namei.c:4301 #2: ffff888076499e00 (&sb->s_type->i_mutex_key#16){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:761 [inline] #2: ffff888076499e00 (&sb->s_type->i_mutex_key#16){+.+.}-{3:3}, at: vfs_unlink+0xe4/0x5f0 fs/namei.c:4239 #3: ffff88814aafb198 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x161/0x7f0 fs/hfsplus/dir.c:370 #4: ffff88807c4840b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 stack backtrace: CPU: 1 PID: 5000 Comm: syz-executor104 Not tainted 6.3.0-syzkaller-11025-g89d77f71f493 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2188 check_prev_add kernel/locking/lockdep.c:3108 [inline] check_prevs_add kernel/locking/lockdep.c:3227 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3842 __lock_acquire+0x1295/0x2000 kernel/locking/lockdep.c:5074 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5691 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 hfsplus_file_extend+0x1d6/0x1b10 fs/hfsplus/extents.c:457 hfsplus_bmap_reserve+0x105/0x4e0 fs/hfsplus/btree.c:358 hfsplus_rename_cat+0x1d3/0x1090 fs/hfsplus/catalog.c:456 hfsplus_unlink+0x308/0x7f0 fs/hfsplus/dir.c:376 vfs_unlink+0x35d/0x5f0 fs/namei.c:4250 do_unlinkat+0x4a1/0x940 fs/namei.c:4316 do_coredump+0x2148/0x2980 fs/coredump.c:673 get_signal+0x145e/0x17e0 kernel/signal.c:2860 arch_do_signal_or_restart+0x91/0x670 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 irqentry_exit_to_user_mode+0x9/0x40 kernel/entry/common.c:310 exc_page_fault+0x71e/0x910 arch/x86/mm/fault.c:1593 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 002b:0000000020000008 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 000000000000003a RCX: 00007f424b16c259 RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000000 RBP: 00007fffc9bb6998 R08: 0000000000000000 R09: 00007f424b1dae40 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffc9bb69a0 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000