[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH SpectreV1+L1TF v4 07/11] nospec: enable lfence on Intel
While the lfence instruction was added for all x86 platform in the beginning, it's useful to not block platforms that are not affected by the L1TF vulnerability. Therefore, the lfence instruction should only be introduced, in case the current CPU is an Intel CPU that is capable of hyper threading. This combination of features is added to the features that activate the alternative. This commit is part of the SpectreV1+L1TF mitigation patch series. Signed-off-by: Norbert Manthey <nmanthey@xxxxxxxxx> --- xen/include/xen/nospec.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/include/xen/nospec.h b/xen/include/xen/nospec.h --- a/xen/include/xen/nospec.h +++ b/xen/include/xen/nospec.h @@ -7,6 +7,7 @@ #ifndef XEN_NOSPEC_H #define XEN_NOSPEC_H +#include <asm/alternative.h> #include <asm/system.h> /** @@ -68,7 +69,10 @@ static inline unsigned long array_index_mask_nospec(unsigned long index, * allow to insert a read memory barrier into conditionals */ #ifdef CONFIG_X86 -static inline bool lfence_true(void) { rmb(); return true; } +static inline bool lfence_true(void) { + alternative("", "lfence", X86_VENDOR_INTEL); + return true; +} #else static inline bool lfence_true(void) { return true; } #endif @@ -91,7 +95,7 @@ static inline bool lfence_true(void) { return true; } * allow to block speculative execution in generic code */ #ifdef CONFIG_X86 -#define block_speculation() rmb() +#define block_speculation() alternative("", "lfence", X86_VENDOR_INTEL) #else #define block_speculation() #endif -- 2.7.4 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich Ust-ID: DE 289 237 879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |