]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.9/0026-x86-speculation-Disable-STIBP-when-enhanced-IBRS-is-.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.9 / 0026-x86-speculation-Disable-STIBP-when-enhanced-IBRS-is-.patch
1 From 029e37a0a97ec027d83e657f493d1e618935aa5d Mon Sep 17 00:00:00 2001
2 From: Tim Chen <tim.c.chen@linux.intel.com>
3 Date: Sun, 25 Nov 2018 19:33:33 +0100
4 Subject: [PATCH 26/76] x86/speculation: Disable STIBP when enhanced IBRS is in
5 use
6
7 commit 34bce7c9690b1d897686aac89604ba7adc365556 upstream.
8
9 If enhanced IBRS is active, STIBP is redundant for mitigating Spectre v2
10 user space exploits from hyperthread sibling.
11
12 Disable STIBP when enhanced IBRS is used.
13
14 Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
15 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 Reviewed-by: Ingo Molnar <mingo@kernel.org>
17 Cc: Peter Zijlstra <peterz@infradead.org>
18 Cc: Andy Lutomirski <luto@kernel.org>
19 Cc: Linus Torvalds <torvalds@linux-foundation.org>
20 Cc: Jiri Kosina <jkosina@suse.cz>
21 Cc: Tom Lendacky <thomas.lendacky@amd.com>
22 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
23 Cc: Andrea Arcangeli <aarcange@redhat.com>
24 Cc: David Woodhouse <dwmw@amazon.co.uk>
25 Cc: Andi Kleen <ak@linux.intel.com>
26 Cc: Dave Hansen <dave.hansen@intel.com>
27 Cc: Casey Schaufler <casey.schaufler@intel.com>
28 Cc: Asit Mallick <asit.k.mallick@intel.com>
29 Cc: Arjan van de Ven <arjan@linux.intel.com>
30 Cc: Jon Masters <jcm@redhat.com>
31 Cc: Waiman Long <longman9394@gmail.com>
32 Cc: Greg KH <gregkh@linuxfoundation.org>
33 Cc: Dave Stewart <david.c.stewart@intel.com>
34 Cc: Kees Cook <keescook@chromium.org>
35 Link: https://lkml.kernel.org/r/20181125185003.966801480@linutronix.de
36 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
37 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38 ---
39 arch/x86/kernel/cpu/bugs.c | 7 +++++++
40 1 file changed, 7 insertions(+)
41
42 diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
43 index 64e5f64c3b38..364fd880feef 100644
44 --- a/arch/x86/kernel/cpu/bugs.c
45 +++ b/arch/x86/kernel/cpu/bugs.c
46 @@ -325,6 +325,10 @@ static bool stibp_needed(void)
47 if (spectre_v2_enabled == SPECTRE_V2_NONE)
48 return false;
49
50 + /* Enhanced IBRS makes using STIBP unnecessary. */
51 + if (spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED)
52 + return false;
53 +
54 if (!boot_cpu_has(X86_FEATURE_STIBP))
55 return false;
56
57 @@ -852,6 +856,9 @@ static ssize_t l1tf_show_state(char *buf)
58
59 static char *stibp_state(void)
60 {
61 + if (spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED)
62 + return "";
63 +
64 if (x86_spec_ctrl_base & SPEC_CTRL_STIBP)
65 return ", STIBP";
66 else
67 --
68 2.21.0
69