]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
x86/nospec: Introduce CONFIG_SPECULATIVE_HARDEN_BRANCH
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 30 Sep 2019 17:25:21 +0000 (18:25 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 30 Oct 2019 13:07:25 +0000 (13:07 +0000)
Just as with CONFIG_SPECULATIVE_HARDEN_ARRAY, branch hardening should be
configurable at compile time.

The previous CONFIG_HVM was a consequence of what could be discussed publicly
at the time the patches were submitted, and wasn't actually correct.  Later
patches will make further corrections.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/common/Kconfig
xen/include/asm-x86/nospec.h

index 7fe538b0271738fbad6bc827eb15dd3a2a157b3e..fddb6c170770168d96efa4d028b72bfdbc827572 100644 (file)
@@ -102,6 +102,29 @@ config SPECULATIVE_HARDEN_ARRAY
 
          If unsure, say Y.
 
+config SPECULATIVE_HARDEN_BRANCH
+       bool "Speculative Branch Hardening"
+       default y
+       depends on X86
+        ---help---
+         Contemporary processors may use speculative execution as a
+         performance optimisation, but this can potentially be abused by an
+         attacker to leak data via speculative sidechannels.
+
+         One source of misbehaviour is by executing the wrong basic block
+         following a conditional jump.
+
+         When enabled, specific conditions which have been deemed liable to
+         be speculatively abused will be hardened to avoid entering the wrong
+         basic block.
+
+         This is a best-effort mitigation.  There are no guarantees that all
+         areas of code open to abuse have been hardened, nor that
+         optimisations in the compiler haven't subverted the attempts to
+         harden.
+
+         If unsure, say Y.
+
 endmenu
 
 config KEXEC
index 427b5ff9df23d130edeff72cd145833101b02dbd..154e92aed8fc792a0162945d8a3da9e9eff827b4 100644 (file)
@@ -9,7 +9,7 @@
 /* Allow to insert a read memory barrier into conditionals */
 static always_inline bool barrier_nospec_true(void)
 {
-#ifdef CONFIG_HVM
+#ifdef CONFIG_SPECULATIVE_HARDEN_BRANCH
     alternative("", "lfence", X86_FEATURE_SC_L1TF_VULN);
 #endif
     return true;