summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorLiran Alon <liran.alon@oracle.com>2018-06-23 02:35:04 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2018-08-06 17:58:39 +0200
commita6192d40d52f6b86997a71449e2ebc3d7f5ca103 (patch)
tree25c54a5e085e20d0f172c2e303302d3437db1dc6 /arch/x86
parentfa97d7dba7538adf174c3984e726c0537ab553a4 (diff)
KVM: nVMX: Fail VMLAUNCH and VMRESUME on shadow VMCS
Signed-off-by: Liran Alon <liran.alon@oracle.com> Signed-off-by: Jim Mattson <jmattson@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 44e2b82f6519..f6ec898ac539 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -11876,6 +11876,17 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
vmcs12 = get_vmcs12(vcpu);
+ /*
+ * Can't VMLAUNCH or VMRESUME a shadow VMCS. Despite the fact
+ * that there *is* a valid VMCS pointer, RFLAGS.CF is set
+ * rather than RFLAGS.ZF, and no error number is stored to the
+ * VM-instruction error field.
+ */
+ if (vmcs12->hdr.shadow_vmcs) {
+ nested_vmx_failInvalid(vcpu);
+ goto out;
+ }
+
if (enable_shadow_vmcs)
copy_shadow_to_vmcs12(vmx);