====================================================== WARNING: possible circular locking dependency detected 6.6.0-rc3-syzkaller-00044-g633b47cb009d #0 Not tainted ------------------------------------------------------ syz-executor.1/23744 is trying to acquire lock: ffff888075eac0f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_free+0xd2/0x530 fs/hfsplus/bitmap.c:182 but task is already holding lock: ffff88802928b048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x226/0x1120 fs/hfsplus/extents.c:576 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x181/0x1340 kernel/locking/mutex.c:747 hfsplus_get_block+0x277/0x9e0 fs/hfsplus/extents.c:260 block_read_full_folio+0x3df/0xae0 fs/buffer.c:2391 filemap_read_folio+0xe9/0x2c0 mm/filemap.c:2382 do_read_cache_folio+0x205/0x540 mm/filemap.c:3742 do_read_cache_page mm/filemap.c:3808 [inline] read_cache_page+0x5b/0x230 mm/filemap.c:3817 read_mapping_page include/linux/pagemap.h:860 [inline] hfsplus_block_allocate+0x144/0x990 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x440/0x1090 fs/hfsplus/extents.c:468 hfsplus_get_block+0x1ae/0x9e0 fs/hfsplus/extents.c:245 __block_write_begin_int+0x3c0/0x14d0 fs/buffer.c:2111 __block_write_begin fs/buffer.c:2160 [inline] block_write_begin+0xb1/0x490 fs/buffer.c:2219 cont_write_begin+0x52f/0x730 fs/buffer.c:2576 hfsplus_write_begin+0x87/0x140 fs/hfsplus/inode.c:52 cont_expand_zero fs/buffer.c:2536 [inline] cont_write_begin+0x5fd/0x730 fs/buffer.c:2566 hfsplus_write_begin+0x87/0x140 fs/hfsplus/inode.c:52 generic_cont_expand_simple+0x11f/0x200 fs/buffer.c:2467 hfsplus_setattr+0x193/0x2d0 fs/hfsplus/inode.c:263 notify_change+0x742/0x11c0 fs/attr.c:499 do_truncate+0x15c/0x220 fs/open.c:66 do_sys_ftruncate+0x6a2/0x790 fs/open.c:194 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 -> #0 (&sbi->alloc_mutex){+.+.}-{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:3868 [inline] __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5136 lock_acquire kernel/locking/lockdep.c:5753 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x181/0x1340 kernel/locking/mutex.c:747 hfsplus_block_free+0xd2/0x530 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x3a2/0x510 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0xe7f/0x1120 fs/hfsplus/extents.c:591 hfsplus_setattr+0x1eb/0x2d0 fs/hfsplus/inode.c:269 notify_change+0x742/0x11c0 fs/attr.c:499 do_truncate+0x15c/0x220 fs/open.c:66 vfs_truncate+0x3eb/0x4d0 fs/open.c:112 do_sys_truncate+0x153/0x190 fs/open.c:135 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); *** DEADLOCK *** 3 locks held by syz-executor.1/23744: #0: ffff888078d3a410 (sb_writers#22){.+.+}-{0:0}, at: vfs_truncate+0xea/0x4d0 fs/open.c:85 #1: ffff88802928b240 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline] #1: ffff88802928b240 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: do_truncate+0x14b/0x220 fs/open.c:64 #2: ffff88802928b048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x226/0x1120 fs/hfsplus/extents.c:576 stack backtrace: CPU: 3 PID: 23744 Comm: syz-executor.1 Not tainted 6.6.0-rc3-syzkaller-00044-g633b47cb009d #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+0xd9/0x1b0 lib/dump_stack.c:106 check_noncircular+0x311/0x3f0 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:3868 [inline] __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5136 lock_acquire kernel/locking/lockdep.c:5753 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x181/0x1340 kernel/locking/mutex.c:747 hfsplus_block_free+0xd2/0x530 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x3a2/0x510 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0xe7f/0x1120 fs/hfsplus/extents.c:591 hfsplus_setattr+0x1eb/0x2d0 fs/hfsplus/inode.c:269 notify_change+0x742/0x11c0 fs/attr.c:499 do_truncate+0x15c/0x220 fs/open.c:66 vfs_truncate+0x3eb/0x4d0 fs/open.c:112 do_sys_truncate+0x153/0x190 fs/open.c:135 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7f78579 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:00000000f7f735ac EFLAGS: 00000292 ORIG_RAX: 000000000000005c RAX: ffffffffffffffda RBX: 0000000020000040 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 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