lkml.org 
[lkml]   [2023]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4 2/5] x86/alternative: add indirect call patching
From
On 14.11.23 16:06, Borislav Petkov wrote:
> On Mon, Oct 30, 2023 at 03:25:05PM +0100, Juergen Gross wrote:
>> +#ifdef CONFIG_X86_64
>> + /* ff 15 00 00 00 00 call *0x0(%rip) */
>> + target = *(void **)(instr + a->instrlen + *(s32 *)(instr + 2));
>> +#else
>> + /* ff 15 00 00 00 00 call *0x0 */
>> + target = *(void **)(*(s32 *)(instr + 2));
>
> Yeah, let's document those a bit better. Either with comments above or
> as Peter suggests:
>
> /* Add 2 to skip opcode and ModRM byte: */
> disp32 = *(s32 *)(instr + 2);
>
> rip_rela_ptr = (void **)(instr + a->instrlen + disp32);
> target = *rip_rela_ptr;
>
> so that it is crystal clear what we're doing here.

Okay.


Juergen

[unhandled content-type:application/pgp-keys][unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2023-11-20 13:59    [W:0.163 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site