Commit 177d363e authored by Linus Torvalds's avatar Linus Torvalds

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
parents 2da2ca24 eab6870f
...@@ -38,7 +38,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index, ...@@ -38,7 +38,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
{ {
unsigned long mask; unsigned long mask;
asm ("cmp %1,%2; sbb %0,%0;" asm volatile ("cmp %1,%2; sbb %0,%0;"
:"=r" (mask) :"=r" (mask)
:"g"(size),"r" (index) :"g"(size),"r" (index)
:"cc"); :"cc");
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/set_memory.h> #include <asm/set_memory.h>
#include <asm/intel-family.h> #include <asm/intel-family.h>
#include <asm/hypervisor.h>
static void __init spectre_v2_select_mitigation(void); static void __init spectre_v2_select_mitigation(void);
static void __init ssb_select_mitigation(void); static void __init ssb_select_mitigation(void);
...@@ -664,6 +665,9 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr ...@@ -664,6 +665,9 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr
if (boot_cpu_has(X86_FEATURE_PTI)) if (boot_cpu_has(X86_FEATURE_PTI))
return sprintf(buf, "Mitigation: PTI\n"); return sprintf(buf, "Mitigation: PTI\n");
if (hypervisor_is_type(X86_HYPER_XEN_PV))
return sprintf(buf, "Unknown (XEN PV detected, hypervisor mitigation required)\n");
break; break;
case X86_BUG_SPECTRE_V1: case X86_BUG_SPECTRE_V1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment