Skip to contentSkip to conversation

x86/bugs: Don't say no mitigation available if kernel not compiled with retpoline

PATCH Applied Kim Phillips 3 participants 3 messages Aug 31 – Oct 3

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86/bugs: Don't say no mitigation available if kernel not compiled with retpoline

When the kernel lacks retpoline support, spectre_v2_select_retpoline() emits

"Kernel not compiled with retpoline; no mitigation available!"

before returning SPECTRE_V2_NONE to its callers. SPECTRE_V2_NONE is not the final answer, though: spectre_v2_update_mitigation() runs afterwards and can still upgrade the mitigation.

On an Intel CPU affected by RETBleed, built with CONFIG_MITIGATION_IBRS_ENTRY=y and CONFIG_MITIGATION_RETPOLINE=n, and booted with spectre_v2=auto, retbleed_select_mitigation() picks RETBLEED_MITIGATION_IBRS, and spectre_v2_update_mitigation() then promotes SPECTRE_V2_NONE to SPECTRE_V2_IBRS. The boot log claims no mitigation is available immediately before reporting "Spectre V2 : Mitigation: IBRS", and sysfs reports the machine as mitigated. The message is alarming and simply wrong.

Drop "no mitigation available!" because the final mitigation state is printed afterwards in spectre_v2_update_mitigation() anyway.

Fixes 480e803dacf8 ("x86/bugs: Restructure spectre_v2 mitigation")
Assisted-by ClaudeCode:claude-opus-4-7
---
 arch/x86/kernel/cpu/bugs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/bugs.c +1 -1
index 56eac5611c31..5a0533a41d30 100644
@@ -1957,7 +1957,7 @@ early_param("spectre_v2", spectre_v2_parse_cmdline);
 static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)
 {
 	if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {
-		pr_err("Kernel not compiled with retpoline; no mitigation available!");
+		pr_err("Kernel not compiled with retpoline");
 		return SPECTRE_V2_NONE;
 	}
 
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 18 lines · Kim Phillips

When the kernel lacks retpoline support, spectre_v2_select_retpoline() emits

"Kernel not compiled with retpoline; no mitigation available!"

before returning SPECTRE_V2_NONE to its callers. SPECTRE_V2_NONE is not the final answer, though: spectre_v2_update_mitigation() runs afterwards and can still upgrade the mitigation.

On an Intel CPU affected by RETBleed, built with CONFIG_MITIGATION_IBRS_ENTRY=y and CONFIG_MITIGATION_RETPOLINE=n, and booted with spectre_v2=auto, retbleed_select_mitigation() picks RETBLEED_MITIGATION_IBRS, and spectre_v2_update_mitigation() then promotes SPECTRE_V2_NONE to SPECTRE_V2_IBRS. The boot log claims no mitigation is available immediately before reporting "Spectre V2 : Mitigation: IBRS", and sysfs reports the machine as mitigated. The message is alarming and simply wrong.

Quoted 7 lines

Drop "no mitigation available!" because the final mitigation state is printed afterwards in spectre_v2_update_mitigation() anyway.

Fixes 480e803dacf8 ("x86/bugs: Restructure spectre_v2 mitigation")
merge bot Applied
#2 lore raw

[tip: x86/bugs] x86/bugs: Fix CONFIG_MITIGATION_RETPOLINE=n mitigation reporting

In reply to Kim Phillips
The following commit has been merged into the x86/bugs branch of tip:

The following commit has been merged into the x86/bugs branch of tip:

Commit-ID:     1847c80537891baead3975f3ca969233ff7b2a11
Gitweb:        https://git.kernel.org/tip/1847c80537891baead3975f3ca969233ff7b2a11
Author:        Kim Phillips <[email protected]>
AuthorDate:    Mon, 31 Aug 2026 16:09:16 -05:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Fri, 02 Oct 2026 15:48:29 -07:00

x86/bugs: Fix CONFIG_MITIGATION_RETPOLINE=n mitigation reporting

When the kernel lacks retpoline support, spectre_v2_select_retpoline() emits

"Kernel not compiled with retpoline; no mitigation available!"

before returning SPECTRE_V2_NONE to its callers. SPECTRE_V2_NONE is not the final answer, though: spectre_v2_update_mitigation() runs afterwards and can still upgrade the mitigation.

On an Intel CPU affected by RETBleed, built with

CONFIG_MITIGATION_IBRS_ENTRY=y and
CONFIG_MITIGATION_RETPOLINE=n,

and booted with spectre_v2=auto, retbleed_select_mitigation() picks RETBLEED_MITIGATION_IBRS, and spectre_v2_update_mitigation() then promotes SPECTRE_V2_NONE to SPECTRE_V2_IBRS. The boot log claims no mitigation is available immediately before reporting

"Spectre V2 : Mitigation: IBRS",

and sysfs reports the machine as mitigated. The message is alarming and simply wrong.

Drop "no mitigation available!" because the final mitigation state is printed afterwards in spectre_v2_update_mitigation() anyway.

[ bp: Drop CC:stable, massage commit message. ]

Fixes 480e803dacf8 ("x86/bugs: Restructure spectre_v2 mitigation")
Assisted-by LLM
---
 arch/x86/kernel/cpu/bugs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/bugs.c +1 -1
index 1b2381d..000ebee 100644
@@ -1958,7 +1958,7 @@ early_param("spectre_v2", spectre_v2_parse_cmdline);
 static enum spectre_v2_mitigation __init spectre_v2_select_retpoline(void)
 {
 	if (!IS_ENABLED(CONFIG_MITIGATION_RETPOLINE)) {
-		pr_err("Kernel not compiled with retpoline; no mitigation available!");
+		pr_err("Kernel not compiled with retpoline");
 		return SPECTRE_V2_NONE;
 	}