Skip to content

Commit cd5a2aa

Browse files
Waiman-Longsuryasaimadhu
authored andcommitted
x86/speculation: Fix redundant MDS mitigation message
Since MDS and TAA mitigations are inter-related for processors that are affected by both vulnerabilities, the followiing confusing messages can be printed in the kernel log: MDS: Vulnerable MDS: Mitigation: Clear CPU buffers To avoid the first incorrect message, defer the printing of MDS mitigation after the TAA mitigation selection has been done. However, that has the side effect of printing TAA mitigation first before MDS mitigation. [ bp: Check box is affected/mitigations are disabled first before printing and massage. ] Suggested-by: Pawan Gupta <[email protected]> Signed-off-by: Waiman Long <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Mark Gross <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tim Chen <[email protected]> Cc: Tony Luck <[email protected]> Cc: Tyler Hicks <[email protected]> Cc: x86-ml <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 64870ed commit cd5a2aa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 13 additions & 0 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
}

0 commit comments

Comments
 (0)