[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231114125028.GX3818@noisy.programming.kicks-ass.net>
Date: Tue, 14 Nov 2023 13:50:28 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Juergen Gross <jgross@...e.com>, linux-kernel@...r.kernel.org,
x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
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.
Powered by blists - more mailing lists