From fa9fec50e9b3b328a8dfa1777e93e7108352d410 Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Tue, 7 Aug 2018 20:40:15 +0800 Subject: [PATCH] hv: inject invalid opcode if decode instruction fails We inject invalid opcode if instruction decode fails. We don't support many instruction. If new type guest hit the invalid opcode and it's necessary to emulate that instruction, we could add new instruction then. Signed-off-by: Yin Fengwei Reviewed-by: Jason Chen CJ Acked-by: Anthony Xu --- hypervisor/arch/x86/guest/instr_emul.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hypervisor/arch/x86/guest/instr_emul.c b/hypervisor/arch/x86/guest/instr_emul.c index 2ebe3d7d7..0b171d6b1 100644 --- a/hypervisor/arch/x86/guest/instr_emul.c +++ b/hypervisor/arch/x86/guest/instr_emul.c @@ -2287,7 +2287,8 @@ int decode_instruction(struct vcpu *vcpu) if (retval != 0) { pr_err("decode instruction failed @ 0x%016llx:", vcpu_get_rip(vcpu)); - return -EINVAL; + vcpu_inject_ud(vcpu); + return -EFAULT; } return emul_ctxt->vie.opsize;