x86/speculation/mds: Add 'mitigations=' support for MDS
authorJosh Poimboeuf <jpoimboe@redhat.com>
Wed, 17 Apr 2019 21:39:02 +0000 (16:39 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Jun 2019 22:16:58 +0000 (23:16 +0100)
commit 5c14068f87d04adc73ba3f41c2a303d3c3d1fa12 upstream

Add MDS to the new 'mitigations=' cmdline option.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Gbp-Pq: Topic bugfix/all/spec
Gbp-Pq: Name 0027-x86-speculation-mds-Add-mitigations-support-for-MDS.patch

Documentation/admin-guide/kernel-parameters.txt
arch/x86/kernel/cpu/bugs.c

index 6ce97f28b326efe702af4438c4b6126a65aa0c0d..7f714b4e2406898814ebdd0477bcd3c25c18a6a4 100644 (file)
                                               spectre_v2_user=off [X86]
                                               spec_store_bypass_disable=off [X86,PPC]
                                               l1tf=off [X86]
+                                              mds=off [X86]
 
                        auto (default)
                                Mitigate all CPU vulnerabilities, but leave SMT
                                if needed.  This is for users who always want to
                                be fully mitigated, even if it means losing SMT.
                                Equivalent to: l1tf=flush,nosmt [X86]
+                                              mds=full,nosmt [X86]
 
        mminit_loglevel=
                        [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
index 904d55cf80a27050209a8cbdb5d2a0a085b2269d..9b096f26d1c8868e1a9dd9f884dd36d94795271d 100644 (file)
@@ -231,7 +231,7 @@ static const char * const mds_strings[] = {
 
 static void __init mds_select_mitigation(void)
 {
-       if (!boot_cpu_has_bug(X86_BUG_MDS)) {
+       if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) {
                mds_mitigation = MDS_MITIGATION_OFF;
                return;
        }
@@ -242,7 +242,8 @@ static void __init mds_select_mitigation(void)
 
                static_branch_enable(&mds_user_clear);
 
-               if (mds_nosmt && !boot_cpu_has(X86_BUG_MSBDS_ONLY))
+               if (!boot_cpu_has(X86_BUG_MSBDS_ONLY) &&
+                   (mds_nosmt || cpu_mitigations_auto_nosmt()))
                        cpu_smt_disable(false);
        }