summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2024-04-09 20:51:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-17 12:19:36 +0300
commit2978ee7c973ce81b6e51100ba1e5ae001af624b9 (patch)
treedd70bc7d9b2ff92a1f8c83b3baefa9a4ffed5cd6 /kernel
parentd4a2a965d630550995e7f10b4cfb7fd3ca946d69 (diff)
downloadlinux-2978ee7c973ce81b6e51100ba1e5ae001af624b9.tar.xz
x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
commit f337a6a21e2fd67eadea471e93d05dd37baaa9be upstream. 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: f43b9876e857 ("x86/retbleed: Add fine grained Kconfig knobs") Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Daniel Sneddon <daniel.sneddon@linux.intel.com> Cc: stable@vger.kernel.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20240409175108.1512861-2-seanjc@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 72e0f5380bf6..92429104bbf8 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -3208,7 +3208,8 @@ enum cpu_mitigations {
};
static enum cpu_mitigations cpu_mitigations __ro_after_init =
- CPU_MITIGATIONS_AUTO;
+ IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO :
+ CPU_MITIGATIONS_OFF;
static int __init mitigations_parse_cmdline(char *arg)
{