|
@@ -622,6 +622,9 @@ static int do_insn_fetch(struct x86_emulate_ctxt *ctxt,
|
|
|
{
|
|
|
int rc = 0;
|
|
|
|
|
|
+ /* x86 instructions are limited to 15 bytes. */
|
|
|
+ if (eip + size - ctxt->decode.eip_orig > 15)
|
|
|
+ return X86EMUL_UNHANDLEABLE;
|
|
|
eip += ctxt->cs_base;
|
|
|
while (size--) {
|
|
|
rc = do_fetch_insn_byte(ctxt, ops, eip++, dest++);
|
|
@@ -880,7 +883,7 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
|
|
|
/* Shadow copy of register state. Committed on successful emulation. */
|
|
|
|
|
|
memset(c, 0, sizeof(struct decode_cache));
|
|
|
- c->eip = kvm_rip_read(ctxt->vcpu);
|
|
|
+ c->eip = c->eip_orig = kvm_rip_read(ctxt->vcpu);
|
|
|
ctxt->cs_base = seg_base(ctxt, VCPU_SREG_CS);
|
|
|
memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs);
|
|
|
|