From: Konrad Rzeszutek Wilk Date: Fri, 29 Dec 2017 19:45:40 +0000 (-0500) Subject: x86/spec_ctrl: Disable if running as Xen PV guest. X-Git-Tag: v4.1.12-124.31.3~1389 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=93a55b77518d862edfb61ce016ed110b9356d5ff;p=users%2Fjedix%2Flinux-maple.git 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 --- 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;