libipt, insn: retry instruction decode

When adding image sections that overlap with existing image sections, we may end
up with instructions that are split between two (or more) image sections.  Since
memory reads stop at image section boundaries, instruction decode will fail with
-pte_bad_insn for those instructions.

Issue additional memory reads for the remaining bytes and try to decode the
instruction again until we are either able to decode it correctly or fail to
read more bytes.

We report the isid corresponding to the first byte of the instruction and mark
the instruction as truncated.

This only covers the instruction flow decoder.  The block decoder needs more
work in order to handle this case.

Change-Id: I31b39fbdd917cfcc5565a26f12507488e2332eb8
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
3 files changed