kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: Remove bogus WARN and emulation if guest #GPs with EFER.SVME=1
@ 2021-02-04  2:35 Sean Christopherson
  2021-02-04  8:20 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Sean Christopherson @ 2021-02-04  2:35 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel, Bandan Das, Maxim Levitsky

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: SVM: Remove bogus WARN and emulation if guest #GPs with EFER.SVME=1
  2021-02-04  2:35 [PATCH] KVM: SVM: Remove bogus WARN and emulation if guest #GPs with EFER.SVME=1 Sean Christopherson
@ 2021-02-04  8:20 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-02-04  8:20 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Vitaly Kuznetsov, Wanpeng Li, Jim Mattson, Joerg Roedel, kvm,
	linux-kernel, Bandan Das, Maxim Levitsky

On 04/02/21 03:35, Sean Christopherson wrote:
> 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
> 

Squashed, thanks.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-04  8:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04  2:35 [PATCH] KVM: SVM: Remove bogus WARN and emulation if guest #GPs with EFER.SVME=1 Sean Christopherson
2021-02-04  8:20 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).