[syzbot] [bcachefs?] kernel BUG in bch2_btree_path_level_init

From: syzbot
Date: Wed Jun 12 2024 - 03:04:45 EST


Hello,

syzbot found the following issue on:

HEAD commit: 8867bbd4a056 mm: arm64: Fix the out-of-bounds issue in con..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=1749a2e2980000
kernel config: https://syzkaller.appspot.com/x/.config?x=3b4350cf56c61c80
dashboard link: https://syzkaller.appspot.com/bug?extid=dd828a1b596932a42e10
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1206d55a980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16e839ac980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6ea21f50498b/disk-8867bbd4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e2fed09364aa/vmlinux-8867bbd4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4860173c7a18/Image-8867bbd4.gz.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/9f1aae1e19b4/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+dd828a1b596932a42e10@xxxxxxxxxxxxxxxxxxxxxxxxx

------------[ cut here ]------------
kernel BUG at fs/bcachefs/btree_iter.c:645!
Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 27 Comm: kworker/1:1 Tainted: G W 6.10.0-rc2-syzkaller-g8867bbd4a056 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Workqueue: bcachefs_write_ref bch2_do_invalidates_work
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : bch2_btree_path_level_init+0x820/0x83c fs/bcachefs/btree_iter.c:113
lr : btree_path_pos_in_node fs/bcachefs/btree_iter.c:113 [inline]
lr : bch2_btree_path_level_init+0x820/0x83c fs/bcachefs/btree_iter.c:645
sp : ffff800093f06d30
x29: ffff800093f06d40 x28: dfff800000000000 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000008000 x24: 0000000000000000
x23: 0000000000000000 x22: 0000000000000000 x21: ffff0000d4718234
x20: ffff0000d8597800 x19: ffff0000d4718230 x18: ffff800093f079d4
x17: 000000000000cd7d x16: ffff80008af156e8 x15: ffff7000127e0d94
x14: ffff80008eff0558 x13: dfff800000000000 x12: 00000000e50ce57d
x11: 0000000000000002 x10: 0000000000ff0100 x9 : 0000000000000000
x8 : ffff0000c1b7dac0 x7 : ffff80008278cf60 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0000d8597800 x1 : 0000000000008000 x0 : 0000000000000000
Call trace:
btree_path_pos_in_node fs/bcachefs/btree_iter.c:113 [inline]
bch2_btree_path_level_init+0x820/0x83c fs/bcachefs/btree_iter.c:645
btree_path_lock_root fs/bcachefs/btree_iter.c:783 [inline]
bch2_btree_path_traverse_one+0xd84/0x285c fs/bcachefs/btree_iter.c:1182
bch2_btree_path_traverse fs/bcachefs/btree_iter.h:229 [inline]
__bch2_btree_iter_peek fs/bcachefs/btree_iter.c:2185 [inline]
bch2_btree_iter_peek_upto+0xbd8/0x56e4 fs/bcachefs/btree_iter.c:2285
bch2_btree_iter_peek_upto_type fs/bcachefs/btree_iter.h:641 [inline]
bch2_do_invalidates_work+0x454/0x249c fs/bcachefs/alloc_background.c:2010
process_one_work+0x7b0/0x15e8 kernel/workqueue.c:3231
process_scheduled_works kernel/workqueue.c:3312 [inline]
worker_thread+0x938/0xef4 kernel/workqueue.c:3393
kthread+0x288/0x310 kernel/kthread.c:389
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
Code: d4210000 9777e81c d4210000 9777e81a (d4210000)
---[ end trace 0000000000000000 ]---


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup