Re: [RFC PATCH 1/7] static_call/x86: Add __static_call_returnl0()

From: Peter Zijlstra
Date: Tue Nov 10 2020 - 08:53:27 EST


On Tue, Nov 10, 2020 at 02:42:23PM +0100, Frederic Weisbecker wrote:
> On Tue, Nov 10, 2020 at 11:13:07AM +0100, Peter Zijlstra wrote:
> > On Tue, Nov 10, 2020 at 10:55:15AM +0100, Peter Zijlstra wrote:
> > > On Tue, Nov 10, 2020 at 01:56:03AM +0100, Frederic Weisbecker wrote:
> > >
> > > > [fweisbec: s/disp16/data16, integrate into text_get_insn(), elaborate
> > > > comment on the resulting insn, emulate on int3 trap, provide validation,
> > > > uninline __static_call_return0() for HAVE_STATIC_CALL]
> >
> > > Why did you add full emulation of this? The patch I send to you used the
> > > text_poke_bp(.emulate) argument to have it emulate an actual call to the
> > > out-of-line version of that function.
> > >
> > > That should work fine and is a lot less code.
> >
> > For reference; the below is what I send you. Actually doing the
> > __static_call_return0() call while we poke the magic XOR instruction is
> > much simpler.
>
> Ok I'll get back to that. I'll just tweak a bit static_call_validate()
> so that it is aware of that instruction.

Ah yes indeed!