aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorLadi Prosek <lprosek@redhat.com>2017-04-04 08:18:53 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-14 08:00:18 -0400
commit560a979735f49f0ba2fa28117acdfb861f05cd97 (patch)
treec93ae0befd92d0c0ca634760b7f99a5ff465b6f7 /arch/x86
parent39058adebbb1fa2e7eedbfa138f4abf978fede77 (diff)
KVM: nVMX: initialize PML fields in vmcs02
commit 1fb883bb827ee8efc1cc9ea0154f953f8a219d38 upstream. L2 was running with uninitialized PML fields which led to incomplete dirty bitmap logging. This manifested as all kinds of subtle erratic behavior of the nested guest. Fixes: 843e4330573c ("KVM: VMX: Add PML support in VMX") Signed-off-by: Ladi Prosek <lprosek@redhat.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 980133079949..0ffec8a8074f 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -10071,6 +10071,18 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
10071 10071
10072 } 10072 }
10073 10073
10074 if (enable_pml) {
10075 /*
10076 * Conceptually we want to copy the PML address and index from
10077 * vmcs01 here, and then back to vmcs01 on nested vmexit. But,
10078 * since we always flush the log on each vmexit, this happens
10079 * to be equivalent to simply resetting the fields in vmcs02.
10080 */
10081 ASSERT(vmx->pml_pg);
10082 vmcs_write64(PML_ADDRESS, page_to_phys(vmx->pml_pg));
10083 vmcs_write16(GUEST_PML_INDEX, PML_ENTITY_NUM - 1);
10084 }
10085
10074 if (nested_cpu_has_ept(vmcs12)) { 10086 if (nested_cpu_has_ept(vmcs12)) {
10075 kvm_mmu_unload(vcpu); 10087 kvm_mmu_unload(vcpu);
10076 nested_ept_init_mmu_context(vcpu); 10088 nested_ept_init_mmu_context(vcpu);