hfs: unable to locate alternate MDB hfs: continuing without an alternate MDB ====================================================== WARNING: possible circular locking dependency detected 6.3.0-rc4-syzkaller-g59caa87f9dfb #0 Not tainted ------------------------------------------------------ syz-executor.5/12175 is trying to acquire lock: ffff00012fc21478 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xe4/0x1130 fs/hfs/extent.c:397 but task is already holding lock: ffff0001282840b0 (&tree->tree_lock#2/1){+.+.}-{3:3}, at: hfs_find_init+0x148/0x1c8 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&tree->tree_lock#2/1){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 hfs_find_init+0x148/0x1c8 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_extend_file+0x270/0x1130 fs/hfs/extent.c:401 hfs_bmap_reserve+0xd0/0x3b4 fs/hfs/btree.c:234 hfs_cat_create+0x1bc/0x844 fs/hfs/catalog.c:104 hfs_create+0x70/0xe4 fs/hfs/dir.c:202 lookup_open fs/namei.c:3416 [inline] open_last_lookups fs/namei.c:3484 [inline] path_openat+0xf80/0x27f8 fs/namei.c:3712 do_filp_open+0x1bc/0x3cc fs/namei.c:3742 do_sys_openat2+0x128/0x3d8 fs/open.c:1348 do_sys_open fs/open.c:1364 [inline] __do_sys_openat fs/open.c:1380 [inline] __se_sys_openat fs/open.c:1375 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1375 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 -> #0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain kernel/locking/lockdep.c:3832 [inline] __lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056 lock_acquire+0x238/0x718 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 hfs_extend_file+0xe4/0x1130 fs/hfs/extent.c:397 hfs_bmap_reserve+0xd0/0x3b4 fs/hfs/btree.c:234 __hfs_ext_write_extent+0x1a0/0x468 fs/hfs/extent.c:121 __hfs_ext_cache_extent+0x84/0x754 fs/hfs/extent.c:174 hfs_ext_read_extent fs/hfs/extent.c:202 [inline] hfs_extend_file+0x29c/0x1130 fs/hfs/extent.c:401 hfs_get_block+0x3b8/0x9e0 fs/hfs/extent.c:353 __block_write_begin_int+0x3ec/0x1640 fs/buffer.c:2034 __block_write_begin fs/buffer.c:2084 [inline] block_write_begin fs/buffer.c:2145 [inline] cont_write_begin+0x7b8/0xc78 fs/buffer.c:2504 hfs_write_begin+0x98/0xe4 fs/hfs/inode.c:58 generic_perform_write+0x278/0x55c mm/filemap.c:3926 __generic_file_write_iter+0x168/0x388 mm/filemap.c:4054 generic_file_write_iter+0xb8/0x2b4 mm/filemap.c:4086 call_write_iter include/linux/fs.h:1851 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x610/0x914 fs/read_write.c:584 ksys_write+0x15c/0x26c fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:646 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock#2/1); lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock#2/1); lock(&HFS_I(tree->inode)->extents_lock); *** DEADLOCK *** 5 locks held by syz-executor.5/12175: #0: ffff0000d52905e8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xd8/0x104 fs/file.c:1047 #1: ffff0000c7998460 (sb_writers#27){.+.+}-{0:0}, at: vfs_write+0x244/0x914 fs/read_write.c:580 #2: ffff00012fc202a8 (&sb->s_type->i_mutex_key#29){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline] #2: ffff00012fc202a8 (&sb->s_type->i_mutex_key#29){+.+.}-{3:3}, at: generic_file_write_iter+0x88/0x2b4 mm/filemap.c:4083 #3: ffff00012fc200f8 (&HFS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xe4/0x1130 fs/hfs/extent.c:397 #4: ffff0001282840b0 (&tree->tree_lock#2/1){+.+.}-{3:3}, at: hfs_find_init+0x148/0x1c8 stack backtrace: CPU: 1 PID: 12175 Comm: syz-executor.5 Not tainted 6.3.0-rc4-syzkaller-g59caa87f9dfb #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __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:2056 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain kernel/locking/lockdep.c:3832 [inline] __lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056 lock_acquire+0x238/0x718 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 hfs_extend_file+0xe4/0x1130 fs/hfs/extent.c:397 hfs_bmap_reserve+0xd0/0x3b4 fs/hfs/btree.c:234 __hfs_ext_write_extent+0x1a0/0x468 fs/hfs/extent.c:121 __hfs_ext_cache_extent+0x84/0x754 fs/hfs/extent.c:174 hfs_ext_read_extent fs/hfs/extent.c:202 [inline] hfs_extend_file+0x29c/0x1130 fs/hfs/extent.c:401 hfs_get_block+0x3b8/0x9e0 fs/hfs/extent.c:353 __block_write_begin_int+0x3ec/0x1640 fs/buffer.c:2034 __block_write_begin fs/buffer.c:2084 [inline] block_write_begin fs/buffer.c:2145 [inline] cont_write_begin+0x7b8/0xc78 fs/buffer.c:2504 hfs_write_begin+0x98/0xe4 fs/hfs/inode.c:58 generic_perform_write+0x278/0x55c mm/filemap.c:3926 __generic_file_write_iter+0x168/0x388 mm/filemap.c:4054 generic_file_write_iter+0xb8/0x2b4 mm/filemap.c:4086 call_write_iter include/linux/fs.h:1851 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x610/0x914 fs/read_write.c:584 ksys_write+0x15c/0x26c fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:646 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591