Skip to content

Commit 177d363

Browse files
committed
Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 pti fixes from Thomas Gleixner: "Two small updates for the speculative distractions: - Make it more clear to the compiler that array_index_mask_nospec() is not subject for optimizations. It's not perfect, but ... - Don't report XEN PV guests as vulnerable because their mitigation state depends on the hypervisor. Report unknown and refer to the hypervisor requirement" * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/spectre_v1: Disable compiler optimizations over array_index_mask_nospec() x86/pti: Don't report XenPV as vulnerable
2 parents 2da2ca2 + eab6870 commit 177d363

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

arch/x86/include/asm/barrier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
3838
{
3939
unsigned long mask;
4040

41-
asm ("cmp %1,%2; sbb %0,%0;"
41+
asm volatile ("cmp %1,%2; sbb %0,%0;"
4242
:"=r" (mask)
4343
:"g"(size),"r" (index)
4444
:"cc");

arch/x86/kernel/cpu/bugs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <asm/pgtable.h>
2828
#include <asm/set_memory.h>
2929
#include <asm/intel-family.h>
30+
#include <asm/hypervisor.h>
3031

3132
static void __init spectre_v2_select_mitigation(void);
3233
static void __init ssb_select_mitigation(void);
@@ -664,6 +665,9 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr
664665
if (boot_cpu_has(X86_FEATURE_PTI))
665666
return sprintf(buf, "Mitigation: PTI\n");
666667

668+
if (hypervisor_is_type(X86_HYPER_XEN_PV))
669+
return sprintf(buf, "Unknown (XEN PV detected, hypervisor mitigation required)\n");
670+
667671
break;
668672

669673
case X86_BUG_SPECTRE_V1:

0 commit comments

Comments
 (0)