On Fri, Jan 11, 2019 at 12:12:30PM -0800, Linus Torvalds wrote:
> On Fri, Jan 11, 2019 at 12:04 PM Josh Poimboeuf <jpoim...@redhat.com> wrote:
> >
> > But really, to me, having to create and manage all those custom
> > trampolines still feels a lot more complex than just making a gap on the
> > stack.
> 
> There are no "all those custom trampolines".
> 
> There is literally *one* custom trampoline that you generate as you do
> the rewriting.
> 
> Well, two, since you need the version with the "sti" before the jmp.
> 
> It would be possible to generate the custom trampoline on the fly in
> the BP handler itself, and just have a magic flag for that case. But
> it's probably simpler to do it in the caller, since you need to
> generate that special writable and executable code sequence. You
> probably don't want to do that at BP time.
> 
> You probably want to use a FIX_TEXT_POKE2 page for the generated
> sequence that just maps some generated code executably for a short
> while. Or something like that.

I was referring to the fact that a single static call key update will
usually result in patching multiple call sites.  But you're right, it's
only 1-2 trampolines per text_poke_bp() invocation.  Though eventually
we may want to batch all the writes like what Daniel has proposed for
jump labels, to reduce IPIs.

Regardless, the trampoline management seems more complex to me.  But
it's easier to argue about actual code, so maybe I'll code it up to make
it easier to compare solutions.

-- 
Josh

Reply via email to