Skip to content

Commit c547cb6

Browse files
ouptonbonzini
authored andcommitted
KVM: nVMX: Check HOST_IA32_PERF_GLOBAL_CTRL on VM-Entry
Add a consistency check on nested vm-entry for host's IA32_PERF_GLOBAL_CTRL from vmcs12. Per Intel's SDM Vol 3 26.2.2: If the "load IA32_PERF_GLOBAL_CTRL" VM-exit control is 1, bits reserved in the IA32_PERF_GLOBAL_CTRL MSR must be 0 in the field for that register" Suggested-by: Jim Mattson <[email protected]> Co-developed-by: Krish Sadhukhan <[email protected]> Signed-off-by: Krish Sadhukhan <[email protected]> Signed-off-by: Oliver Upton <[email protected]> Reviewed-by: Jim Mattson <[email protected]> Reviewed-by: Peter Shier <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent bfc6ad6 commit c547cb6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,6 +2676,11 @@ static int nested_vmx_check_host_state(struct kvm_vcpu *vcpu,
26762676
CC(!kvm_pat_valid(vmcs12->host_ia32_pat)))
26772677
return -EINVAL;
26782678

2679+
if ((vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) &&
2680+
CC(!kvm_valid_perf_global_ctrl(vcpu_to_pmu(vcpu),
2681+
vmcs12->host_ia32_perf_global_ctrl)))
2682+
return -EINVAL;
2683+
26792684
#ifdef CONFIG_X86_64
26802685
ia32e = !!(vcpu->arch.efer & EFER_LMA);
26812686
#else

0 commit comments

Comments
 (0)