]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - arch/x86/kvm/mmu/mmu.c
KVM: x86/mmu: Alloc page for PDPTEs when shadowing 32-bit NPT with 64-bit
authorSean Christopherson <seanjc@google.com>
Fri, 5 Mar 2021 01:10:46 +0000 (17:10 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 15 Mar 2021 08:42:14 +0000 (04:42 -0400)
commit04d45551a1eefbea42655da52f56e846c0af721a
treeea918179b87b2046554ae0430b3b63e522ba80a5
parent43c11d91fb1e4c41309db3d233ac1e048cdc8dd0
KVM: x86/mmu: Alloc page for PDPTEs when shadowing 32-bit NPT with 64-bit

Allocate the so called pae_root page on-demand, along with the lm_root
page, when shadowing 32-bit NPT with 64-bit NPT, i.e. when running a
32-bit L1.  KVM currently only allocates the page when NPT is disabled,
or when L0 is 32-bit (using PAE paging).

Note, there is an existing memory leak involving the MMU roots, as KVM
fails to free the PAE roots on failure.  This will be addressed in a
future commit.

Fixes: ee6268ba3a68 ("KVM: x86: Skip pae_root shadow allocation if tdp enabled")
Fixes: b6b80c78af83 ("KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit NPT")
Cc: stable@vger.kernel.org
Reviewed-by: Ben Gardon <bgardon@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210305011101.3597423-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c