From: Boris Ostrovsky Date: Mon, 13 May 2019 22:29:42 +0000 (-0400) Subject: x86/mitigations: Fix the test for Xen PV guest X-Git-Tag: v4.1.12-124.31.3~123 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7d55ae471cce5e31889ef6f6a2ef929f3a2d52ea;p=users%2Fjedix%2Flinux-maple.git x86/mitigations: Fix the test for Xen PV guest 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 Reviewed-by: Patrick Colp Signed-off-by: Brian Maly --- diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c index 7bdf22ba11a9..69af91a552d2 100644 --- a/arch/x86/kernel/cpu/bugs_64.c +++ b/arch/x86/kernel/cpu/bugs_64.c @@ -24,6 +24,7 @@ #include #include #include +#include /* * 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;