]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: nVMX: fix vmentry failure code when L2 state would require emulation
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 21 Mar 2018 13:20:18 +0000 (14:20 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 21 Mar 2018 13:20:33 +0000 (14:20 +0100)
Commit 7324c15db720 ("KVM: vVMX: signal failure for nested VMEntry if
emulation_required", 2018-03-12) introduces a new error path which does
not set *entry_failure_code.  Fix that to avoid a leak of L0 stack to L1.

Reported-by: Radim Krčmář <rkrcmar@redhat.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c

index 1b8d1228c8fc044303facab966bd9777636cc32c..1eb06f79e61b994c9755013da9d1b21fb4c8b269 100644 (file)
@@ -11059,8 +11059,10 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
         * which means L1 attempted VMEntry to L2 with invalid state.
         * Fail the VMEntry.
         */
-       if (vmx->emulation_required)
+       if (vmx->emulation_required) {
+               *entry_failure_code = ENTRY_FAIL_DEFAULT;
                return 1;
+       }
 
        /* Shadow page tables on either EPT or shadow page tables. */
        if (nested_vmx_load_cr3(vcpu, vmcs12->guest_cr3, nested_cpu_has_ept(vmcs12),