Commit 53a07a14 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 PTI updates from Ingo Molnar:
 "Fix reporting bugs of the MDS and TAA mitigation status, if one or
  both are set via a boot option.

  No change to mitigation behavior intended"

* 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/speculation: Fix redundant MDS mitigation message
  x86/speculation: Fix incorrect MDS/TAA mitigation status
parents da42761d cd5a2aa8
...@@ -265,8 +265,11 @@ time with the option "mds=". The valid arguments for this option are: ...@@ -265,8 +265,11 @@ time with the option "mds=". The valid arguments for this option are:
============ ============================================================= ============ =============================================================
Not specifying this option is equivalent to "mds=full". Not specifying this option is equivalent to "mds=full". For processors
that are affected by both TAA (TSX Asynchronous Abort) and MDS,
specifying just "mds=off" without an accompanying "tsx_async_abort=off"
will have no effect as the same mitigation is used for both
vulnerabilities.
Mitigation selection guide Mitigation selection guide
-------------------------- --------------------------
......
...@@ -174,7 +174,10 @@ the option "tsx_async_abort=". The valid arguments for this option are: ...@@ -174,7 +174,10 @@ the option "tsx_async_abort=". The valid arguments for this option are:
CPU is not vulnerable to cross-thread TAA attacks. CPU is not vulnerable to cross-thread TAA attacks.
============ ============================================================= ============ =============================================================
Not specifying this option is equivalent to "tsx_async_abort=full". Not specifying this option is equivalent to "tsx_async_abort=full". For
processors that are affected by both TAA and MDS, specifying just
"tsx_async_abort=off" without an accompanying "mds=off" will have no
effect as the same mitigation is used for both vulnerabilities.
The kernel command line also allows to control the TSX feature using the The kernel command line also allows to control the TSX feature using the
parameter "tsx=" on CPUs which support TSX control. MSR_IA32_TSX_CTRL is used parameter "tsx=" on CPUs which support TSX control. MSR_IA32_TSX_CTRL is used
......
...@@ -2473,6 +2473,12 @@ ...@@ -2473,6 +2473,12 @@
SMT on vulnerable CPUs SMT on vulnerable CPUs
off - Unconditionally disable MDS mitigation off - Unconditionally disable MDS mitigation
On TAA-affected machines, mds=off can be prevented by
an active TAA mitigation as both vulnerabilities are
mitigated with the same mechanism so in order to disable
this mitigation, you need to specify tsx_async_abort=off
too.
Not specifying this option is equivalent to Not specifying this option is equivalent to
mds=full. mds=full.
...@@ -4931,6 +4937,11 @@ ...@@ -4931,6 +4937,11 @@
vulnerable to cross-thread TAA attacks. vulnerable to cross-thread TAA attacks.
off - Unconditionally disable TAA mitigation off - Unconditionally disable TAA mitigation
On MDS-affected machines, tsx_async_abort=off can be
prevented by an active MDS mitigation as both vulnerabilities
are mitigated with the same mechanism so in order to disable
this mitigation, you need to specify mds=off too.
Not specifying this option is equivalent to Not specifying this option is equivalent to
tsx_async_abort=full. On CPUs which are MDS affected tsx_async_abort=full. On CPUs which are MDS affected
and deploy MDS mitigation, TAA mitigation is not and deploy MDS mitigation, TAA mitigation is not
......
...@@ -39,6 +39,7 @@ static void __init spectre_v2_select_mitigation(void); ...@@ -39,6 +39,7 @@ static void __init spectre_v2_select_mitigation(void);
static void __init ssb_select_mitigation(void); static void __init ssb_select_mitigation(void);
static void __init l1tf_select_mitigation(void); static void __init l1tf_select_mitigation(void);
static void __init mds_select_mitigation(void); static void __init mds_select_mitigation(void);
static void __init mds_print_mitigation(void);
static void __init taa_select_mitigation(void); static void __init taa_select_mitigation(void);
/* The base value of the SPEC_CTRL MSR that always has to be preserved. */ /* The base value of the SPEC_CTRL MSR that always has to be preserved. */
...@@ -108,6 +109,12 @@ void __init check_bugs(void) ...@@ -108,6 +109,12 @@ void __init check_bugs(void)
mds_select_mitigation(); mds_select_mitigation();
taa_select_mitigation(); taa_select_mitigation();
/*
* As MDS and TAA mitigations are inter-related, print MDS
* mitigation until after TAA mitigation selection is done.
*/
mds_print_mitigation();
arch_smt_update(); arch_smt_update();
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
...@@ -245,6 +252,12 @@ static void __init mds_select_mitigation(void) ...@@ -245,6 +252,12 @@ static void __init mds_select_mitigation(void)
(mds_nosmt || cpu_mitigations_auto_nosmt())) (mds_nosmt || cpu_mitigations_auto_nosmt()))
cpu_smt_disable(false); cpu_smt_disable(false);
} }
}
static void __init mds_print_mitigation(void)
{
if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off())
return;
pr_info("%s\n", mds_strings[mds_mitigation]); pr_info("%s\n", mds_strings[mds_mitigation]);
} }
...@@ -304,8 +317,12 @@ static void __init taa_select_mitigation(void) ...@@ -304,8 +317,12 @@ static void __init taa_select_mitigation(void)
return; return;
} }
/* TAA mitigation is turned off on the cmdline (tsx_async_abort=off) */ /*
if (taa_mitigation == TAA_MITIGATION_OFF) * TAA mitigation via VERW is turned off if both
* tsx_async_abort=off and mds=off are specified.
*/
if (taa_mitigation == TAA_MITIGATION_OFF &&
mds_mitigation == MDS_MITIGATION_OFF)
goto out; goto out;
if (boot_cpu_has(X86_FEATURE_MD_CLEAR)) if (boot_cpu_has(X86_FEATURE_MD_CLEAR))
...@@ -339,6 +356,15 @@ static void __init taa_select_mitigation(void) ...@@ -339,6 +356,15 @@ static void __init taa_select_mitigation(void)
if (taa_nosmt || cpu_mitigations_auto_nosmt()) if (taa_nosmt || cpu_mitigations_auto_nosmt())
cpu_smt_disable(false); cpu_smt_disable(false);
/*
* Update MDS mitigation, if necessary, as the mds_user_clear is
* now enabled for TAA mitigation.
*/
if (mds_mitigation == MDS_MITIGATION_OFF &&
boot_cpu_has_bug(X86_BUG_MDS)) {
mds_mitigation = MDS_MITIGATION_FULL;
mds_select_mitigation();
}
out: out:
pr_info("%s\n", taa_strings[taa_mitigation]); pr_info("%s\n", taa_strings[taa_mitigation]);
} }
......
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