]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.180/x86-speculation-mds-add-smt-warning-message.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.180 / x86-speculation-mds-add-smt-warning-message.patch
1 From foo@baz Tue 14 May 2019 08:29:35 PM CEST
2 From: Josh Poimboeuf <jpoimboe@redhat.com>
3 Date: Tue, 2 Apr 2019 10:00:51 -0500
4 Subject: x86/speculation/mds: Add SMT warning message
5
6 From: Josh Poimboeuf <jpoimboe@redhat.com>
7
8 commit 39226ef02bfb43248b7db12a4fdccb39d95318e3 upstream.
9
10 MDS is vulnerable with SMT. Make that clear with a one-time printk
11 whenever SMT first gets enabled.
12
13 Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
14 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
15 Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
16 Acked-by: Jiri Kosina <jkosina@suse.cz>
17 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 ---
20 arch/x86/kernel/cpu/bugs.c | 8 ++++++++
21 1 file changed, 8 insertions(+)
22
23 --- a/arch/x86/kernel/cpu/bugs.c
24 +++ b/arch/x86/kernel/cpu/bugs.c
25 @@ -646,6 +646,9 @@ static void update_indir_branch_cond(voi
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 @@ -666,6 +669,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 @@ -689,6 +694,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 @@ -1069,6 +1076,7 @@ static void __init l1tf_select_mitigatio
54 setup_force_cpu_cap(X86_FEATURE_L1TF_PTEINV);
55 }
56 #undef pr_fmt
57 +#define pr_fmt(fmt) fmt
58
59 #ifdef CONFIG_SYSFS
60