syzbot


kernel BUG in bch2_btree_repair_topology_recurse

Status: upstream: reported C repro on 2025/07/31 09:11
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+9eb4c69fd4d4a1934f3a@syzkaller.appspotmail.com
Fix commit: bcachefs: btree_check_root_boundaries()
Patched on: [], missing on: [ci-qemu-gce-upstream-auto ci-qemu-native-arm64-kvm ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-qemu2-riscv64 ci-snapshot-upstream-root ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci-upstream-rust-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb]
First crash: 3d05h, last: 3d02h
Cause bisection: introduced by (bisect log) :
commit c366b1672d74cb008974f6e36e34dc191621f3bb
Author: Kent Overstreet <kent.overstreet@linux.dev>
Date: Sat Apr 26 13:31:23 2025 +0000

  bcachefs: btree_node_data_missing is now autofix

Crash: kernel BUG in bch2_btree_path_level_init (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bcachefs?] kernel BUG in bch2_btree_repair_topology_recurse 0 (3) 2025/08/01 23:03

Sample crash report:
  prev: u64s 11 type btree_ptr_v2 0:82:0 len 0 ver 0: seq af8d2de42da20fd1 written 16 min_key R 0:0:16777215 durability: 1 ptr: 0:141:0 gen 0
  next: u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 4f44a3ebe7de7b3c written 16 min_key 0:457:1 durability: 1 ptr: 0:174:0 gen 0, fixing
bcachefs (loop0): set_node_min(): u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 4f44a3ebe7de7b3c written 16 min_key 0:457:1 durability: 1 ptr: 0:174:0 gen 0 -> 0:82:1
bcachefs (loop0): btree root with incorrect min_key: 0:0:16777215
  btree=alloc level=1 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 3a29d24e27fd9a2e written 65534 min_key R 0:0:16777215 durability: 1 ptr: 0:178:0 gen 0
  btree topology error: 
------------[ cut here ]------------
kernel BUG at fs/bcachefs/btree_gc.c:528!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 5819 Comm: syz-executor134 Tainted: G        W           6.16.0-syzkaller-06699-ge8d780dcd957 #0 PREEMPT_{RT,(full)} 
Tainted: [W]=WARN
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
RIP: 0010:bch2_btree_repair_topology_recurse+0x52dc/0x52e0 fs/bcachefs/btree_gc.c:528
Code: fd 90 0f 0b e8 c5 21 a7 fd 90 0f 0b e8 bd 21 a7 fd 90 0f 0b e8 b5 21 a7 fd 90 0f 0b e8 ad 21 a7 fd 90 0f 0b e8 a5 21 a7 fd 90 <0f> 0b 66 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f
RSP: 0018:ffffc900049cea60 EFLAGS: 00010293
RAX: ffffffff8417669b RBX: 00000000fffff6e8 RCX: ffff8880383d9dc0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900049cef90 R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: fffffbfff1df4a1f R12: ffff8881422ce700
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff888042e68000
FS:  000055558126a380(0000) GS:ffff888126c1c000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000563e00254ef0 CR3: 00000000341da000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 bch2_check_topology+0x692/0xe00 fs/bcachefs/btree_gc.c:602
 bch2_run_recovery_pass fs/bcachefs/recovery_passes.c:484 [inline]
 __bch2_run_recovery_passes+0x395/0x1010 fs/bcachefs/recovery_passes.c:539
 bch2_run_recovery_passes+0x184/0x210 fs/bcachefs/recovery_passes.c:610
 bch2_fs_recovery+0x2690/0x3a50 fs/bcachefs/recovery.c:1016
 bch2_fs_start+0xaaf/0xda0 fs/bcachefs/super.c:1213
 bch2_fs_get_tree+0xb39/0x1520 fs/bcachefs/fs.c:2488
 vfs_get_tree+0x8f/0x2b0 fs/super.c:1815
 do_new_mount+0x2a2/0x9e0 fs/namespace.c:3805
 do_mount fs/namespace.c:4133 [inline]
 __do_sys_mount fs/namespace.c:4344 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4321
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff250a46eaa
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffdc384708 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fffdc384720 RCX: 00007ff250a46eaa
RDX: 0000200000001000 RSI: 0000200000001040 RDI: 00007fffdc384720
RBP: 0000200000001040 R08: 00007fffdc384760 R09: 0000000000004912
R10: 0000000000000000 R11: 0000000000000282 R12: 0000200000001000
R13: 00007fffdc384760 R14: 0000000000000003 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bch2_btree_repair_topology_recurse+0x52dc/0x52e0 fs/bcachefs/btree_gc.c:528
Code: fd 90 0f 0b e8 c5 21 a7 fd 90 0f 0b e8 bd 21 a7 fd 90 0f 0b e8 b5 21 a7 fd 90 0f 0b e8 ad 21 a7 fd 90 0f 0b e8 a5 21 a7 fd 90 <0f> 0b 66 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f
RSP: 0018:ffffc900049cea60 EFLAGS: 00010293
RAX: ffffffff8417669b RBX: 00000000fffff6e8 RCX: ffff8880383d9dc0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900049cef90 R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: fffffbfff1df4a1f R12: ffff8881422ce700
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff888042e68000
FS:  000055558126a380(0000) GS:ffff888126c1c000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000563e00254ef0 CR3: 00000000341da000 CR4: 00000000003526f0

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/31 11:35 upstream e8d780dcd957 f8f2b4da .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs kernel BUG in bch2_btree_repair_topology_recurse
2025/07/31 08:20 upstream 260f6f4fda93 f8f2b4da .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root kernel BUG in bch2_btree_repair_topology_recurse
2025/07/31 08:07 upstream 260f6f4fda93 f8f2b4da .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in bch2_btree_repair_topology_recurse
* Struck through repros no longer work on HEAD.