libipt, block: handle instructions overlapping sections

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.

Since isid and IP no longer suffice to read the instruction's memory, we provide
the instruction's size and raw bytes as we do in struct pt_insn.  We mark the
block as truncated to indicate that.  Such an instruction ends a block so only
the last instruction of a block may be truncated.

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