Skip to content

Commit 53a07a1

Browse files
committed
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
2 parents da42761 + cd5a2aa commit 53a07a1

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

Documentation/admin-guide/hw-vuln/mds.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,11 @@ time with the option "mds=". The valid arguments for this option are:
265265

266266
============ =============================================================
267267

268-
Not specifying this option is equivalent to "mds=full".
269-
268+
Not specifying this option is equivalent to "mds=full". For processors
269+
that are affected by both TAA (TSX Asynchronous Abort) and MDS,
270+
specifying just "mds=off" without an accompanying "tsx_async_abort=off"
271+
will have no effect as the same mitigation is used for both
272+
vulnerabilities.
270273

271274
Mitigation selection guide
272275
--------------------------

Documentation/admin-guide/hw-vuln/tsx_async_abort.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ the option "tsx_async_abort=". The valid arguments for this option are:
174174
CPU is not vulnerable to cross-thread TAA attacks.
175175
============ =============================================================
176176

177-
Not specifying this option is equivalent to "tsx_async_abort=full".
177+
Not specifying this option is equivalent to "tsx_async_abort=full". For
178+
processors that are affected by both TAA and MDS, specifying just
179+
"tsx_async_abort=off" without an accompanying "mds=off" will have no
180+
effect as the same mitigation is used for both vulnerabilities.
178181

179182
The kernel command line also allows to control the TSX feature using the
180183
parameter "tsx=" on CPUs which support TSX control. MSR_IA32_TSX_CTRL is used

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,6 +2473,12 @@
24732473
SMT on vulnerable CPUs
24742474
off - Unconditionally disable MDS mitigation
24752475

2476+
On TAA-affected machines, mds=off can be prevented by
2477+
an active TAA mitigation as both vulnerabilities are
2478+
mitigated with the same mechanism so in order to disable
2479+
this mitigation, you need to specify tsx_async_abort=off
2480+
too.
2481+
24762482
Not specifying this option is equivalent to
24772483
mds=full.
24782484

@@ -4931,6 +4937,11 @@
49314937
vulnerable to cross-thread TAA attacks.
49324938
off - Unconditionally disable TAA mitigation
49334939

4940+
On MDS-affected machines, tsx_async_abort=off can be
4941+
prevented by an active MDS mitigation as both vulnerabilities
4942+
are mitigated with the same mechanism so in order to disable
4943+
this mitigation, you need to specify mds=off too.
4944+
49344945
Not specifying this option is equivalent to
49354946
tsx_async_abort=full. On CPUs which are MDS affected
49364947
and deploy MDS mitigation, TAA mitigation is not

arch/x86/kernel/cpu/bugs.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static void __init spectre_v2_select_mitigation(void);
3939
static void __init ssb_select_mitigation(void);
4040
static void __init l1tf_select_mitigation(void);
4141
static void __init mds_select_mitigation(void);
42+
static void __init mds_print_mitigation(void);
4243
static void __init taa_select_mitigation(void);
4344

4445
/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
@@ -108,6 +109,12 @@ void __init check_bugs(void)
108109
mds_select_mitigation();
109110
taa_select_mitigation();
110111

112+
/*
113+
* As MDS and TAA mitigations are inter-related, print MDS
114+
* mitigation until after TAA mitigation selection is done.
115+
*/
116+
mds_print_mitigation();
117+
111118
arch_smt_update();
112119

113120
#ifdef CONFIG_X86_32
@@ -245,6 +252,12 @@ static void __init mds_select_mitigation(void)
245252
(mds_nosmt || cpu_mitigations_auto_nosmt()))
246253
cpu_smt_disable(false);
247254
}
255+
}
256+
257+
static void __init mds_print_mitigation(void)
258+
{
259+
if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off())
260+
return;
248261

249262
pr_info("%s\n", mds_strings[mds_mitigation]);
250263
}
@@ -304,8 +317,12 @@ static void __init taa_select_mitigation(void)
304317
return;
305318
}
306319

307-
/* TAA mitigation is turned off on the cmdline (tsx_async_abort=off) */
308-
if (taa_mitigation == TAA_MITIGATION_OFF)
320+
/*
321+
* TAA mitigation via VERW is turned off if both
322+
* tsx_async_abort=off and mds=off are specified.
323+
*/
324+
if (taa_mitigation == TAA_MITIGATION_OFF &&
325+
mds_mitigation == MDS_MITIGATION_OFF)
309326
goto out;
310327

311328
if (boot_cpu_has(X86_FEATURE_MD_CLEAR))
@@ -339,6 +356,15 @@ static void __init taa_select_mitigation(void)
339356
if (taa_nosmt || cpu_mitigations_auto_nosmt())
340357
cpu_smt_disable(false);
341358

359+
/*
360+
* Update MDS mitigation, if necessary, as the mds_user_clear is
361+
* now enabled for TAA mitigation.
362+
*/
363+
if (mds_mitigation == MDS_MITIGATION_OFF &&
364+
boot_cpu_has_bug(X86_BUG_MDS)) {
365+
mds_mitigation = MDS_MITIGATION_FULL;
366+
mds_select_mitigation();
367+
}
342368
out:
343369
pr_info("%s\n", taa_strings[taa_mitigation]);
344370
}

0 commit comments

Comments
 (0)