KVM: nVMX: Do not emulate #UD while in guest mode
PATCH 1/1 KVM: nVMX: Do not emulate #UD while in guest mode
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.
---
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(+)
arch/x86/kvm/vmx.c +4 -0
@@ -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 );
Signature · 1 line
2.1.4
Marcelo Tosatti
AppliedQuoted 10 lines · Jan Kiszka
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_exceptionof L0 anyway.Signed-off-by Jan Kiszka <[email protected]>---
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.