]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/mitigations: Fix the test for Xen PV guest
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Mon, 13 May 2019 22:29:42 +0000 (18:29 -0400)
committerBrian Maly <brian.maly@oracle.com>
Tue, 21 May 2019 19:54:31 +0000 (15:54 -0400)
Commit 6af1c37c19ea ("x86/pti: Don't report XenPV as vulnerable")
looks at current hypervisor to determine whether we are running as a Xen
PV guest. This is incorrect since the test will be true for HVM guests
as well.

Instead we should see if we are xen_pv_domain().

(Using Xen-specific primitives in this file is not ideal. This is not
for upstream though so we are going to have to live with this)

Orabug: 29774291

Fixes: 6af1c37c19ea ("x86/pti: Don't report XenPV as vulnerable")
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Patrick Colp <patrick.colp@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
arch/x86/kernel/cpu/bugs_64.c

index 7bdf22ba11a9929b30c517b2211eef51a1037672..69af91a552d2ff35995f4ca641b614805a6134f5 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/hypervisor.h>
 #include <asm/e820.h>
 #include <asm/vmx.h>
+#include <xen/xen.h>
 
 /*
  * use_ibrs flags:
@@ -1585,7 +1586,7 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr
                if (boot_cpu_has(X86_FEATURE_PTI))
                        return sprintf(buf, "Mitigation: PTI\n");
 
-               if (x86_hyper == &x86_hyper_xen)
+               if (xen_pv_domain())
                        return sprintf(buf, "Unknown (XEN PV detected, hypervisor mitigation required)\n");
 
                break;