diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2018-03-21 14:20:18 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-03-21 14:20:33 +0100 |
commit | 3184a995f782c6fdab89e62d31cf7be042582bd0 (patch) | |
tree | 7a7bd1a3e1b06033a736a21e75e6d3160813bd56 /arch | |
parent | e40ff1d6608dd9a5e07d7bc3079c64d9d676fe15 (diff) | |
download | lwn-3184a995f782c6fdab89e62d31cf7be042582bd0.tar.gz lwn-3184a995f782c6fdab89e62d31cf7be042582bd0.zip |
KVM: nVMX: fix vmentry failure code when L2 state would require emulation
Commit 2bb8cafea80b ("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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/vmx.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1b8d1228c8fc..1eb06f79e61b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -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), |