If Xen isn't virtualising MSR_SPEC_CTRL for guests, IBRSB shouldn't be
advertised. It is not currently possible to express this via the existing
command line options, but such an ability will be introduced.
Another useful option in some usecases is to offer IBPB without IBRS. When a
guest kernel is known to be compatible (uses retpoline and knows about the AMD
IBPB feature bit), an administrator with pre-Skylake hardware may wish to hide
IBRS. This allows the VM to have full protection, without Xen or the VM
needing to touch MSR_SPEC_CTRL, which can reduce the overhead of Spectre
mitigations.
Break the logic common to both PV and HVM CPUID calculations into a common
helper, to avoid duplication.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit:
cb06b308ec71b23f37a44f5e2351fe2cae0306e9
master date: 2018-05-16 12:19:10 +0100
if ( count == 0 )
{
+ if ( !boot_cpu_has(X86_FEATURE_SC_MSR_HVM) )
+ *edx &= ~cpufeat_mask(X86_FEATURE_IBRSB);
+
/*
* Override STIBP to match IBRS. Guests can safely use STIBP
* functionality on non-HT hardware, but can't necesserily protect
case 0x00000007:
if ( regs->_ecx == 0 )
{
+ if ( !boot_cpu_has(X86_FEATURE_SC_MSR_PV) )
+ d &= ~cpufeat_mask(X86_FEATURE_IBRSB);
+
/*
* Override STIBP to match IBRS. Guests can safely use STIBP
* functionality on non-HT hardware, but can't necesserily protect
cpufeat_mask(X86_FEATURE_ADX) |
cpufeat_mask(X86_FEATURE_FSGSBASE));
- d &= cpufeat_mask(X86_FEATURE_IBRSB);
+ if ( boot_cpu_has(X86_FEATURE_SC_MSR_PV) )
+ d &= cpufeat_mask(X86_FEATURE_IBRSB);
+ else
+ d = 0;
/* Override STIBP to match IBRS (see above). */
if ( d & cpufeat_mask(X86_FEATURE_IBRSB) )