aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrish Sadhukhan <[email protected]>2019-04-08 17:35:12 -0400
committerPaolo Bonzini <[email protected]>2019-04-16 15:39:03 +0200
commitde2bc2bfdf419ad9078736d88cae72beae972a59 (patch)
treeee3fc5cfef8b92a9dc281978709da961995d346e
parentf6b0db1fdafad5fdbe10a4a3559da42d286435e6 (diff)
kvm: nVMX: Check "load IA32_PAT" VM-entry control on vmentry
According to section "Checking and Loading Guest State" in Intel SDM vol 3C, the following check is performed on vmentry: If the "load IA32_PAT" VM-entry control is 1, the value of the field for the IA32_PAT MSR must be one that could be written by WRMSR without fault at CPL 0. Specifically, each of the 8 bytes in the field must have one of the values 0 (UC), 1 (WC), 4 (WT), 5 (WP), 6 (WB), or 7 (UC-). Signed-off-by: Krish Sadhukhan <[email protected]> Reviewed-by: Karl Heubaum <[email protected]> Suggested-by: Sean Christopherson <[email protected]> Reviewed-by: Sean Christopherson <[email protected]> Reviewed-by: Jim Mattson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
-rw-r--r--arch/x86/kvm/vmx/nested.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 37cd5ebac4fb..8dc6a43cfdf3 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -2696,6 +2696,10 @@ static int nested_vmx_check_vmentry_postreqs(struct kvm_vcpu *vcpu,
!nested_guest_cr4_valid(vcpu, vmcs12->guest_cr4))
return 1;
+ if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PAT) &&
+ !kvm_pat_valid(vmcs12->guest_ia32_pat))
+ return 1;
+
if (nested_vmx_check_vmcs_link_ptr(vcpu, vmcs12)) {
*exit_qual = ENTRY_FAIL_VMCS_LINK_PTR;
return 1;