lkml.org 
[lkml]   [2023]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 2/5] x86/alternative: add indirect call patching
On Tue, Nov 14, 2023 at 01:37:37PM +0100, Borislav Petkov 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));
> > +#endif
> > + if (!target)
> > + target = bug;
> > +
> > + /* (BUG_func - .) + (target - BUG_func) := target - . */
> > + *(s32 *)(insn_buff + 1) += target - bug;
>
> If I squint hard enough, this looks like it is replacing one call with
> another. We have a C macro alternative_call() which does exactly that.
> Why can't you define an asm version ALTERNATIVE_CALL and use it
> instead of using adding a new flag? We have 16 possible ones in total.

This loads the function target from the pv_ops table. We can't otherwise
do this.

\
 
 \ /
  Last update: 2023-11-20 13:59    [W:0.084 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site