diff mbox series

KVM: SVM: Remove bogus WARN and emulation if guest #GPs with EFER.SVME=1

Message ID 20210204023536.3397005-1-seanjc@google.com (mailing list archive)
State New, archived
Headers show
Series KVM: SVM: Remove bogus WARN and emulation if guest #GPs with EFER.SVME=1 | expand

Commit Message

Sean Christopherson Feb. 4, 2021, 2:35 a.m. UTC
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(-)

Comments

Paolo Bonzini Feb. 4, 2021, 8:20 a.m. UTC | #1
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
diff mbox series

Patch

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