aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2017-08-10 17:36:54 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2017-08-11 12:53:22 -0400
commita057e0e22ca11d04959648694945ebcc44873159 (patch)
treeadd9e059efc7aa4fad4777bf5d25997450877b9c
parenta170504f9f6d4835e042edf4c764a21594acc79c (diff)
KVM: nVMX: validate eptp pointer
Let's reuse the function introduced with eptp switching. We don't explicitly have to check against enable_ept_ad_bits, as this is implicitly done when checking against nested_vmx_ept_caps in valid_ept_address(). Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/vmx.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ed1074e98b8e..df8d2f127508 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -9721,18 +9721,15 @@ static unsigned long nested_ept_get_cr3(struct kvm_vcpu *vcpu)
9721 9721
9722static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu) 9722static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu)
9723{ 9723{
9724 bool wants_ad;
9725
9726 WARN_ON(mmu_is_nested(vcpu)); 9724 WARN_ON(mmu_is_nested(vcpu));
9727 wants_ad = nested_ept_ad_enabled(vcpu); 9725 if (!valid_ept_address(vcpu, nested_ept_get_cr3(vcpu)))
9728 if (wants_ad && !enable_ept_ad_bits)
9729 return 1; 9726 return 1;
9730 9727
9731 kvm_mmu_unload(vcpu); 9728 kvm_mmu_unload(vcpu);
9732 kvm_init_shadow_ept_mmu(vcpu, 9729 kvm_init_shadow_ept_mmu(vcpu,
9733 to_vmx(vcpu)->nested.nested_vmx_ept_caps & 9730 to_vmx(vcpu)->nested.nested_vmx_ept_caps &
9734 VMX_EPT_EXECUTE_ONLY_BIT, 9731 VMX_EPT_EXECUTE_ONLY_BIT,
9735 wants_ad); 9732 nested_ept_ad_enabled(vcpu));
9736 vcpu->arch.mmu.set_cr3 = vmx_set_cr3; 9733 vcpu->arch.mmu.set_cr3 = vmx_set_cr3;
9737 vcpu->arch.mmu.get_cr3 = nested_ept_get_cr3; 9734 vcpu->arch.mmu.get_cr3 = nested_ept_get_cr3;
9738 vcpu->arch.mmu.inject_page_fault = nested_ept_inject_page_fault; 9735 vcpu->arch.mmu.inject_page_fault = nested_ept_inject_page_fault;