File x86-Spectre-CPUID-2.patch of Package xen.7652
x86: correct "further CPUID handling adjustments"
Commit 62b187969 "x86: further CPUID handling adjustments" went too far,
breaking feature levelling of DomU-s. Restrict the PV overrides to just
Dom0 and undo the HVM overrides.
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- sle12sp2.orig/xen/arch/x86/hvm/hvm.c 2018-05-23 13:47:50.559776737 +0200
+++ sle12sp2/xen/arch/x86/hvm/hvm.c 2018-05-23 14:16:48.971034300 +0200
@@ -3497,7 +3497,6 @@ void hvm_cpuid(unsigned int input, unsig
*ecx &= hvm_featureset[FEATURESET_7c0];
- *edx |= cpufeat_mask(X86_FEATURE_STIBP);
*edx &= hvm_featureset[FEATURESET_7d0];
/* Don't expose HAP-only features to non-hap guests. */
@@ -3657,7 +3656,6 @@ void hvm_cpuid(unsigned int input, unsig
hvm_cpuid(0x80000001, NULL, NULL, NULL, &_edx);
*eax |= (_edx & cpufeat_mask(X86_FEATURE_LM) ? vaddr_bits : 32) << 8;
- *ebx |= cpufeat_mask(X86_FEATURE_IBPB);
*ebx &= hvm_featureset[FEATURESET_e8b];
break;
}
--- sle12sp2.orig/xen/arch/x86/traps.c 2018-05-23 11:23:31.000000000 +0200
+++ sle12sp2/xen/arch/x86/traps.c 2018-05-23 14:16:45.236029000 +0200
@@ -1089,7 +1089,8 @@ void pv_cpuid(struct cpu_user_regs *regs
c &= pv_featureset[FEATURESET_7c0];
- d |= cpufeat_mask(X86_FEATURE_STIBP);
+ if ( is_hardware_domain(currd) || is_control_domain(currd) )
+ d |= cpufeat_mask(X86_FEATURE_STIBP);
d &= pv_featureset[FEATURESET_7d0];
if ( !is_pvh_domain(currd) )
@@ -1188,7 +1189,8 @@ void pv_cpuid(struct cpu_user_regs *regs
case 0x80000008:
a = paddr_bits | (vaddr_bits << 8);
- b |= cpufeat_mask(X86_FEATURE_IBPB);
+ if ( is_hardware_domain(currd) || is_control_domain(currd) )
+ b |= cpufeat_mask(X86_FEATURE_IBPB);
b &= pv_featureset[FEATURESET_e8b];
break;