diff options
author | Sami Tolvanen <samitolvanen@google.com> | 2022-12-22 22:57:47 +0000 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2022-12-23 10:04:31 -0800 |
commit | cf8016408d880afe9c5dc495af40dc2932874e77 (patch) | |
tree | fa4dae95cf58108ad859c38133a14d8b69fd171b /security | |
parent | 7535b832c6399b5ebfc5b53af5c51dd915ee2538 (diff) | |
download | lwn-cf8016408d880afe9c5dc495af40dc2932874e77.tar.gz lwn-cf8016408d880afe9c5dc495af40dc2932874e77.zip |
cfi: Fix CFI failure with KASAN
When CFI_CLANG and KASAN are both enabled, LLVM doesn't generate a
CFI type hash for asan.module_ctor functions in translation units
where CFI is disabled, which leads to a CFI failure during boot when
do_ctors calls the affected constructors:
CFI failure at do_basic_setup+0x64/0x90 (target:
asan.module_ctor+0x0/0x28; expected type: 0xa540670c)
Specifically, this happens because CFI is disabled for
kernel/cfi.c. There's no reason to keep CFI disabled here anymore, so
fix the failure by not filtering out CC_FLAGS_CFI for the file.
Note that https://reviews.llvm.org/rG3b14862f0a96 fixed the issue
where LLVM didn't emit CFI type hashes for any sanitizer constructors,
but now type hashes are emitted correctly for TUs that use CFI.
Link: https://github.com/ClangBuiltLinux/linux/issues/1742
Fixes: 89245600941e ("cfi: Switch to -fsanitize=kcfi")
Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221222225747.3538676-1-samitolvanen@google.com
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions