Skip to content

Commit bea7e31

Browse files
jpoimboesuryasaimadhu
authored andcommitted
KVM: VMX: Fix IBRS handling after vmexit
For legacy IBRS to work, the IBRS bit needs to be always re-written after vmexit, even if it's already on. Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Borislav Petkov <[email protected]>
1 parent fc02735 commit bea7e31

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6844,8 +6844,13 @@ void noinstr vmx_spec_ctrl_restore_host(struct vcpu_vmx *vmx,
68446844

68456845
/*
68466846
* If the guest/host SPEC_CTRL values differ, restore the host value.
6847+
*
6848+
* For legacy IBRS, the IBRS bit always needs to be written after
6849+
* transitioning from a less privileged predictor mode, regardless of
6850+
* whether the guest/host values differ.
68476851
*/
6848-
if (vmx->spec_ctrl != hostval)
6852+
if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) ||
6853+
vmx->spec_ctrl != hostval)
68496854
native_wrmsrl(MSR_IA32_SPEC_CTRL, hostval);
68506855

68516856
barrier_nospec();

0 commit comments

Comments
 (0)