Re: [PATCH] x86/alternatives: Fix optimize_nops() checking

From: Josh Poimboeuf
Date: Wed Jan 10 2018 - 16:16:52 EST


On Wed, Jan 10, 2018 at 01:11:48PM -0800, Linus Torvalds wrote:
> On Wed, Jan 10, 2018 at 1:08 PM, David Woodhouse <dwmw2@xxxxxxxxxxxxx> wrote:
> >
> > There are a few of the form 'call *somefunc'.
> >
> > The existing code handles them not by virtue of the relocs, as I said,
> > but by a simple delta of the old and new location of the instruction.
> >
> > But it only does so for the *first* instruction of the altinstr, if it
> > happens to be a (4-byte?) branch.
>
> Ugh. That's nasty.
>
> Wouldn't it be much better to simply do it as part of relocation instead?

Not possible, the relocations are applied during vmlinux linking.

--
Josh