Skip to content

Commit 9f303a3

Browse files
keesPeter Zijlstra
authored andcommitted
x86/cfi: Standardize on common "CFI:" prefix for CFI reports
Use a regular "CFI:" prefix for CFI reports during alternatives setup, including reporting when nothing has happened (i.e. CONFIG_FINEIBT=n). Signed-off-by: Kees Cook <kees@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20250904034656.3670313-4-kees@kernel.org
1 parent 24452d9 commit 9f303a3

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

arch/x86/kernel/alternative.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,26 +1266,26 @@ static __init int cfi_parse_cmdline(char *str)
12661266
} else if (!strcmp(str, "norand")) {
12671267
cfi_rand = false;
12681268
} else if (!strcmp(str, "warn")) {
1269-
pr_alert("CFI mismatch non-fatal!\n");
1269+
pr_alert("CFI: mismatch non-fatal!\n");
12701270
cfi_warn = true;
12711271
} else if (!strcmp(str, "paranoid")) {
12721272
if (cfi_mode == CFI_FINEIBT) {
12731273
cfi_paranoid = true;
12741274
} else {
1275-
pr_err("Ignoring paranoid; depends on fineibt.\n");
1275+
pr_err("CFI: ignoring paranoid; depends on fineibt.\n");
12761276
}
12771277
} else if (!strcmp(str, "bhi")) {
12781278
#ifdef CONFIG_FINEIBT_BHI
12791279
if (cfi_mode == CFI_FINEIBT) {
12801280
cfi_bhi = true;
12811281
} else {
1282-
pr_err("Ignoring bhi; depends on fineibt.\n");
1282+
pr_err("CFI: ignoring bhi; depends on fineibt.\n");
12831283
}
12841284
#else
1285-
pr_err("Ignoring bhi; depends on FINEIBT_BHI=y.\n");
1285+
pr_err("CFI: ignoring bhi; depends on FINEIBT_BHI=y.\n");
12861286
#endif
12871287
} else {
1288-
pr_err("Ignoring unknown cfi option (%s).", str);
1288+
pr_err("CFI: Ignoring unknown option (%s).", str);
12891289
}
12901290

12911291
str = next;
@@ -1757,7 +1757,7 @@ static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
17571757
switch (cfi_mode) {
17581758
case CFI_OFF:
17591759
if (builtin)
1760-
pr_info("Disabling CFI\n");
1760+
pr_info("CFI: disabled\n");
17611761
return;
17621762

17631763
case CFI_KCFI:
@@ -1766,7 +1766,8 @@ static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
17661766
goto err;
17671767

17681768
if (builtin)
1769-
pr_info("Using kCFI\n");
1769+
pr_info("CFI: Using %sretpoline kCFI\n",
1770+
cfi_rand ? "rehashed " : "");
17701771
return;
17711772

17721773
case CFI_FINEIBT:
@@ -2005,6 +2006,8 @@ bool decode_fineibt_insn(struct pt_regs *regs, unsigned long *target, u32 *type)
20052006
static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
20062007
s32 *start_cfi, s32 *end_cfi, bool builtin)
20072008
{
2009+
if (IS_ENABLED(CONFIG_CFI) && builtin)
2010+
pr_info("CFI: Using standard kCFI\n");
20082011
}
20092012

20102013
#ifdef CONFIG_X86_KERNEL_IBT

0 commit comments

Comments
 (0)