syzbot


kernel BUG in bch2_bkey_cmp_packed

Status: upstream: reported C repro on 2024/10/25 06:48
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+8a0109511de9d4b61217@syzkaller.appspotmail.com
Fix commit: d335bb3fd3a4 bcachefs: Ancient versions with bad bkey_formats are no longer supported
Patched 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-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 ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 41d, last: 25d
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] [bcachefs?] kernel BUG in __bkey_unpack_pos 1 (4) 2024/11/08 05:02
[syzbot] [bcachefs?] kernel BUG in bch2_bkey_cmp_packed 0 (1) 2024/10/25 06:48

Sample crash report:
bcachefs (loop0): Fixed errors, running fsck a second time to verify fs is clean
bcachefs (loop0): done starting filesystem
------------[ cut here ]------------
kernel BUG at fs/bcachefs/bkey_cmp.h:104!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 UID: 0 PID: 5831 Comm: syz-executor173 Not tainted 6.12.0-rc6-syzkaller-00110-gff7afaeca1a1 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
RIP: 0010:__bch2_bkey_cmp_packed_format_checked_inlined fs/bcachefs/bkey_cmp.h:103 [inline]
RIP: 0010:bch2_bkey_cmp_packed_inlined fs/bcachefs/bkey_cmp.h:116 [inline]
RIP: 0010:bch2_bkey_cmp_packed+0xc9c/0xcb0 fs/bcachefs/bkey.c:1037
Code: 1a 45 b0 07 e8 65 78 86 fd 90 0f 0b e8 5d 78 86 fd 90 0f 0b e8 55 78 86 fd 90 0f 0b e8 4d 78 86 fd 90 0f 0b e8 45 78 86 fd 90 <0f> 0b e8 3d 78 86 fd 90 0f 0b 66 2e 0f 1f 84 00 00 00 00 00 90 90
RSP: 0018:ffffc9000364cf00 EFLAGS: 00010293
RAX: ffffffff840e61bb RBX: 1ffff920006c99e8 RCX: ffff88807dfa0000
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: 0000000000000001
RBP: ffffc9000364d090 R08: ffffffff840e5a5e R09: 0000000000000000
R10: ffffc9000364cfa0 R11: fffff520006c99f6 R12: 0000000000000001
R13: ffffffffffffffff R14: 0000000000000000 R15: ffffc9000364cfa0
FS:  000055558fa61380(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fff84920978 CR3: 00000000282e8000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bkey_packed_successor fs/bcachefs/bkey.c:428 [inline]
 bch2_bkey_pack_pos_lossy+0xc94/0x1990 fs/bcachefs/bkey.c:537
 bch2_btree_node_iter_init+0x894/0x4280 fs/bcachefs/bset.c:1313
 __btree_path_level_init fs/bcachefs/btree_iter.c:615 [inline]
 bch2_btree_path_level_init+0x4d2/0x9f0 fs/bcachefs/btree_iter.c:635
 btree_path_lock_root fs/bcachefs/btree_iter.c:769 [inline]
 bch2_btree_path_traverse_one+0x10de/0x2940 fs/bcachefs/btree_iter.c:1183
 bch2_btree_path_traverse fs/bcachefs/btree_iter.h:247 [inline]
 bch2_btree_iter_peek_slot+0x84f/0x2550 fs/bcachefs/btree_iter.c:2629
 bchfs_read+0x988/0x2be0 fs/bcachefs/fs-io-buffered.c:182
 bch2_readahead+0x1154/0x1930 fs/bcachefs/fs-io-buffered.c:277
 read_pages+0x17e/0x840 mm/readahead.c:160
 page_cache_ra_order+0xb00/0xdb0 mm/readahead.c:508
 page_cache_sync_readahead include/linux/pagemap.h:1394 [inline]
 filemap_get_pages+0x621/0x2540 mm/filemap.c:2547
 filemap_read+0x454/0xf90 mm/filemap.c:2645
 bch2_read_iter+0x1122/0x1470 fs/bcachefs/fs-io-direct.c:208
 __kernel_read+0x513/0x9d0 fs/read_write.c:527
 integrity_kernel_read+0xb0/0x100 security/integrity/iint.c:28
 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
 ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
 ima_calc_file_hash+0xae6/0x1b30 security/integrity/ima/ima_crypto.c:568
 ima_collect_measurement+0x520/0xb10 security/integrity/ima/ima_api.c:293
 process_measurement+0x1351/0x1fb0 security/integrity/ima/ima_main.c:372
 ima_file_check+0xf2/0x170 security/integrity/ima/ima_main.c:572
 security_file_post_open+0xb9/0x280 security/security.c:3129
 do_open fs/namei.c:3776 [inline]
 path_openat+0x2ccd/0x3590 fs/namei.c:3933
 do_filp_open+0x235/0x490 fs/namei.c:3960
 do_sys_openat2+0x13e/0x1d0 fs/open.c:1415
 do_sys_open fs/open.c:1430 [inline]
 __do_sys_openat fs/open.c:1446 [inline]
 __se_sys_openat fs/open.c:1441 [inline]
 __x64_sys_openat+0x247/0x2a0 fs/open.c:1441
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fac439399b9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007ffdd0faccd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007ffdd0faceb8 RCX: 00007fac439399b9
RDX: 0000000000000042 RSI: 0000000020000100 RDI: 00000000ffffff9c
RBP: 00007fac439b2610 R08: 0000000000005959 R09: 0000000000000000
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffdd0facea8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__bch2_bkey_cmp_packed_format_checked_inlined fs/bcachefs/bkey_cmp.h:103 [inline]
RIP: 0010:bch2_bkey_cmp_packed_inlined fs/bcachefs/bkey_cmp.h:116 [inline]
RIP: 0010:bch2_bkey_cmp_packed+0xc9c/0xcb0 fs/bcachefs/bkey.c:1037
Code: 1a 45 b0 07 e8 65 78 86 fd 90 0f 0b e8 5d 78 86 fd 90 0f 0b e8 55 78 86 fd 90 0f 0b e8 4d 78 86 fd 90 0f 0b e8 45 78 86 fd 90 <0f> 0b e8 3d 78 86 fd 90 0f 0b 66 2e 0f 1f 84 00 00 00 00 00 90 90
RSP: 0018:ffffc9000364cf00 EFLAGS: 00010293
RAX: ffffffff840e61bb RBX: 1ffff920006c99e8 RCX: ffff88807dfa0000
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: 0000000000000001
RBP: ffffc9000364d090 R08: ffffffff840e5a5e R09: 0000000000000000
R10: ffffc9000364cfa0 R11: fffff520006c99f6 R12: 0000000000000001
R13: ffffffffffffffff R14: 0000000000000000 R15: ffffc9000364cfa0
FS:  000055558fa61380(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fff84920978 CR3: 00000000282e8000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/07 12:45 upstream ff7afaeca1a1 867e44df .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs kernel BUG in bch2_bkey_cmp_packed
2024/10/22 19:06 upstream c2ee9f594da8 a573a9f4 .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_bkey_cmp_packed
2024/10/22 18:53 upstream c2ee9f594da8 a573a9f4 .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_bkey_cmp_packed
2024/10/27 09:15 upstream 850925a8133c 65e8686b .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in bch2_bkey_cmp_packed
2024/10/24 08:07 upstream c2ee9f594da8 15fa2979 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in bch2_bkey_cmp_packed
2024/10/24 06:15 upstream c2ee9f594da8 15fa2979 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in bch2_bkey_cmp_packed
2024/10/24 00:50 upstream c2ee9f594da8 15fa2979 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in bch2_bkey_cmp_packed
2024/10/22 18:38 upstream c2ee9f594da8 a573a9f4 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root kernel BUG in bch2_bkey_cmp_packed
* Struck through repros no longer work on HEAD.