Skip to content

Commit

Permalink
KVM: SVM: #SMI interception must not skip the instruction
Browse files Browse the repository at this point in the history
commit 991afbb upstream.

Commit 5ff3a35 ("KVM: x86: Move trivial instruction-based
exit handlers to common code"), unfortunately made a mistake of
treating nop_on_interception and nop_interception in the same way.

Former does truly nothing while the latter skips the instruction.

SMI VM exit handler should do nothing.
(SMI itself is handled by the host when we do STGI)

Fixes: 5ff3a35 ("KVM: x86: Move trivial instruction-based exit handlers to common code")
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20210707125100.677203-2-mlevitsk@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Maxim Levitsky authored and gregkh committed Jul 20, 2021
1 parent 2338682 commit bbca8ad
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/x86/kvm/svm/svm.c
Expand Up @@ -2080,6 +2080,11 @@ static int nmi_interception(struct kvm_vcpu *vcpu)
return 1;
}

static int smi_interception(struct kvm_vcpu *vcpu)
{
return 1;
}

static int intr_interception(struct kvm_vcpu *vcpu)
{
++vcpu->stat.irq_exits;
Expand Down Expand Up @@ -3063,7 +3068,7 @@ static int (*const svm_exit_handlers[])(struct kvm_vcpu *vcpu) = {
[SVM_EXIT_EXCP_BASE + GP_VECTOR] = gp_interception,
[SVM_EXIT_INTR] = intr_interception,
[SVM_EXIT_NMI] = nmi_interception,
[SVM_EXIT_SMI] = kvm_emulate_as_nop,
[SVM_EXIT_SMI] = smi_interception,
[SVM_EXIT_INIT] = kvm_emulate_as_nop,
[SVM_EXIT_VINTR] = interrupt_window_interception,
[SVM_EXIT_RDPMC] = kvm_emulate_rdpmc,
Expand Down

0 comments on commit bbca8ad

Please sign in to comment.