From 93a55b77518d862edfb61ce016ed110b9356d5ff Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Fri, 29 Dec 2017 14:45:40 -0500 Subject: [PATCH] x86/spec_ctrl: Disable if running as Xen PV guest. Orabug: 27344012 CVE: CVE-2017-5715 Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: John Haxby Signed-off-by: Kirtikar Kashyap --- arch/x86/kernel/cpu/scattered.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 61216c821682..1dd9a5b09e01 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -86,8 +86,15 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c) } if (!c->cpu_index) { + bool ignore = false; + + if (xen_pv_domain()) + ignore = true; + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL)) { - printk(KERN_INFO "FEATURE SPEC_CTRL Present\n"); + printk(KERN_INFO "FEATURE SPEC_CTRL Present%s\n", ignore ? " but ignored (Xen)": ""); + if (ignore) + return; set_ibrs_supported(); set_ibpb_supported(); if (ibrs_inuse) @@ -95,7 +102,9 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c) if (ibpb_inuse) sysctl_ibpb_enabled = 1; } else if (boot_cpu_has(X86_FEATURE_IBPB)) { - printk_once(KERN_INFO "FEATURE IBPB Present\n"); + printk_once(KERN_INFO "FEATURE IBPB Present%s\n", ignore ? " but ignored (Xen)": ""); + if (ignore) + return; set_ibpb_supported(); if (ibpb_inuse) sysctl_ibpb_enabled = 1; -- 2.50.1