lkml.org 
[lkml]   [2019]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
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 <alexandre.chartre@oracle.com> 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.090 / U:31.404 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site