]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.9/0066-x86-speculation-mds-Add-SMT-warning-message.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.9 / 0066-x86-speculation-mds-Add-SMT-warning-message.patch
CommitLineData
6fa88700
GKH
1From d6a87300a6f1cba5faabcdb94d54fbef150d8e79 Mon Sep 17 00:00:00 2001
2From: Josh Poimboeuf <jpoimboe@redhat.com>
3Date: Tue, 2 Apr 2019 10:00:51 -0500
4Subject: [PATCH 66/76] x86/speculation/mds: Add SMT warning message
5
6commit 39226ef02bfb43248b7db12a4fdccb39d95318e3 upstream.
7
8MDS is vulnerable with SMT. Make that clear with a one-time printk
9whenever SMT first gets enabled.
10
11Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
12Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
13Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
14Acked-by: Jiri Kosina <jkosina@suse.cz>
15Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
16Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17---
18 arch/x86/kernel/cpu/bugs.c | 8 ++++++++
19 1 file changed, 8 insertions(+)
20
21diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
22index a725105a49d1..6a3fcacbb9a0 100644
23--- a/arch/x86/kernel/cpu/bugs.c
24+++ b/arch/x86/kernel/cpu/bugs.c
25@@ -667,6 +667,9 @@ static void update_indir_branch_cond(void)
26 static_branch_disable(&switch_to_cond_stibp);
27 }
28
29+#undef pr_fmt
30+#define pr_fmt(fmt) fmt
31+
32 /* Update the static key controlling the MDS CPU buffer clear in idle */
33 static void update_mds_branch_idle(void)
34 {
35@@ -687,6 +690,8 @@ static void update_mds_branch_idle(void)
36 static_branch_disable(&mds_idle_clear);
37 }
38
39+#define MDS_MSG_SMT "MDS CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html for more details.\n"
40+
41 void arch_smt_update(void)
42 {
43 /* Enhanced IBRS implies STIBP. No update required. */
44@@ -710,6 +715,8 @@ void arch_smt_update(void)
45 switch (mds_mitigation) {
46 case MDS_MITIGATION_FULL:
47 case MDS_MITIGATION_VMWERV:
48+ if (sched_smt_active() && !boot_cpu_has(X86_BUG_MSBDS_ONLY))
49+ pr_warn_once(MDS_MSG_SMT);
50 update_mds_branch_idle();
51 break;
52 case MDS_MITIGATION_OFF:
53@@ -1139,6 +1146,7 @@ static int __init l1tf_cmdline(char *str)
54 early_param("l1tf", l1tf_cmdline);
55
56 #undef pr_fmt
57+#define pr_fmt(fmt) fmt
58
59 #ifdef CONFIG_SYSFS
60
61--
622.21.0
63