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
/* 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;