syzbot


KMSAN: uninit-value in LZ4_decompress_safe_partial

Status: upstream: reported C repro on 2024/12/03 18:30
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+3c88ea590c13f5f92152@syzkaller.appspotmail.com
First crash: 4d16h, last: 3d15h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bcachefs?] KMSAN: uninit-value in LZ4_decompress_safe_partial 0 (1) 2024/12/03 18:30
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 general protection fault in LZ4_decompress_safe_partial origin:lts C done done 2 457d 471d 0/2 auto-obsoleted due to no activity on 2023/12/13 06:02
upstream KASAN: use-after-free Read in LZ4_decompress_safe_partial erofs C done 13 976d 1132d 22/28 fixed on 2023/02/24 13:50

Sample crash report:
=====================================================
BUG: KMSAN: uninit-value in LZ4_decompress_generic lib/lz4/lz4_decompress.c:148 [inline]
BUG: KMSAN: uninit-value in LZ4_decompress_safe_partial+0x825/0x1e50 lib/lz4/lz4_decompress.c:473
 LZ4_decompress_generic lib/lz4/lz4_decompress.c:148 [inline]
 LZ4_decompress_safe_partial+0x825/0x1e50 lib/lz4/lz4_decompress.c:473
 __bio_uncompress+0x503/0xa30 fs/bcachefs/compress.c:166
 bch2_bio_uncompress+0x4d9/0x800 fs/bcachefs/compress.c:283
 __bch2_read_endio+0x1b17/0x3070 fs/bcachefs/io_read.c:617
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xae0/0x1c40 kernel/workqueue.c:3310
 worker_thread+0xea7/0x14f0 kernel/workqueue.c:3391
 kthread+0x3e2/0x540 kernel/kthread.c:389
 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Uninit was created at:
 __alloc_pages_noprof+0x9a7/0xe00 mm/page_alloc.c:4774
 alloc_pages_mpol_noprof+0x299/0x990 mm/mempolicy.c:2265
 alloc_pages_noprof+0x1bf/0x1e0 mm/mempolicy.c:2344
 __bio_alloc_page_pool fs/bcachefs/io_write.c:113 [inline]
 bch2_bio_alloc_pages_pool+0xc2/0x2d0 fs/bcachefs/io_write.c:134
 __bch2_read_extent+0x33b8/0x6a50 fs/bcachefs/io_read.c:988
 bch2_read_extent fs/bcachefs/io_read.h:120 [inline]
 bchfs_read+0x2f5e/0x3660 fs/bcachefs/fs-io-buffered.c:217
 bch2_readahead+0x14a8/0x1970 fs/bcachefs/fs-io-buffered.c:277
 read_pages+0x193/0x1110 mm/readahead.c:160
 page_cache_ra_order+0xdbb/0x1290 mm/readahead.c:513
 page_cache_sync_ra+0xed1/0x11a0 mm/readahead.c:613
 page_cache_sync_readahead include/linux/pagemap.h:1397 [inline]
 filemap_get_pages+0x5a8/0x3860 mm/filemap.c:2546
 filemap_read+0x613/0x1560 mm/filemap.c:2646
 bch2_read_iter+0x1a90/0x2010 fs/bcachefs/fs-io-direct.c:208
 __kernel_read+0x726/0xd30 fs/read_write.c:523
 integrity_kernel_read+0x77/0x90 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+0x1731/0x3c90 security/integrity/ima/ima_crypto.c:568
 ima_collect_measurement+0x464/0xd20 security/integrity/ima/ima_api.c:293
 process_measurement+0x294a/0x3f30 security/integrity/ima/ima_main.c:372
 ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:572
 security_file_post_open+0xc6/0x540 security/security.c:3121
 do_open fs/namei.c:3830 [inline]
 path_openat+0x58cc/0x6200 fs/namei.c:3987
 do_filp_open+0x268/0x600 fs/namei.c:4014
 do_sys_openat2+0x1bf/0x2f0 fs/open.c:1402
 do_sys_open fs/open.c:1417 [inline]
 __do_sys_openat fs/open.c:1433 [inline]
 __se_sys_openat fs/open.c:1428 [inline]
 __x64_sys_openat+0x2a1/0x310 fs/open.c:1428
 x64_sys_call+0x36f5/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:258
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 1 UID: 0 PID: 4883 Comm: kworker/u8:24 Not tainted 6.12.0-syzkaller-10740-g509f806f7f70 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: events_unbound __bch2_read_endio
=====================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/30 08:39 upstream 509f806f7f70 68914665 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kmsan-gce-root KMSAN: uninit-value in LZ4_decompress_safe_partial
2024/11/30 06:36 upstream 509f806f7f70 68914665 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kmsan-gce-root KMSAN: uninit-value in LZ4_decompress_safe_partial
2024/12/01 03:58 upstream 0e287d31b62b 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-root KMSAN: uninit-value in LZ4_decompress_safe_partial
2024/11/30 03:10 upstream 509f806f7f70 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-root KMSAN: uninit-value in LZ4_decompress_safe_partial
* Struck through repros no longer work on HEAD.