Re: [POC][RFC][PATCH 1/2] jump_function: Addition of new feature "jump_function"

From: Peter Zijlstra
Date: Mon Oct 08 2018 - 11:58:29 EST


On Mon, Oct 08, 2018 at 01:33:14AM -0700, Andy Lutomirski wrote:
> > Can't we hijack the relocation records for these functions before they
> > get thrown out in the (final) link pass or something?
>
> I could be talking out my arse here, but I thought we could do this,
> too, then changed my mind. The relocation records give us the
> location of the call or jump operand, but they donât give the address
> of the beginning of the instruction.

But that's like 1 byte before the operand, right? We could even double check
this by reading back that byte and ensuring it is in fact 0xE8 (CALL).

AFAICT there is only the _1_ CALL encoding, and that is the 5 byte: E8 <PLT32>,
so if we have the PLT32 location, we also have the instruction location. Or am
I missing something?