diff options
author | Jan Dakinevich <jan.dakinevich@virtuozzo.com> | 2019-08-27 13:07:08 +0000 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-09-11 18:01:34 +0200 |
commit | c8848cee74ff05638e913582a476bde879c968ad (patch) | |
tree | ba46713a16e726e683f2ea113ca8a5d3535c05b2 /arch/x86/kvm/x86.c | |
parent | 8530a79c5a9f4e29e6ffb35ec1a79d81f4968ec8 (diff) | |
download | lwn-c8848cee74ff05638e913582a476bde879c968ad.tar.gz lwn-c8848cee74ff05638e913582a476bde879c968ad.zip |
KVM: x86: set ctxt->have_exception in x86_decode_insn()
x86_emulate_instruction() takes into account ctxt->have_exception flag
during instruction decoding, but in practice this flag is never set in
x86_decode_insn().
Fixes: 6ea6e84309ca ("KVM: x86: inject exceptions produced by x86_decode_insn")
Cc: stable@vger.kernel.org
Cc: Denis Lunev <den@virtuozzo.com>
Cc: Roman Kagan <rkagan@virtuozzo.com>
Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 263fac7e9307..f7cfd8e6edd1 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6577,6 +6577,12 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, emulation_type)) return EMULATE_DONE; if (ctxt->have_exception) { + /* + * #UD should result in just EMULATION_FAILED, and trap-like + * exception should not be encountered during decode. + */ + WARN_ON_ONCE(ctxt->exception.vector == UD_VECTOR || + exception_type(ctxt->exception.vector) == EXCPT_TRAP); inject_emulated_exception(vcpu); return EMULATE_DONE; } |