Hello,
syzbot found the following issue on:
HEAD commit: 115472395b0a Linux 5.15.104
git tree: linux-5.15.y
console output:
https://syzkaller.appspot.com/x/log.txt?x=16c9a089c80000
kernel config:
https://syzkaller.appspot.com/x/.config?x=e597b110d58e7b4
dashboard link:
https://syzkaller.appspot.com/bug?extid=5ec6d29e9352c6f10dc7
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image:
https://storage.googleapis.com/syzbot-assets/76798ca1c9b6/disk-11547239.raw.xz
vmlinux:
https://storage.googleapis.com/syzbot-assets/3b608633c8f5/vmlinux-11547239.xz
kernel image:
https://storage.googleapis.com/syzbot-assets/8836fafb618b/Image-11547239.gz.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by:
syzbot+5ec6d2...@syzkaller.appspotmail.com
======================================================
WARNING: possible circular locking dependency detected
5.15.104-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.5/8016 is trying to acquire lock:
ffff0000cb1980b0 (&tree->tree_lock#2/1){+.+.}-{3:3}, at: hfs_find_init+0x148/0x1c8
but task is already holding lock:
ffff0000c7c44878 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xe4/0x10e4 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){+.+.}-{3:3}:
__mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743
hfs_extend_file+0xe4/0x10e4 fs/hfs/extent.c:397
hfs_bmap_reserve+0xd0/0x3b4 fs/hfs/btree.c:231
__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+0x278/0x10e4 fs/hfs/extent.c:401
hfs_get_block+0x3ac/0x9fc fs/hfs/extent.c:353
__block_write_begin_int+0x3ec/0x1608 fs/buffer.c:2012
__block_write_begin fs/buffer.c:2062 [inline]
block_write_begin fs/buffer.c:2122 [inline]
cont_write_begin+0x538/0x710 fs/buffer.c:2471
hfs_write_begin+0xa8/0xf8 fs/hfs/inode.c:59
generic_perform_write+0x24c/0x520 mm/filemap.c:3776
__generic_file_write_iter+0x230/0x454 mm/filemap.c:3903
generic_file_write_iter+0xb4/0x1b8 mm/filemap.c:3935
call_write_iter include/linux/fs.h:2103 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x87c/0xb3c fs/read_write.c:594
ksys_write+0x15c/0x26c fs/read_write.c:647
__do_sys_write fs/read_write.c:659 [inline]
__se_sys_write fs/read_write.c:656 [inline]
__arm64_sys_write+0x7c/0x90 fs/read_write.c:656
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
-> #0 (&tree->tree_lock#2/1){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3787 [inline]
__lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622
__mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743
hfs_find_init+0x148/0x1c8
hfs_ext_read_extent fs/hfs/extent.c:200 [inline]
hfs_extend_file+0x24c/0x10e4 fs/hfs/extent.c:401
hfs_bmap_reserve+0xd0/0x3b4 fs/hfs/btree.c:231
hfs_cat_create+0x1bc/0x844 fs/hfs/catalog.c:104
hfs_create+0x70/0xe4 fs/hfs/dir.c:202
lookup_open fs/namei.c:3392 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0xec0/0x26f0 fs/namei.c:3669
do_filp_open+0x1a8/0x3b4 fs/namei.c:3699
do_sys_openat2+0x128/0x3d8 fs/open.c:1211
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1238
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
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#2/1);
lock(&HFS_I(tree->inode)->extents_lock);
lock(&tree->tree_lock#2/1);
*** DEADLOCK ***
4 locks held by syz-executor.5/8016:
#0: ffff0000da9fa460 (sb_writers#18){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:377
#1: ffff0000c7c45728 (&type->i_mutex_dir_key#14){++++}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
#1: ffff0000c7c45728 (&type->i_mutex_dir_key#14){++++}-{3:3}, at: open_last_lookups fs/namei.c:3459 [inline]
#1: ffff0000c7c45728 (&type->i_mutex_dir_key#14){++++}-{3:3}, at: path_openat+0x63c/0x26f0 fs/namei.c:3669
#2: ffff00011b1660b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfs_find_init+0x148/0x1c8
#3: ffff0000c7c44878 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xe4/0x10e4 fs/hfs/extent.c:397
stack backtrace:
CPU: 1 PID: 8016 Comm: syz-executor.5 Not tainted 5.15.104-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3787 [inline]
__lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622
__mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743
hfs_find_init+0x148/0x1c8
hfs_ext_read_extent fs/hfs/extent.c:200 [inline]
hfs_extend_file+0x24c/0x10e4 fs/hfs/extent.c:401
hfs_bmap_reserve+0xd0/0x3b4 fs/hfs/btree.c:231
hfs_cat_create+0x1bc/0x844 fs/hfs/catalog.c:104
hfs_create+0x70/0xe4 fs/hfs/dir.c:202
lookup_open fs/namei.c:3392 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0xec0/0x26f0 fs/namei.c:3669
do_filp_open+0x1a8/0x3b4 fs/namei.c:3699
do_sys_openat2+0x128/0x3d8 fs/open.c:1211
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1238
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
hfs: request for non-existent node 16777216 in B*Tree
hfs: request for non-existent node 16777216 in B*Tree