KVM: x86: Don't report guest userspace emulation error to userspace
[sfrench/cifs-2.6.git] / arch / x86 / kvm / x86.c
index 2d7f65daa8d0983538c9fe6d577fcc06937e76c8..e46da50e2cec51d56cbff2199c93a8656798e5cd 100644 (file)
@@ -5000,7 +5000,7 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu)
 
        ++vcpu->stat.insn_emulation_fail;
        trace_kvm_emulate_insn_failed(vcpu);
-       if (!is_guest_mode(vcpu)) {
+       if (!is_guest_mode(vcpu) && kvm_x86_ops->get_cpl(vcpu) == 0) {
                vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
                vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
                vcpu->run->internal.ndata = 0;