Messages in this thread | | | Date | Tue, 14 Nov 2023 13:50:28 +0100 | From | Peter Zijlstra <> | Subject | Re: [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.
| |