[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a96456805e51e234d1bae30837366243e24a4b83.1539798901.git.tim.c.chen@linux.intel.com>
Date: Wed, 17 Oct 2018 10:59:32 -0700
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Jiri Kosina <jikos@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Tim Chen <tim.c.chen@...ux.intel.com>,
Tom Lendacky <thomas.lendacky@....com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Andi Kleen <ak@...ux.intel.com>,
Dave Hansen <dave.hansen@...el.com>,
Casey Schaufler <casey.schaufler@...el.com>,
Asit Mallick <asit.k.mallick@...el.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
Jon Masters <jcm@...hat.com>, linux-kernel@...r.kernel.org,
x86@...nel.org
Subject: [Patch v3 04/13] x86/speculation: Disable STIBP when enhanced IBRS is in use
With enhanced IBRS in use, the application running on sibling CPU will not
be able to launch Spectre v2 attack to the application on current CPU.
There is no need to use STIBP for this case. Disable the STIBP code
when enhanced IBRS is used.
Signed-off-by: Tim Chen <tim.c.chen@...ux.intel.com>
---
arch/x86/kernel/cpu/bugs.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 2fc7b4e..6ed82ea 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -327,6 +327,14 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
static bool stibp_needed(void)
{
+ /*
+ * Determine if we want to leave STIBP always on.
+ * Using enhanced IBRS makes using STIBP unnecessary.
+ */
+
+ if (static_branch_unlikely(&spectre_v2_enhanced_ibrs))
+ return false;
+
if (spectre_v2_enabled == SPECTRE_V2_NONE)
return false;
@@ -881,7 +889,9 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr
", IBPB" : "",
boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ?
", IBRS_FW" : "",
- (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ?
+ spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED ?
+ ", Enhanced IBRS" :
+ (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ?
", STIBP" : "",
boot_cpu_has(X86_FEATURE_RSB_CTXSW) ?
", RSB filling" : "",
--
2.9.4
Powered by blists - more mailing lists