Re: [RFC] x86/alternative: Support relocations in alternatives
From: Borislav Petkov
Date: Fri Feb 03 2023 - 18:26:01 EST
On Fri, Feb 03, 2023 at 05:46:47PM +0100, Borislav Petkov wrote:
> On Fri, Feb 03, 2023 at 05:04:35PM +0100, Borislav Petkov wrote:
> > Rest on IRC. :)
>
> Here's what I'm thinking. It still fails somewhere while booting so it
> is not good yet but the idea is to show what I mean:
Yeah, forget it. I need both next_rip at the place we're patching and
next_rip in the .altinstr_replacement section. And by the time I do
that, it won't get any prettier.
And I think yours solves that more elegantly but please document the
math transformation to compute the new offset.
Also, pls do this:
/*
* Do not recompute the offset if the target is within the
* patched insn block.
*/
if (target < repl || target > repl + repl_len)
to hint that you don't have to replace the offsets which are already
correct when a whole set of insns is being patched in.
FILL_RETURN_BUFFER was one example. :)
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette