syzbot


KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key

Status: upstream: reported C repro on 2025/03/06 17:57
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+b9d9de2aa46b1bbe575a@syzkaller.appspotmail.com
First crash: 9d08h, last: 6d03h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bcachefs?] KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key 1 (3) 2025/03/07 17:28
Last patch testing requests (1)
Created Duration User Patch Repo Result
2025/03/07 17:06 21m mmpgouride@gmail.com https://github.com/alanskind/bcachefs 47e4e14a59ecffbec0025733f1980d23b1a7c7ef report log

Sample crash report:
  u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq c6c25c03258c59c5 written 48 min_key 0:36028797018963968:0 durability: 1 ptr: 0:27:0 gen 0  
  node offset 8/48 bset u64s 2088 bset byte offset 360: bad k->u64s 0 (min 3 max 253), fixing
==================================================================
BUG: KASAN: slab-out-of-bounds in unpack_state_init fs/bcachefs/bkey.c:151 [inline]
BUG: KASAN: slab-out-of-bounds in __bch2_bkey_unpack_key+0x66/0xdd0 fs/bcachefs/bkey.c:269
Read of size 8 at addr ffff888053574140 by task kworker/0:1H/36

CPU: 0 UID: 0 PID: 36 Comm: kworker/0:1H Not tainted 6.14.0-rc5-syzkaller-00013-g99fa936e8e4f #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: bcachefs_btree_read_complete btree_node_read_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:408 [inline]
 print_report+0x16e/0x5b0 mm/kasan/report.c:521
 kasan_report+0x143/0x180 mm/kasan/report.c:634
 unpack_state_init fs/bcachefs/bkey.c:151 [inline]
 __bch2_bkey_unpack_key+0x66/0xdd0 fs/bcachefs/bkey.c:269
 __bkey_unpack_key_format_checked fs/bcachefs/bkey.h:407 [inline]
 __bkey_unpack_key fs/bcachefs/bkey.h:426 [inline]
 __bkey_disassemble fs/bcachefs/bkey.h:477 [inline]
 bkey_packed_valid+0x21e/0x6c0 fs/bcachefs/btree_io.c:875
 validate_bset_keys+0xeb5/0x1af0 fs/bcachefs/btree_io.c:987
 bch2_btree_node_read_done+0x2298/0x6180 fs/bcachefs/btree_io.c:1164
 btree_node_read_work+0x6dc/0x1380 fs/bcachefs/btree_io.c:1358
 process_one_work kernel/workqueue.c:3238 [inline]
 process_scheduled_works+0xabe/0x18e0 kernel/workqueue.c:3319
 worker_thread+0x870/0xd30 kernel/workqueue.c:3400
 kthread+0x7a9/0x920 kernel/kthread.c:464
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Last potentially related work creation:
------------[ cut here ]------------
pool index 16319 out of bounds (797) for stack id 9a6c3fc0
WARNING: CPU: 0 PID: 36 at lib/stackdepot.c:452 depot_fetch_stack+0x86/0xc0 lib/stackdepot.c:451
Modules linked in:
CPU: 0 UID: 0 PID: 36 Comm: kworker/0:1H Not tainted 6.14.0-rc5-syzkaller-00013-g99fa936e8e4f #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: bcachefs_btree_read_complete btree_node_read_work
RIP: 0010:depot_fetch_stack+0x86/0xc0 lib/stackdepot.c:451
Code: 83 7c 18 1c 00 74 38 48 01 d8 eb 24 90 0f 0b 90 44 39 f5 72 ca 90 48 c7 c7 63 fc 3a 8e 89 ee 44 89 f2 89 d9 e8 ab e2 53 fc 90 <0f> 0b 90 90 31 c0 5b 41 5e 5d c3 cc cc cc cc 90 0f 0b 90 eb ef 90
RSP: 0000:ffffc90000576d08 EFLAGS: 00010046
RAX: a98b856e26fe2600 RBX: 000000009a6c3fc0 RCX: ffff88801e00c880
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000003fbf R08: ffffffff81817e32 R09: 1ffff11003f8519a
R10: dffffc0000000000 R11: ffffed1003f8519b R12: ffff888053574140
R13: ffffea00014d5d00 R14: 000000000000031d R15: ffffc90000576de0
FS:  0000000000000000(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fabca6ea000 CR3: 0000000012240000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 stack_depot_fetch lib/stackdepot.c:714 [inline]
 stack_depot_print+0x16/0x50 lib/stackdepot.c:752
 kasan_print_aux_stacks+0x38/0x70 mm/kasan/report_generic.c:199
 describe_object_stacks mm/kasan/report.c:347 [inline]
 describe_object mm/kasan/report.c:353 [inline]
 print_address_description mm/kasan/report.c:412 [inline]
 print_report+0x22b/0x5b0 mm/kasan/report.c:521
 kasan_report+0x143/0x180 mm/kasan/report.c:634
 unpack_state_init fs/bcachefs/bkey.c:151 [inline]
 __bch2_bkey_unpack_key+0x66/0xdd0 fs/bcachefs/bkey.c:269
 __bkey_unpack_key_format_checked fs/bcachefs/bkey.h:407 [inline]
 __bkey_unpack_key fs/bcachefs/bkey.h:426 [inline]
 __bkey_disassemble fs/bcachefs/bkey.h:477 [inline]
 bkey_packed_valid+0x21e/0x6c0 fs/bcachefs/btree_io.c:875
 validate_bset_keys+0xeb5/0x1af0 fs/bcachefs/btree_io.c:987
 bch2_btree_node_read_done+0x2298/0x6180 fs/bcachefs/btree_io.c:1164
 btree_node_read_work+0x6dc/0x1380 fs/bcachefs/btree_io.c:1358
 process_one_work kernel/workqueue.c:3238 [inline]
 process_scheduled_works+0xabe/0x18e0 kernel/workqueue.c:3319
 worker_thread+0x870/0xd30 kernel/workqueue.c:3400
 kthread+0x7a9/0x920 kernel/kthread.c:464
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/04 17:37 upstream 99fa936e8e4f c3901742 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/05 23:03 upstream cfced12f5100 034534df .config console log report syz / log [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/05 17:25 upstream 48a5eed9ad58 60f5d8d9 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/05 16:32 upstream 48a5eed9ad58 60f5d8d9 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/04 21:12 upstream 99fa936e8e4f c3901742 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/04 19:55 upstream 99fa936e8e4f c3901742 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/04 15:34 upstream 99fa936e8e4f c3901742 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/04 12:20 upstream 99fa936e8e4f c3901742 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/03 14:09 upstream 7eb172143d55 c3901742 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/03 06:45 upstream 1973160c90d7 c3901742 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
2025/03/02 17:47 upstream ece144f151ac c3901742 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in __bch2_bkey_unpack_key
* Struck through repros no longer work on HEAD.