]> git.itanic.dy.fi Git - linux-stable/commit
KVM: nSVM: clear events pending from svm_complete_interrupts() when exiting to L1
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 7 Jan 2019 18:44:51 +0000 (19:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 07:18:54 +0000 (08:18 +0100)
commiteea042978351c006c658053c0e1f0e45fadfaea3
tree0b7e4e6e3fbe20770af5b1d76aa57dc2b703d995
parent1d26f9b68ba212f900835c07cd03f9ee95f467a7
KVM: nSVM: clear events pending from svm_complete_interrupts() when exiting to L1

[ Upstream commit 619ad846fc3452adaf71ca246c5aa711e2055398 ]

kvm-unit-tests' eventinj "NMI failing on IDT" test results in NMI being
delivered to the host (L1) when it's running nested. The problem seems to
be: svm_complete_interrupts() raises 'nmi_injected' flag but later we
decide to reflect EXIT_NPF to L1. The flag remains pending and we do NMI
injection upon entry so it got delivered to L1 instead of L2.

It seems that VMX code solves the same issue in prepare_vmcs12(), this was
introduced with code refactoring in commit 5f3d5799974b ("KVM: nVMX: Rework
event injection and recovery").

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/svm.c