[lkml]   [2019]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v3 5/6] x86/alternative: Use a single access in text_poke() where possible
On Tue, 15 Jan 2019 12:10:19 +0100
Alexandre Chartre <> wrote:

> Thinking more about it (and I've probably missed something or I am just being
> totally stupid because this seems way too simple), can't we just replace the
> "call" with "push+jmp" and patch the jmp instruction?
> Instead of having:
> call target
> Have:
> push $done
> static_call:
> jmp target
> done:

But how do you implement it? Inline assembly()? Then you need to be
able to do that for any type of function parameters (there will be
users that have 13 parameters!)

I believe people have mentioned having a gcc plugin that would do it
for us, which was one of the suggested solutions.

-- Steve

> Then we can safely patch the "jmp" instruction to jump to a new target
> with text_poke_bp(), using the new target as the text_poke_bp() handler:
> new_jmp_code = opcode of "jmp new_target"
> text_poke_bp(static_call, new_jmp_code, new_jmp_code_size, new_target);
> Problems come with patching a call instruction, but there's no issue with patching
> a jmp, no? (that's what jump labels do).
> No change to the int3 handler, no thunk, this seems really too simple... :-)

 \ /
  Last update: 2019-01-15 17:20    [W:0.119 / U:3.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site