summaryrefslogtreecommitdiffstats
path: root/lib/linear_ranges.c
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2023-01-12 22:49:48 +0000
committerKees Cook <keescook@chromium.org>2023-01-13 15:22:03 -0800
commit42633ed852deadc14d44660ad71e2f6640239120 (patch)
treef310289c78f17243391c6af27d149ba4961c746c /lib/linear_ranges.c
parent3b293487b8752cc42c1cbf8a0447bc6076c075fa (diff)
downloadlinux-42633ed852deadc14d44660ad71e2f6640239120.tar.bz2
kbuild: Fix CFI hash randomization with KASAN
Clang emits a asan.module_ctor constructor to each object file when KASAN is enabled, and these functions are indirectly called in do_ctors. With CONFIG_CFI_CLANG, the compiler also emits a CFI type hash before each address-taken global function so they can pass indirect call checks. However, in commit 0c3e806ec0f9 ("x86/cfi: Add boot time hash randomization"), x86 implemented boot time hash randomization, which relies on the .cfi_sites section generated by objtool. As objtool is run against vmlinux.o instead of individual object files with X86_KERNEL_IBT (enabled by default), CFI types in object files that are not part of vmlinux.o end up not being included in .cfi_sites, and thus won't get randomized and trip CFI when called. Only .vmlinux.export.o and init/version-timestamp.o are linked into vmlinux separately from vmlinux.o. As these files don't contain any functions, disable KASAN for both of them to avoid breaking hash randomization. Link: https://github.com/ClangBuiltLinux/linux/issues/1742 Fixes: 0c3e806ec0f9 ("x86/cfi: Add boot time hash randomization") Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20230112224948.1479453-2-samitolvanen@google.com
Diffstat (limited to 'lib/linear_ranges.c')
0 files changed, 0 insertions, 0 deletions