All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bandan Das <bsd@redhat.com>, Maxim Levitsky <mlevitsk@redhat.com>
Subject: [PATCH] KVM: SVM: Remove bogus WARN and emulation if guest #GPs with EFER.SVME=1
Date: Wed,  3 Feb 2021 18:35:36 -0800	[thread overview]
Message-ID: <20210204023536.3397005-1-seanjc@google.com> (raw)

Immediately reinject #GP (if intercepted) if the VMware backdoor is
disabled and the instruction is not affected by the erratum that causes
bogus #GPs on SVM instructions.  It is completely reasonable for the
guest to take a #GP(0) with EFER.SVME=1, e.g. when probing an MSR, and
attempting emulation on an unknown instruction is obviously not good.

Fixes: b3f4e11adc7d ("KVM: SVM: Add emulation support for #GP triggered by SVM instructions")
Cc: Bandan Das <bsd@redhat.com>
Cc: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/svm/svm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index f53e6377a933..707a2f85bcc6 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -2263,7 +2263,8 @@ static int gp_interception(struct vcpu_svm *svm)
 	opcode = svm_instr_opcode(vcpu);
 
 	if (opcode == NONE_SVM_INSTR) {
-		WARN_ON_ONCE(!enable_vmware_backdoor);
+		if (!enable_vmware_backdoor)
+			goto reinject;
 
 		/*
 		 * VMware backdoor emulation on #GP interception only handles
-- 
2.30.0.365.g02bc693789-goog


             reply	other threads:[~2021-02-04  2:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04  2:35 Sean Christopherson [this message]
2021-02-04  8:20 ` [PATCH] KVM: SVM: Remove bogus WARN and emulation if guest #GPs with EFER.SVME=1 Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210204023536.3397005-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=bsd@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.