]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
kvm: mmu: Don't read PDPTEs when paging is not enabled
authorJunaid Shahid <junaids@google.com>
Thu, 9 Aug 2018 00:45:24 +0000 (17:45 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 10 Dec 2019 18:01:20 +0000 (18:01 +0000)
commit d35b34a9a70edae7ef923f100e51b8b5ae9fe899 upstream.

kvm should not attempt to read guest PDPTEs when CR0.PG = 0 and
CR4.PAE = 1.

Signed-off-by: Junaid Shahid <junaids@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/kvm/x86.c

index aaa4c87450720b875b389a4b9cd4c6cff50086bc..d6711e5b9e781446469e19d1d0837b81d22e338d 100644 (file)
@@ -517,7 +517,7 @@ static bool pdptrs_changed(struct kvm_vcpu *vcpu)
        gfn_t gfn;
        int r;
 
-       if (is_long_mode(vcpu) || !is_pae(vcpu))
+       if (is_long_mode(vcpu) || !is_pae(vcpu) || !is_paging(vcpu))
                return false;
 
        if (!test_bit(VCPU_EXREG_PDPTR,
@@ -6789,7 +6789,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
                kvm_update_cpuid(vcpu);
 
        idx = srcu_read_lock(&vcpu->kvm->srcu);
-       if (!is_long_mode(vcpu) && is_pae(vcpu)) {
+       if (!is_long_mode(vcpu) && is_pae(vcpu) && is_paging(vcpu)) {
                load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu));
                mmu_reset_needed = 1;
        }