From: Jiri Kosina <jkos...@suse.cz>

Xen PV domain kernel is not by design affected by meltdown as it's 
enforcing split CR3 itself. Let's not report such systems as "Vulnerable" 
in sysfs (we're also already forcing PTI to off in X86_HYPER_XEN_PV 
cases); the security of the system ultimately depends on presence of 
mitigation in Hypervisor, which can't be easily detected from DomU; let's 
report that.

Reported-and-tested-by: Mike Latimer <mlati...@suse.com>
Signed-off-by: Jiri Kosina <jkos...@suse.cz>
---

v1 -> v2: reporting "Not affected" is not really correct, as it depends on
          the presence of mitigation in the hypervisor

 arch/x86/kernel/cpu/bugs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index cd0fda1fff6d..57638396a254 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -27,6 +27,7 @@
 #include <asm/pgtable.h>
 #include <asm/set_memory.h>
 #include <asm/intel-family.h>
+#include <asm/hypervisor.h>
 
 static void __init spectre_v2_select_mitigation(void);
 static void __init ssb_select_mitigation(void);
@@ -664,6 +665,10 @@ 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 (hypervisor_is_type(X86_HYPER_XEN_PV))
+                       return sprintf(buf, "Unknown (XEN PV detected, 
hypervisor "
+                                           "mitigation required)\n");
+
                break;
 
        case X86_BUG_SPECTRE_V1:
-- 
2.12.3

-- 
Jiri Kosina
SUSE Labs

Reply via email to