syzbot


KASAN: global-out-of-bounds Read in rcu_pending_pcpu_dequeue

Status: upstream: reported on 2025/02/22 23:33
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+636e4465e7193ea92a97@syzkaller.appspotmail.com
First crash: 5d12h, last: 5d12h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bcachefs?] KASAN: global-out-of-bounds Read in rcu_pending_pcpu_dequeue 0 (1) 2025/02/22 23:33

Sample crash report:
bcachefs (loop3): starting version 1.7: mi_btree_bitmap opts=errors=continue,metadata_checksum=none,data_checksum=none,compression=lz4,nocow
bcachefs (loop3): initializing new filesystem
bcachefs (loop3): going read-write
bcachefs (loop3): marking superblocks
------------[ cut here ]------------
==================================================================
BUG: KASAN: global-out-of-bounds in string_nocheck lib/vsprintf.c:632 [inline]
BUG: KASAN: global-out-of-bounds in string+0x229/0x2b0 lib/vsprintf.c:714
Read of size 1 at addr ffffffff8c74adc9 by task syz.3.23/6077

CPU: 0 UID: 0 PID: 6077 Comm: syz.3.23 Not tainted 6.14.0-rc3-syzkaller-00012-g2408a807bfc3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
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:378 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:489
 kasan_report+0x143/0x180 mm/kasan/report.c:602
 string_nocheck lib/vsprintf.c:632 [inline]
 string+0x229/0x2b0 lib/vsprintf.c:714
 vsnprintf+0x8b4/0x1220 lib/vsprintf.c:2843
 vprintk_store+0x482/0x1240 kernel/printk/printk.c:2279
 vprintk_emit+0x271/0xa10 kernel/printk/printk.c:2408
 __warn_printk+0x263/0x360 kernel/panic.c:797
 look_up_lock_class+0xdb/0x170 kernel/locking/lockdep.c:938
 register_lock_class+0x102/0x980 kernel/locking/lockdep.c:1292
 __lock_acquire+0xf3/0x2100 kernel/locking/lockdep.c:5103
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:119 [inline]
 _raw_spin_lock_irq+0xd3/0x120 kernel/locking/spinlock.c:170
 spin_lock_irq include/linux/spinlock.h:376 [inline]
 rcu_pending_pcpu_dequeue+0x29/0x2b0 fs/bcachefs/rcu_pending.c:538
 bkey_cached_alloc fs/bcachefs/btree_key_cache.c:143 [inline]
 btree_key_cache_create fs/bcachefs/btree_key_cache.c:222 [inline]
 btree_key_cache_fill+0x496/0x3840 fs/bcachefs/btree_key_cache.c:319
 bch2_btree_path_traverse_cached+0x8b2/0xc60 fs/bcachefs/btree_key_cache.c:381
 bch2_btree_path_traverse_one+0x46a/0x2930 fs/bcachefs/btree_iter.c:1179
 bch2_btree_path_traverse fs/bcachefs/btree_iter.h:249 [inline]
 bch2_btree_iter_peek_slot+0x8c0/0x27c0 fs/bcachefs/btree_iter.c:2784
 __bch2_bkey_get_iter fs/bcachefs/btree_iter.h:585 [inline]
 bch2_bkey_get_iter fs/bcachefs/btree_iter.h:599 [inline]
 bch2_trans_start_alloc_update_noupdate+0x385/0x5e0 fs/bcachefs/alloc_background.c:458
 __bch2_trans_mark_metadata_bucket fs/bcachefs/buckets.c:955 [inline]
 bch2_trans_mark_metadata_bucket+0x2f8/0x17b0 fs/bcachefs/buckets.c:1043
 bch2_trans_mark_metadata_sectors fs/bcachefs/buckets.c:1060 [inline]
 __bch2_trans_mark_dev_sb fs/bcachefs/buckets.c:1100 [inline]
 bch2_trans_mark_dev_sb+0x3f6/0x820 fs/bcachefs/buckets.c:1128
 bch2_trans_mark_dev_sbs_flags+0x6be/0x720 fs/bcachefs/buckets.c:1138
 bch2_fs_initialize+0xba0/0x1610 fs/bcachefs/recovery.c:1149
 bch2_fs_start+0x36d/0x610 fs/bcachefs/super.c:1042
 bch2_fs_get_tree+0xdb7/0x17a0 fs/bcachefs/fs.c:2203
 vfs_get_tree+0x90/0x2b0 fs/super.c:1814
 do_new_mount+0x2be/0xb40 fs/namespace.c:3560
 do_mount fs/namespace.c:3900 [inline]
 __do_sys_mount fs/namespace.c:4111 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4088
 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:0x7f189278e58a
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:00007f1893561e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f1893561ef0 RCX: 00007f189278e58a
RDX: 0000400000000100 RSI: 0000400000000180 RDI: 00007f1893561eb0
RBP: 0000400000000100 R08: 00007f1893561ef0 R09: 0000000000000010
R10: 0000000000000010 R11: 0000000000000246 R12: 0000400000000180
R13: 00007f1893561eb0 R14: 00000000000059fa R15: 0000400000000480
 </TASK>

The buggy address belongs to the variable:
 .str+0x9/0x20

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xc74a
flags: 0xfff00000002000(reserved|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000002000 ffffea000031d288 ffffea000031d288 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
 ffffffff8c74ac80: 00 00 00 02 f9 f9 f9 f9 00 05 f9 f9 02 f9 f9 f9
 ffffffff8c74ad00: 06 f9 f9 f9 00 00 00 00 f9 f9 f9 f9 00 00 00 00
>ffffffff8c74ad80: 00 00 00 00 00 00 00 00 00 01 f9 f9 00 00 00 04
                                              ^
 ffffffff8c74ae00: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
 ffffffff8c74ae80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/17 23:37 upstream 2408a807bfc3 429ea007 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: global-out-of-bounds Read in rcu_pending_pcpu_dequeue
* Struck through repros no longer work on HEAD.