Skip to content

Commit a057e0e

Browse files
davidhildenbrandbonzini
authored andcommitted
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 <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent a170504 commit a057e0e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

arch/x86/kvm/vmx.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9721,18 +9721,15 @@ static unsigned long nested_ept_get_cr3(struct kvm_vcpu *vcpu)
97219721

97229722
static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu)
97239723
{
9724-
bool wants_ad;
9725-
97269724
WARN_ON(mmu_is_nested(vcpu));
9727-
wants_ad = nested_ept_ad_enabled(vcpu);
9728-
if (wants_ad && !enable_ept_ad_bits)
9725+
if (!valid_ept_address(vcpu, nested_ept_get_cr3(vcpu)))
97299726
return 1;
97309727

97319728
kvm_mmu_unload(vcpu);
97329729
kvm_init_shadow_ept_mmu(vcpu,
97339730
to_vmx(vcpu)->nested.nested_vmx_ept_caps &
97349731
VMX_EPT_EXECUTE_ONLY_BIT,
9735-
wants_ad);
9732+
nested_ept_ad_enabled(vcpu));
97369733
vcpu->arch.mmu.set_cr3 = vmx_set_cr3;
97379734
vcpu->arch.mmu.get_cr3 = nested_ept_get_cr3;
97389735
vcpu->arch.mmu.inject_page_fault = nested_ept_inject_page_fault;

0 commit comments

Comments
 (0)