2023-02-16 02:32:29

by Dipanjan Das

[permalink] [raw]
Subject: KMSAN: uninit-value in post_read_mst_fixup

Hi,

We would like to report the following bug which has been found by our
modified version of syzkaller.

======================================================
description: KMSAN: uninit-value in post_read_mst_fixup
affected file: fs/ntfs/mst.c
kernel version: 6.2.0-rc5
kernel commit: 41c66f47061608dc1fd493eebce198f0e74cc2d7
git tree: kmsan
kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=a9a22da1efde3af6
crash reproducer: attached
======================================================
Crash log:
======================================================
loop4: rw=0, sector=2046, nr_sectors = 1 limit=1152
syz-executor.4: attempt to access beyond end of device
loop4: rw=0, sector=2047, nr_sectors = 1 limit=1152
=====================================================
BUG: KMSAN: uninit-value in post_read_mst_fixup+0x93f/0xa30 fs/ntfs/mst.c:39
post_read_mst_fixup+0x93f/0xa30 fs/ntfs/mst.c:39
ntfs_end_buffer_async_read+0xda3/0x1700 fs/ntfs/aops.c:133
end_bio_bh_io_sync+0x129/0x1d0 fs/buffer.c:2655
bio_endio+0xb0f/0xb70 block/bio.c:1615
submit_bio_noacct+0x4a8/0x27b0 block/blk-core.c:809
submit_bio+0x22a/0x290 block/blk-core.c:838
submit_bh_wbc+0x77c/0x7f0 fs/buffer.c:2702
submit_bh+0x24/0x30 fs/buffer.c:2707
ntfs_read_block fs/ntfs/aops.c:345 [inline]
ntfs_read_folio+0x3649/0x3ab0 fs/ntfs/aops.c:436
filemap_read_folio+0xc7/0x360 mm/filemap.c:2426
do_read_cache_folio+0x654/0xbe0 mm/filemap.c:3553
do_read_cache_page mm/filemap.c:3595 [inline]
read_cache_page+0x5f/0x250 mm/filemap.c:3604
read_mapping_page include/linux/pagemap.h:755 [inline]
ntfs_map_page fs/ntfs/aops.h:75 [inline]
check_mft_mirror fs/ntfs/super.c:1109 [inline]
load_system_files+0x8e3/0x98f0 fs/ntfs/super.c:1772
ntfs_fill_super+0x30b4/0x4650 fs/ntfs/super.c:2892
mount_bdev+0x521/0x860 fs/super.c:1359
ntfs_mount+0x49/0x60 fs/ntfs/super.c:3049
legacy_get_tree+0x108/0x2b0 fs/fs_context.c:610
vfs_get_tree+0xa2/0x520 fs/super.c:1489
do_new_mount+0x6b7/0x15c0 fs/namespace.c:3145
path_mount+0x6fa/0x1ed0 fs/namespace.c:3475
do_mount fs/namespace.c:3488 [inline]
__do_sys_mount fs/namespace.c:3697 [inline]
__se_sys_mount+0x754/0x860 fs/namespace.c:3674
__x64_sys_mount+0xe0/0x140 fs/namespace.c:3674
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Uninit was created at:
__alloc_pages+0x767/0xee0 mm/page_alloc.c:5572
alloc_pages+0xa9a/0xd90 mm/mempolicy.c:2286
folio_alloc+0x41/0x100 mm/mempolicy.c:2296
filemap_alloc_folio+0xa5/0x450 mm/filemap.c:972
do_read_cache_folio+0x2cf/0xbe0 mm/filemap.c:3517
do_read_cache_page mm/filemap.c:3595 [inline]
read_cache_page+0x5f/0x250 mm/filemap.c:3604
read_mapping_page include/linux/pagemap.h:755 [inline]
ntfs_map_page fs/ntfs/aops.h:75 [inline]
check_mft_mirror fs/ntfs/super.c:1109 [inline]
load_system_files+0x8e3/0x98f0 fs/ntfs/super.c:1772
ntfs_fill_super+0x30b4/0x4650 fs/ntfs/super.c:2892
mount_bdev+0x521/0x860 fs/super.c:1359
ntfs_mount+0x49/0x60 fs/ntfs/super.c:3049
legacy_get_tree+0x108/0x2b0 fs/fs_context.c:610
vfs_get_tree+0xa2/0x520 fs/super.c:1489
do_new_mount+0x6b7/0x15c0 fs/namespace.c:3145
path_mount+0x6fa/0x1ed0 fs/namespace.c:3475
do_mount fs/namespace.c:3488 [inline]
__do_sys_mount fs/namespace.c:3697 [inline]
__se_sys_mount+0x754/0x860 fs/namespace.c:3674
__x64_sys_mount+0xe0/0x140 fs/namespace.c:3674
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

CPU: 1 PID: 12835 Comm: syz-executor.4 Not tainted
6.2.0-rc5-00010-g41c66f470616 #8
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
=====================================================

--
Thanks and Regards,

Dipanjan


Attachments:
repro.syz (50.71 kB)
repro.c (133.00 kB)
Download all attachments