* [PATCH] KVM: nVMX: Do not emulate #UD while in guest mode
@ 2015-03-09 19:56 Jan Kiszka
2015-03-13 16:44 ` Marcelo Tosatti
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2015-03-09 19:56 UTC (permalink / raw)
To: kvm, Paolo Bonzini, Marcelo Tosatti
While in L2, leave all #UD to L2 and do not try to emulate it. If L1 is
interested in doing this, it reports its interest via the exception
bitmap, and we never get into handle_exception of L0 anyway.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Noticed while wondering where the vmmcall of a misconfigured L2 went on
an Intel box: to nowhere. This bug caused a spurious fixup, and the
emulator bug did not even let it trigger a vmcall vmexit.
arch/x86/kvm/vmx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index f7b20b4..fa0627c 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5065,6 +5065,10 @@ static int handle_exception(struct kvm_vcpu *vcpu)
}
if (is_invalid_opcode(intr_info)) {
+ if (is_guest_mode(vcpu)) {
+ kvm_queue_exception(vcpu, UD_VECTOR);
+ return 1;
+ }
er = emulate_instruction(vcpu, EMULTYPE_TRAP_UD);
if (er != EMULATE_DONE)
kvm_queue_exception(vcpu, UD_VECTOR);
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] KVM: nVMX: Do not emulate #UD while in guest mode
2015-03-09 19:56 [PATCH] KVM: nVMX: Do not emulate #UD while in guest mode Jan Kiszka
@ 2015-03-13 16:44 ` Marcelo Tosatti
0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2015-03-13 16:44 UTC (permalink / raw)
To: Jan Kiszka; +Cc: kvm, Paolo Bonzini
On Mon, Mar 09, 2015 at 08:56:43PM +0100, Jan Kiszka wrote:
> While in L2, leave all #UD to L2 and do not try to emulate it. If L1 is
> interested in doing this, it reports its interest via the exception
> bitmap, and we never get into handle_exception of L0 anyway.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> Noticed while wondering where the vmmcall of a misconfigured L2 went on
> an Intel box: to nowhere. This bug caused a spurious fixup, and the
> emulator bug did not even let it trigger a vmcall vmexit.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-13 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 19:56 [PATCH] KVM: nVMX: Do not emulate #UD while in guest mode Jan Kiszka
2015-03-13 16:44 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox