Bug 199635 - UBSAN: Undefined behaviour in fs/ext4/readpage.c
Summary: UBSAN: Undefined behaviour in fs/ext4/readpage.c
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: ext4 (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: fs_ext4@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-07 15:48 UTC by Ivan Bulatovic
Modified: 2018-08-12 10:52 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.16.7
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Ivan Bulatovic 2018-05-07 15:48:06 UTC
After recompiling the 4.16.7 kernel with gcc 8.1, UBSAN reports the following:

[   25.134709] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: (null)
[   25.171336] ================================================================================
[   25.173900] UBSAN: Undefined behaviour in fs/ext4/readpage.c:129:13
[   25.176412] member access within null pointer of type 'struct page'
[   25.178890] CPU: 1 PID: 1 Comm: switch_root Not tainted 4.16.7-CUSTOM #1
[   25.180655] Hardware name: Gigabyte Technology Co., Ltd. H67MA-UD2H-B3/H67MA-UD2H-B3, BIOS F8 03/27/2012
[   25.182334] Call Trace:
[   25.183982]  dump_stack+0x62/0x9f
[   25.185643]  ubsan_epilogue+0x9/0x35
[   25.187254]  handle_null_ptr_deref+0x80/0x90
[   25.188855]  __ubsan_handle_type_mismatch_v1+0x6a/0x80
[   25.190457]  ext4_mpage_readpages+0x10f5/0x1120 [ext4]
[   25.192067]  ? __alloc_pages_nodemask+0x1cb/0x1630
[   25.193640]  ? __do_page_cache_readahead+0x30d/0x5a0
[   25.195181]  ? ondemand_readahead+0x24e/0x440
[   25.196675]  ? ondemand_readahead+0x24e/0x440
[   25.198504]  ? generic_file_buffered_read+0x7b1/0x10f0
[   25.200580]  ? find_held_lock+0x3d/0x140
[   25.202656]  ? __vfs_read+0x200/0x330
[   25.204736]  ? vfs_read+0x9c/0x1a0
[   25.206797]  ? kernel_read+0x67/0x140
[   25.208830]  ? prepare_binprm+0x1d8/0x350
[   25.210857]  ? do_execveat_common+0x664/0xe50
[   25.212861]  ? SyS_execve+0x23/0x30
[   25.214879]  ? do_syscall_64+0xad/0x5cc
[   25.216882]  ? page_fault+0x2f/0x50
[   25.218859]  ? entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[   25.220826] ================================================================================

UBSAN reported nothing when the same kernel was compiled with gcc 7.3.1 from Arch Linux repositories.
Comment 1 Ivan Bulatovic 2018-08-12 10:52:17 UTC
Fixed by commit: 3ca17b1f3628f916f79e0ab62f1bf0e45ec9ba92

Note You need to log in before you can comment on or make changes to this bug.