Commit 2bf050d0 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Stefan Bader

x86/speculation/mds: Add mds=full,nosmt cmdline option

Add the mds=full,nosmt cmdline option.  This is like mds=full, but with
SMT disabled if the CPU is vulnerable.
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarTyler Hicks <tyhicks@canonical.com>
Acked-by: default avatarJiri Kosina <jkosina@suse.cz>

CVE-2018-12126
CVE-2018-12127
CVE-2018-12130

(backported from commit d71eb0ce)
[juergh: Adjusted file path for Documentation/kernel-parameters.txt.]
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Acked-by: default avatarTyler Hicks <tyhicks@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent ed822aea
...@@ -260,6 +260,9 @@ time with the option "mds=". The valid arguments for this option are: ...@@ -260,6 +260,9 @@ time with the option "mds=". The valid arguments for this option are:
It does not automatically disable SMT. 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. off Disables MDS mitigations completely.
============ ============================================================= ============ =============================================================
......
...@@ -2136,6 +2136,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. ...@@ -2136,6 +2136,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
options are: options are:
full - Enable MDS mitigation on vulnerable CPUs full - Enable MDS mitigation on vulnerable CPUs
full,nosmt - Enable MDS mitigation and disable
SMT on vulnerable CPUs
off - Unconditionally disable MDS mitigation off - Unconditionally disable MDS mitigation
Not specifying this option is equivalent to Not specifying this option is equivalent to
......
...@@ -231,6 +231,7 @@ static void x86_amd_ssb_disable(void) ...@@ -231,6 +231,7 @@ static void x86_amd_ssb_disable(void)
/* Default mitigation for L1TF-affected CPUs */ /* Default mitigation for L1TF-affected CPUs */
static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL; 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[] = { static const char * const mds_strings[] = {
[MDS_MITIGATION_OFF] = "Vulnerable", [MDS_MITIGATION_OFF] = "Vulnerable",
...@@ -248,8 +249,13 @@ static void mds_select_mitigation(void) ...@@ -248,8 +249,13 @@ static void mds_select_mitigation(void)
if (mds_mitigation == MDS_MITIGATION_FULL) { if (mds_mitigation == MDS_MITIGATION_FULL) {
if (!boot_cpu_has(X86_FEATURE_MD_CLEAR)) if (!boot_cpu_has(X86_FEATURE_MD_CLEAR))
mds_mitigation = MDS_MITIGATION_VMWERV; mds_mitigation = MDS_MITIGATION_VMWERV;
static_branch_enable(&mds_user_clear); 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]); pr_info("%s\n", mds_strings[mds_mitigation]);
} }
...@@ -265,6 +271,10 @@ static int __init mds_cmdline(char *str) ...@@ -265,6 +271,10 @@ static int __init mds_cmdline(char *str)
mds_mitigation = MDS_MITIGATION_OFF; mds_mitigation = MDS_MITIGATION_OFF;
else if (!strcmp(str, "full")) else if (!strcmp(str, "full"))
mds_mitigation = MDS_MITIGATION_FULL; mds_mitigation = MDS_MITIGATION_FULL;
else if (!strcmp(str, "full,nosmt")) {
mds_mitigation = MDS_MITIGATION_FULL;
mds_nosmt = true;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment