Sami Tolvanen cf8016408d 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
2022-12-23 10:04:31 -08:00
..
2022-10-14 13:03:00 -07:00
2022-09-28 09:02:20 +02:00
2022-09-26 19:46:18 -07:00
2021-12-02 17:25:21 +09:00
2022-10-10 11:36:19 -07:00
2022-10-10 09:10:28 -07:00
2022-10-13 10:36:57 -07:00
2022-08-29 19:47:03 -04:00
2022-01-11 13:08:21 -08:00
2022-10-04 11:05:43 -07:00
2022-09-26 10:13:13 -07:00
2021-09-08 15:32:35 -07:00
2022-05-23 17:51:12 -07:00
2022-10-03 17:11:07 -07:00
2022-12-23 10:04:31 -08:00
2022-06-29 13:07:16 +02:00
2022-10-10 12:49:34 -07:00
2022-02-25 09:36:06 +01:00
2022-08-06 16:38:17 -07:00
2022-10-03 17:11:07 -07:00