syzbot


kernel BUG in __bch2_trans_commit (2)

Status: upstream: reported on 2025/05/24 15:03
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+42581416dba62b364750@syzkaller.appspotmail.com
Fix commit: bcachefs: Fix missing BTREE_UPDATE_internal_snapshot_node
Patched on: [ci-upstream-linux-next-kasan-gce-root], 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-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb]
First crash: 10d, last: 10d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bcachefs?] kernel BUG in __bch2_trans_commit (2) 1 (2) 2025/05/24 18:22
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream kernel BUG in __bch2_trans_commit bcachefs C unreliable 11858 197d 222d 28/28 fixed on 2025/05/11 00:44

Sample crash report:
  u64s 8 type dirent 4096:9097378837824744618:U32_MAX len 0 ver 0: file.cold -> 536870914 type reg, fixing
bcachefs (loop0): dirent points to missing inode:
  u64s 7 type dirent 4096:9181104441347170296:U32_MAX len 0 ver 0: file0 -> 4098 type dir, fixing
bcachefs (loop0): directory 4096:4294967295 with wrong i_nlink: got 0, should be 1, fixing
bcachefs (loop0): hash table key at wrong offset: btree dirents inode 4098 offset 5675548428000973578, hashed to 6487782572445408762
  u64s 7 type dirent 4098:5675548428000973578:U32_MAX len 0 ver 0: file1 -> 4100 type lnk, fixing
bcachefs (loop0): dirent points to inode that does not point back:
  u64s 7 type dirent 4098:6487782572445408762:U32_MAX len 0 ver 0: file1 -> 4100 type lnk
  inum: 4100:4294967295 
    mode=100600
    flags=(15300000)
    journal_seq=19
    hash_seed=c09572f56f2a867d
    hash_type=siphash
    bi_size=4096
    bi_sectors=8
    bi_version=0
    bi_atime=33055089404955356
    bi_ctime=33055089404955356
    bi_mtime=33055089404955356
    bi_otime=33055089404955356
    bi_uid=0
    bi_gid=0
    bi_nlink=0
    bi_generation=0
    bi_dev=0
    bi_data_checksum=0
    bi_compression=0
    bi_project=0
    bi_background_compression=0
    bi_data_replicas=0
    bi_promote_target=0
    bi_foreground_target=0
    bi_background_target=0
    bi_erasure_code=0
    bi_fields_set=0
    bi_dir=0
    bi_dir_offset=6487782572445408762
    bi_subvol=0
    bi_parent_subvol=0
    bi_nocow=0
    bi_depth=0
    bi_inodes_32bit=0
    bi_casefold=0, fixing
bcachefs (loop0): inode 4100:4294967295 has wrong backpointer:
  got       0:6487782572445408762
  should be 4098:6487782572445408762, fixing
bcachefs (loop0): incorrect d_type: got lnk, should be reg:
  u64s 7 type dirent 4098:6487782572445408762:U32_MAX len 0 ver 0: file1 -> 4100 type lnk, fixing
------------[ cut here ]------------
kernel BUG at fs/bcachefs/btree_trans_commit.c:346!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 5318 Comm: syz.0.0 Not tainted 6.15.0-rc7-syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:btree_insert_entry_checks fs/bcachefs/btree_trans_commit.c:341 [inline]
RIP: 0010:bch2_trans_commit_write_locked fs/bcachefs/btree_trans_commit.c:721 [inline]
RIP: 0010:do_bch2_trans_commit fs/bcachefs/btree_trans_commit.c:844 [inline]
RIP: 0010:__bch2_trans_commit+0x89a6/0x8ae0 fs/bcachefs/btree_trans_commit.c:1050
Code: ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c 1d ff ff ff 48 89 df e8 2a ad ff fd e9 10 ff ff ff e8 90 46 34 07 e8 fb b1 9d fd 90 <0f> 0b f3 0f 1e fa 65 8b 1d 51 a0 53 0e bf 07 00 00 00 89 de e8 21
RSP: 0018:ffffc9000fe5eae0 EFLAGS: 00010246
RAX: ffffffff84223fd5 RBX: ffffffff842201ca RCX: 0000000000100000
RDX: ffffc9000ddc2000 RSI: 00000000000fffff RDI: 0000000000100000
RBP: ffffc9000fe5edd0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: ffffffff842201ca R12: dffffc0000000000
R13: ffff8880562fc020 R14: ffff8880562fe468 R15: 0000000000000001
FS:  00007f14e6f436c0(0000) GS:ffff88808d6c2000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f60b65909c0 CR3: 0000000042ef5000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bch2_trans_commit fs/bcachefs/btree_update.h:195 [inline]
 check_dirent fs/bcachefs/fsck.c:2242 [inline]
 bch2_check_dirents+0x19ae/0x2460 fs/bcachefs/fsck.c:2272
 bch2_run_recovery_pass+0xdf/0x1d0 fs/bcachefs/recovery_passes.c:227
 bch2_run_recovery_passes+0x2a0/0xdb0 fs/bcachefs/recovery_passes.c:280
 bch2_fs_recovery+0x2399/0x37b0 fs/bcachefs/recovery.c:937
 bch2_fs_start+0x70b/0xae0 fs/bcachefs/super.c:1096
 bch2_fs_get_tree+0xad7/0x13b0 fs/bcachefs/fs.c:2507
 vfs_get_tree+0x8f/0x2b0 fs/super.c:1759
 do_new_mount+0x24a/0xa40 fs/namespace.c:3881
 do_mount fs/namespace.c:4221 [inline]
 __do_sys_mount fs/namespace.c:4432 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4409
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f14e619010a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f14e6f42e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f14e6f42ef0 RCX: 00007f14e619010a
RDX: 0000200000000000 RSI: 0000200000000040 RDI: 00007f14e6f42eb0
RBP: 0000200000000000 R08: 00007f14e6f42ef0 R09: 0000000003000005
R10: 0000000003000005 R11: 0000000000000246 R12: 0000200000000040
R13: 00007f14e6f42eb0 R14: 000000000000597c R15: 0000200000000280
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:btree_insert_entry_checks fs/bcachefs/btree_trans_commit.c:341 [inline]
RIP: 0010:bch2_trans_commit_write_locked fs/bcachefs/btree_trans_commit.c:721 [inline]
RIP: 0010:do_bch2_trans_commit fs/bcachefs/btree_trans_commit.c:844 [inline]
RIP: 0010:__bch2_trans_commit+0x89a6/0x8ae0 fs/bcachefs/btree_trans_commit.c:1050
Code: ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c 1d ff ff ff 48 89 df e8 2a ad ff fd e9 10 ff ff ff e8 90 46 34 07 e8 fb b1 9d fd 90 <0f> 0b f3 0f 1e fa 65 8b 1d 51 a0 53 0e bf 07 00 00 00 89 de e8 21
RSP: 0018:ffffc9000fe5eae0 EFLAGS: 00010246
RAX: ffffffff84223fd5 RBX: ffffffff842201ca RCX: 0000000000100000
RDX: ffffc9000ddc2000 RSI: 00000000000fffff RDI: 0000000000100000
RBP: ffffc9000fe5edd0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: ffffffff842201ca R12: dffffc0000000000
R13: ffff8880562fc020 R14: ffff8880562fe468 R15: 0000000000000001
FS:  00007f14e6f436c0(0000) GS:ffff88808d6c2000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f60b65909c0 CR3: 0000000042ef5000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/20 14:54 upstream a5806cd506af b47f9e02 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in __bch2_trans_commit
* Struck through repros no longer work on HEAD.