loop4: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.6.0-rc7-syzkaller-gac9e855ce293 #0 Not tainted ------------------------------------------------------ syz-executor.4/18224 is trying to acquire lock: ffff00010a9168f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_free+0xcc/0x4b8 fs/hfsplus/bitmap.c:182 but task is already holding lock: ffff0001072cf3c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x250/0x9b8 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+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 hfsplus_get_block+0x2c4/0x1168 fs/hfsplus/extents.c:260 block_read_full_folio+0x3f8/0xd84 fs/buffer.c:2400 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 filemap_read_folio+0x14c/0x39c mm/filemap.c:2382 do_read_cache_folio+0x114/0x548 mm/filemap.c:3742 do_read_cache_page+0x4c/0x260 mm/filemap.c:3808 read_cache_page+0x68/0x84 mm/filemap.c:3817 read_mapping_page include/linux/pagemap.h:860 [inline] hfsplus_block_allocate+0xe0/0x824 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x7b4/0x1544 fs/hfsplus/extents.c:468 hfsplus_get_block+0x398/0x1168 fs/hfsplus/extents.c:245 __block_write_begin_int+0x46c/0x158c fs/buffer.c:2120 __block_write_begin fs/buffer.c:2169 [inline] block_write_begin fs/buffer.c:2228 [inline] cont_write_begin+0x79c/0xc40 fs/buffer.c:2585 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:52 cont_expand_zero fs/buffer.c:2545 [inline] cont_write_begin+0x86c/0xc40 fs/buffer.c:2575 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:52 generic_cont_expand_simple+0x160/0x258 fs/buffer.c:2476 hfsplus_setattr+0x148/0x248 fs/hfsplus/inode.c:263 notify_change+0x9d4/0xc8c fs/attr.c:499 do_truncate+0x1c0/0x28c fs/open.c:66 do_sys_ftruncate+0x284/0x318 fs/open.c:194 __do_sys_ftruncate fs/open.c:205 [inline] __se_sys_ftruncate fs/open.c:203 [inline] __arm64_sys_ftruncate+0x60/0x74 fs/open.c:203 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 -> #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+0x3370/0x75e8 kernel/locking/lockdep.c:5136 lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5753 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 hfsplus_block_free+0xcc/0x4b8 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x148/0x8d4 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0x698/0x9b8 fs/hfsplus/extents.c:591 hfsplus_setattr+0x18c/0x248 fs/hfsplus/inode.c:269 notify_change+0x9d4/0xc8c fs/attr.c:499 do_truncate+0x1c0/0x28c fs/open.c:66 vfs_truncate+0x2b8/0x360 fs/open.c:112 do_sys_truncate+0xec/0x1b4 fs/open.c:135 __do_sys_truncate fs/open.c:147 [inline] __se_sys_truncate fs/open.c:145 [inline] __arm64_sys_truncate+0x5c/0x70 fs/open.c:145 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 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.4/18224: #0: ffff0000db3bc410 (sb_writers#27){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:403 #1: ffff0001072cf5c0 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline] #1: ffff0001072cf5c0 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: do_truncate+0x1ac/0x28c fs/open.c:64 #2: ffff0001072cf3c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x250/0x9b8 fs/hfsplus/extents.c:576 stack backtrace: CPU: 1 PID: 18224 Comm: syz-executor.4 Not tainted 6.6.0-rc7-syzkaller-gac9e855ce293 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233 show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 dump_stack+0x1c/0x28 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2060 check_noncircular+0x310/0x404 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+0x3370/0x75e8 kernel/locking/lockdep.c:5136 lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5753 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 hfsplus_block_free+0xcc/0x4b8 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x148/0x8d4 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0x698/0x9b8 fs/hfsplus/extents.c:591 hfsplus_setattr+0x18c/0x248 fs/hfsplus/inode.c:269 notify_change+0x9d4/0xc8c fs/attr.c:499 do_truncate+0x1c0/0x28c fs/open.c:66 vfs_truncate+0x2b8/0x360 fs/open.c:112 do_sys_truncate+0xec/0x1b4 fs/open.c:135 __do_sys_truncate fs/open.c:147 [inline] __se_sys_truncate fs/open.c:145 [inline] __arm64_sys_truncate+0x5c/0x70 fs/open.c:145 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595