syzbot


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

Status: upstream: reported C repro on 2025/09/29 18:49
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+ba71155d3eacc8f42477@syzkaller.appspotmail.com
First crash: 3d12h, last: 2d17h
Cause bisection: failed (error log, bisect log)
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bcachefs?] KASAN: slab-out-of-bounds Read in bch2_btree_node_read_done 0 (1) 2025/09/29 18:49
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in bch2_btree_node_read_done bcachefs 19 C done 64 98d 308d 29/29 fixed on 2025/09/04 16:57

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in bch2_btree_node_read_done+0x950/0x5550 fs/bcachefs/btree_io.c:1128
Read of size 8 at addr ffff88805874a010 by task syz.0.17/6055

CPU: 0 UID: 0 PID: 6055 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xca/0x240 mm/kasan/report.c:482
 kasan_report+0x118/0x150 mm/kasan/report.c:595
 bch2_btree_node_read_done+0x950/0x5550 fs/bcachefs/btree_io.c:1128
 btree_node_read_work+0x40e/0xe60 fs/bcachefs/btree_io.c:1440
 bch2_btree_node_read+0x887/0x2a00 fs/bcachefs/btree_io.c:-1
 __bch2_btree_root_read fs/bcachefs/btree_io.c:1906 [inline]
 bch2_btree_root_read+0x5f0/0x760 fs/bcachefs/btree_io.c:1928
 read_btree_roots+0x2c6/0x840 fs/bcachefs/recovery.c:615
 bch2_fs_recovery+0x261f/0x3a50 fs/bcachefs/recovery.c:1006
 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:3808
 do_mount fs/namespace.c:4136 [inline]
 __do_sys_mount fs/namespace.c:4347 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4324
 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:0x7feb1599066a
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:00007ffe09e19a98 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffe09e19b20 RCX: 00007feb1599066a
RDX: 00002000000058c0 RSI: 0000200000000000 RDI: 00007ffe09e19ae0
RBP: 00002000000058c0 R08: 00007ffe09e19b20 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000200000000000
R13: 00007ffe09e19ae0 R14: 00000000000058f2 R15: 0000200000000180
 </TASK>

Allocated by task 6055:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:388 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:405
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __do_kmalloc_node mm/slub.c:4376 [inline]
 __kvmalloc_node_noprof+0x28d/0x550 mm/slub.c:5067
 btree_node_data_alloc+0xdc/0x270 fs/bcachefs/btree_cache.c:151
 __bch2_btree_node_mem_alloc+0x1dc/0x2e0 fs/bcachefs/btree_cache.c:193
 bch2_fs_btree_cache_init+0x314/0x880 fs/bcachefs/btree_cache.c:653
 bch2_fs_alloc fs/bcachefs/super.c:998 [inline]
 bch2_fs_open+0x1da6/0x26e0 fs/bcachefs/super.c:2433
 bch2_fs_get_tree+0x44f/0x1520 fs/bcachefs/fs.c:2472
 vfs_get_tree+0x8f/0x2b0 fs/super.c:1815
 do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808
 do_mount fs/namespace.c:4136 [inline]
 __do_sys_mount fs/namespace.c:4347 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4324
 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

The buggy address belongs to the object at ffff888058748000
 which belongs to the cache kmalloc-rcl-8k of size 8192
The buggy address is located 16 bytes to the right of
 allocated 8192-byte region [ffff888058748000, ffff88805874a000)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x58748
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880273c6ce1
flags: 0x80000000000040(head|node=0|zone=1)
page_type: f5(slab)
raw: 0080000000000040 ffff8880198483c0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080020002 00000000f5000000 ffff8880273c6ce1
head: 0080000000000040 ffff8880198483c0 dead000000000122 0000000000000000
head: 0000000000000000 0000000080020002 00000000f5000000 ffff8880273c6ce1
head: 0080000000000003 ffffea000161d201 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x528d0(GFP_NOWAIT|__GFP_RECLAIMABLE|__GFP_IO|__GFP_FS|__GFP_NORETRY|__GFP_COMP), pid 6055, tgid 6055 (syz.0.17), ts 114481807879, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
 prep_new_page mm/page_alloc.c:1859 [inline]
 get_page_from_freelist+0x2119/0x21b0 mm/page_alloc.c:3858
 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
 alloc_pages_mpol+0xd1/0x380 mm/mempolicy.c:2416
 alloc_slab_page mm/slub.c:2492 [inline]
 allocate_slab+0x8a/0x370 mm/slub.c:2660
 new_slab mm/slub.c:2714 [inline]
 ___slab_alloc+0x8d1/0xdc0 mm/slub.c:3901
 __slab_alloc mm/slub.c:3992 [inline]
 __slab_alloc_node mm/slub.c:4067 [inline]
 slab_alloc_node mm/slub.c:4228 [inline]
 __do_kmalloc_node mm/slub.c:4375 [inline]
 __kvmalloc_node_noprof+0x1d6/0x550 mm/slub.c:5067
 btree_node_data_alloc+0xdc/0x270 fs/bcachefs/btree_cache.c:151
 __bch2_btree_node_mem_alloc+0x1dc/0x2e0 fs/bcachefs/btree_cache.c:193
 bch2_fs_btree_cache_init+0x314/0x880 fs/bcachefs/btree_cache.c:653
 bch2_fs_alloc fs/bcachefs/super.c:998 [inline]
 bch2_fs_open+0x1da6/0x26e0 fs/bcachefs/super.c:2433
 bch2_fs_get_tree+0x44f/0x1520 fs/bcachefs/fs.c:2472
 vfs_get_tree+0x8f/0x2b0 fs/super.c:1815
 do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808
 do_mount fs/namespace.c:4136 [inline]
 __do_sys_mount fs/namespace.c:4347 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4324
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888058749f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888058749f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88805874a000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                         ^
 ffff88805874a080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805874a100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/09/27 08:57 upstream 083fc6d7fa0d 001c9061 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Read in bch2_btree_node_read_done
2025/09/26 13:32 upstream 4ff71af020ae 0abd0691 .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_btree_node_read_done
2025/09/26 13:20 upstream 4ff71af020ae 0abd0691 .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_btree_node_read_done
2025/09/26 13:08 upstream 4ff71af020ae 0abd0691 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in bch2_btree_node_read_done
* Struck through repros no longer work on HEAD.