Skip to content

Commit f337a6a

Browse files
sean-jcIngo Molnar
authored andcommitted
x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
Initialize cpu_mitigations to CPU_MITIGATIONS_OFF if the kernel is built with CONFIG_SPECULATION_MITIGATIONS=n, as the help text quite clearly states that disabling SPECULATION_MITIGATIONS is supposed to turn off all mitigations by default. │ If you say N, all mitigations will be disabled. You really │ should know what you are doing to say so. As is, the kernel still defaults to CPU_MITIGATIONS_AUTO, which results in some mitigations being enabled in spite of SPECULATION_MITIGATIONS=n. Fixes: f43b987 ("x86/retbleed: Add fine grained Kconfig knobs") Signed-off-by: Sean Christopherson <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Daniel Sneddon <[email protected]> Cc: [email protected] Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a9025cd commit f337a6a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/cpu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3207,7 +3207,8 @@ enum cpu_mitigations {
32073207
};
32083208

32093209
static enum cpu_mitigations cpu_mitigations __ro_after_init =
3210-
CPU_MITIGATIONS_AUTO;
3210+
IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO :
3211+
CPU_MITIGATIONS_OFF;
32113212

32123213
static int __init mitigations_parse_cmdline(char *arg)
32133214
{

0 commit comments

Comments
 (0)