> > + if (insn_size) { > > + run->emulation_failure.ndata = 3; > > + run->emulation_failure.flags |= > > + KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES; > > + run->emulation_failure.insn_size = insn_size; > > + memcpy(run->emulation_failure.insn_bytes, > > + ctxt->fetch.data, sizeof(ctxt->fetch.data)); > > We're relying on the fact that insn_bytes is at least as large as > fetch.data, which is fine, but worth an assertion? > > "Leaking" irrelevant bytes here also seems bad, but I can't immediately > see a problem as a result. > I don't think this is a problem because the instruction bytes stream has irrelevant bytes in it anyway. In the test attached I verify that it receives an flds instruction in userspace that was emulated in the guest. In the stream that comes through insn_size is set to 15 and the instruction is only 2 bytes long, so the stream has irrelevant bytes in it as far as this instruction is concerned. > > + } > > +} > > +