]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
x86/speculation/mds: Add mds=full,nosmt cmdline option
authorJosh Poimboeuf <jpoimboe@redhat.com>
Tue, 2 Apr 2019 14:59:33 +0000 (09:59 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 6 May 2019 16:58:14 +0000 (18:58 +0200)
Add the mds=full,nosmt cmdline option.  This is like mds=full, but with
SMT disabled if the CPU is vulnerable.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
CVE-2018-12126
CVE-2018-12127
CVE-2018-12130

(cherry picked from commit d71eb0ce109a124b0fa714832823b9452f2762cf)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Documentation/admin-guide/hw-vuln/mds.rst
Documentation/admin-guide/kernel-parameters.txt
arch/x86/kernel/cpu/bugs.c

index 1de29d28903d069b4612bc954d1c4d82c71c6438..244ab47d1fb3a367336f659b25a8c33716df64c0 100644 (file)
@@ -260,6 +260,9 @@ time with the option "mds=". The valid arguments for this option are:
 
                It does not automatically disable SMT.
 
+  full,nosmt   The same as mds=full, with SMT disabled on vulnerable
+               CPUs.  This is the complete mitigation.
+
   off          Disables MDS mitigations completely.
 
   ============  =============================================================
index 79482cfac13757b030d20073ef844f6fd8e66846..eb2b0ca22bd120477564f8f73f769142a1db4740 100644 (file)
                        This parameter controls the MDS mitigation. The
                        options are:
 
-                       full    - Enable MDS mitigation on vulnerable CPUs
-                       off     - Unconditionally disable MDS mitigation
+                       full       - Enable MDS mitigation on vulnerable CPUs
+                       full,nosmt - Enable MDS mitigation and disable
+                                    SMT on vulnerable CPUs
+                       off        - Unconditionally disable MDS mitigation
 
                        Not specifying this option is equivalent to
                        mds=full.
index e7dbdeb2b70f565d11719394fad201d100a7cf50..ab112edf4e30d689dc326d96b34035fb4a5f2354 100644 (file)
@@ -219,6 +219,7 @@ static void x86_amd_ssb_disable(void)
 
 /* Default mitigation for L1TF-affected CPUs */
 static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL;
+static bool mds_nosmt __ro_after_init = false;
 
 static const char * const mds_strings[] = {
        [MDS_MITIGATION_OFF]    = "Vulnerable",
@@ -236,8 +237,13 @@ static void mds_select_mitigation(void)
        if (mds_mitigation == MDS_MITIGATION_FULL) {
                if (!boot_cpu_has(X86_FEATURE_MD_CLEAR))
                        mds_mitigation = MDS_MITIGATION_VMWERV;
+
                static_branch_enable(&mds_user_clear);
+
+               if (mds_nosmt && !boot_cpu_has(X86_BUG_MSBDS_ONLY))
+                       cpu_smt_disable(false);
        }
+
        pr_info("%s\n", mds_strings[mds_mitigation]);
 }
 
@@ -253,6 +259,10 @@ static int __init mds_cmdline(char *str)
                mds_mitigation = MDS_MITIGATION_OFF;
        else if (!strcmp(str, "full"))
                mds_mitigation = MDS_MITIGATION_FULL;
+       else if (!strcmp(str, "full,nosmt")) {
+               mds_mitigation = MDS_MITIGATION_FULL;
+               mds_nosmt = true;
+       }
 
        return 0;
 }