]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/x86/kvm/svm.c
KVM: x86: Don't attempt VMWare emulation on #GP with non-zero error code
[linux.git] / arch / x86 / kvm / svm.c
index 7e352e81df3165f4f3d2ad109abbd160901dbb68..00ec27bc2946b932760feebab84b3bf8171da121 100644 (file)
@@ -2772,12 +2772,20 @@ static int gp_interception(struct vcpu_svm *svm)
 
        WARN_ON_ONCE(!enable_vmware_backdoor);
 
+       /*
+        * VMware backdoor emulation on #GP interception only handles IN{S},
+        * OUT{S}, and RDPMC, none of which generate a non-zero error code.
+        */
+       if (error_code) {
+               kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
+               return 1;
+       }
        er = kvm_emulate_instruction(vcpu,
                EMULTYPE_VMWARE | EMULTYPE_NO_UD_ON_FAIL);
        if (er == EMULATE_USER_EXIT)
                return 0;
        else if (er != EMULATE_DONE)
-               kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
+               kvm_queue_exception_e(vcpu, GP_VECTOR, 0);
        return 1;
 }