summaryrefslogtreecommitdiff
path: root/kernel/cfi.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2025-02-24 13:37:04 +0100
committerIngo Molnar <mingo@kernel.org>2025-02-26 12:10:48 +0100
commit9a54fb31343362f93680543e37afc14484c185d9 (patch)
tree1e09214d6ffd363e8a70c11847c95d940cc7e831 /kernel/cfi.c
parentfe37c699ae3eed6e02ee55fbf5cb9ceb7fcfd76c (diff)
downloadlinux-9a54fb31343362f93680543e37afc14484c185d9.tar.gz
linux-9a54fb31343362f93680543e37afc14484c185d9.tar.bz2
linux-9a54fb31343362f93680543e37afc14484c185d9.zip
x86/cfi: Add 'cfi=warn' boot option
Rebuilding with CONFIG_CFI_PERMISSIVE=y enabled is such a pain, esp. since clang is so slow. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://lore.kernel.org/r/20250224124159.924496481@infradead.org
Diffstat (limited to 'kernel/cfi.c')
-rw-r--r--kernel/cfi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/cfi.c b/kernel/cfi.c
index 08caad776717..19be79639542 100644
--- a/kernel/cfi.c
+++ b/kernel/cfi.c
@@ -7,6 +7,8 @@
#include <linux/cfi.h>
+bool cfi_warn __ro_after_init = IS_ENABLED(CONFIG_CFI_PERMISSIVE);
+
enum bug_trap_type report_cfi_failure(struct pt_regs *regs, unsigned long addr,
unsigned long *target, u32 type)
{
@@ -17,7 +19,7 @@ enum bug_trap_type report_cfi_failure(struct pt_regs *regs, unsigned long addr,
pr_err("CFI failure at %pS (no target information)\n",
(void *)addr);
- if (IS_ENABLED(CONFIG_CFI_PERMISSIVE)) {
+ if (cfi_warn) {
__warn(NULL, 0, (void *)addr, 0, regs, NULL);
return BUG_TRAP_TYPE_WARN;
}