[syzbot] [bcachefs?] KMSAN: uninit-value in __bch2_alloc_v4_to_text
From: syzbot
Date: Tue Jun 17 2025 - 04:14:37 EST
Hello,
syzbot found the following issue on:
HEAD commit: e04c78d86a96 Linux 6.16-rc2
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16fdc90c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=db26f33438d76de9
dashboard link: https://syzkaller.appspot.com/bug?extid=8eb51728519f6659ef7b
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11fdc90c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=132995d4580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c0f064a5f302/disk-e04c78d8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b71205c143e3/vmlinux-e04c78d8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2abdee22b79e/bzImage-e04c78d8.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/3838d178b843/mount_2.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+8eb51728519f6659ef7b@xxxxxxxxxxxxxxxxxxxxxxxxx
cached_sectors 0
stripe 0
stripe_redundancy 0
io_time[READ] 1
io_time[WRITE] 1024
fragmentation 0
bp_start 7
incorrectly set at freespace:0:37:0 (free 0, genbits 0 should be 0), fixing
=====================================================
BUG: KMSAN: uninit-value in __bch2_alloc_v4_to_text+0x7a4/0xdf0 fs/bcachefs/alloc_background.c:355
__bch2_alloc_v4_to_text+0x7a4/0xdf0 fs/bcachefs/alloc_background.c:355
bch2_alloc_v4_to_text+0x181/0x1f0 fs/bcachefs/alloc_background.c:380
bch2_val_to_text fs/bcachefs/bkey_methods.c:321 [inline]
bch2_bkey_val_to_text+0x1e8/0x280 fs/bcachefs/bkey_methods.c:331
bch2_check_discard_freespace_key+0xe35/0x1a30 fs/bcachefs/alloc_background.c:1436
try_alloc_bucket fs/bcachefs/alloc_foreground.c:272 [inline]
bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:420 [inline]
bch2_bucket_alloc_trans+0x225d/0x3a40 fs/bcachefs/alloc_foreground.c:544
bch2_bucket_alloc_set_trans+0xebb/0x1c10 fs/bcachefs/alloc_foreground.c:728
__open_bucket_add_buckets+0x21f8/0x37b0 fs/bcachefs/alloc_foreground.c:925
open_bucket_add_buckets+0x347/0x580 fs/bcachefs/alloc_foreground.c:957
bch2_alloc_sectors_start_trans+0x1de1/0x3560 fs/bcachefs/alloc_foreground.c:-1
__bch2_btree_node_alloc fs/bcachefs/btree_update_interior.c:320 [inline]
bch2_btree_reserve_get+0x9fd/0x2120 fs/bcachefs/btree_update_interior.c:534
bch2_btree_update_start+0x2cf3/0x3620 fs/bcachefs/btree_update_interior.c:1289
bch2_btree_node_rewrite+0x1cd/0x1b50 fs/bcachefs/btree_update_interior.c:2245
bch2_btree_node_rewrite_key fs/bcachefs/btree_update_interior.c:2311 [inline]
async_btree_node_rewrite_work+0x6e8/0x10d0 fs/bcachefs/btree_update_interior.c:2368
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xb91/0x1d80 kernel/workqueue.c:3321
worker_thread+0xedf/0x1590 kernel/workqueue.c:3402
kthread+0xd5c/0xf00 kernel/kthread.c:464
ret_from_fork+0x1e0/0x310 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4154 [inline]
slab_alloc_node mm/slub.c:4197 [inline]
__do_kmalloc_node mm/slub.c:4327 [inline]
__kmalloc_noprof+0x95f/0x1310 mm/slub.c:4340
kmalloc_noprof include/linux/slab.h:909 [inline]
__bkey_cached_alloc fs/bcachefs/btree_key_cache.c:139 [inline]
bkey_cached_alloc fs/bcachefs/btree_key_cache.c:162 [inline]
btree_key_cache_create fs/bcachefs/btree_key_cache.c:231 [inline]
btree_key_cache_fill+0x784/0x4780 fs/bcachefs/btree_key_cache.c:344
bch2_btree_path_traverse_cached+0x10d7/0x1870 fs/bcachefs/btree_key_cache.c:399
bch2_btree_path_traverse_one+0x6db/0x4060 fs/bcachefs/btree_iter.c:1179
bch2_btree_path_traverse fs/bcachefs/btree_iter.h:250 [inline]
bch2_btree_iter_peek_slot+0xd74/0x3910 fs/bcachefs/btree_iter.c:2781
__bch2_bkey_get_iter fs/bcachefs/btree_iter.h:632 [inline]
bch2_bkey_get_iter fs/bcachefs/btree_iter.h:646 [inline]
bch2_check_discard_freespace_key+0x321/0x1a30 fs/bcachefs/alloc_background.c:1414
try_alloc_bucket fs/bcachefs/alloc_foreground.c:272 [inline]
bch2_bucket_alloc_freelist fs/bcachefs/alloc_foreground.c:420 [inline]
bch2_bucket_alloc_trans+0x225d/0x3a40 fs/bcachefs/alloc_foreground.c:544
bch2_bucket_alloc_set_trans+0xebb/0x1c10 fs/bcachefs/alloc_foreground.c:728
__open_bucket_add_buckets+0x21f8/0x37b0 fs/bcachefs/alloc_foreground.c:925
open_bucket_add_buckets+0x347/0x580 fs/bcachefs/alloc_foreground.c:957
bch2_alloc_sectors_start_trans+0x1de1/0x3560 fs/bcachefs/alloc_foreground.c:-1
__bch2_btree_node_alloc fs/bcachefs/btree_update_interior.c:320 [inline]
bch2_btree_reserve_get+0x9fd/0x2120 fs/bcachefs/btree_update_interior.c:534
bch2_btree_update_start+0x2cf3/0x3620 fs/bcachefs/btree_update_interior.c:1289
bch2_btree_node_rewrite+0x1cd/0x1b50 fs/bcachefs/btree_update_interior.c:2245
bch2_btree_node_rewrite_key fs/bcachefs/btree_update_interior.c:2311 [inline]
async_btree_node_rewrite_work+0x6e8/0x10d0 fs/bcachefs/btree_update_interior.c:2368
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xb91/0x1d80 kernel/workqueue.c:3321
worker_thread+0xedf/0x1590 kernel/workqueue.c:3402
kthread+0xd5c/0xf00 kernel/kthread.c:464
ret_from_fork+0x1e0/0x310 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
CPU: 1 UID: 0 PID: 4181 Comm: kworker/u8:21 Not tainted 6.16.0-rc2-syzkaller #0 PREEMPT(undef)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: btree_node_rewrite async_btree_node_rewrite_work
=====================================================
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup