Skip to content

Commit

Permalink
KVM: nVMX: Clear pending KVM_REQ_GET_VMCS12_PAGES when leaving nested
Browse files Browse the repository at this point in the history
Letting this pend may cause nested_get_vmcs12_pages to run against an
invalid state, corrupting the effective vmcs of L1.

This was triggerable in QEMU after a guest corruption in L2, followed by
a L1 reset.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Liran Alon <liran.alon@oracle.com>
Cc: stable@vger.kernel.org
Fixes: 7f7f1ba ("KVM: x86: do not load vmcs12 pages while still in SMM")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Jan Kiszka authored and Paolo Bonzini committed Jul 22, 2019
1 parent 30cd860 commit cf64527
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/x86/kvm/vmx/nested.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ static void free_nested(struct kvm_vcpu *vcpu)
if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon)
return;

kvm_clear_request(KVM_REQ_GET_VMCS12_PAGES, vcpu);

vmx->nested.vmxon = false;
vmx->nested.smm.vmxon = false;
free_vpid(vmx->nested.vpid02);
Expand Down

0 comments on commit cf64527

Please sign in to comment.