Re: [PATCH v3 01/13] x86/retpoline: Add initial retpoline support
From: Linus Torvalds
Date: Fri Jan 05 2018 - 12:28:58 EST
On Fri, Jan 5, 2018 at 9:12 AM, Woodhouse, David <dwmw@xxxxxxxxxxxx> wrote:
>
> I typed 'jmp __x86.indirect_thunk' and it actually jumped to an address
> which I believe is (__x86.indirect_thunk + &altinstr - &oldinstr).
> Which made me sad, and took a while to debug.
Yes, I would suggest against expecting altinstructions to have
relocation information. They are generated in a different place, so..
That said, I honestly like the inline version (the one that is in the
google paper first) of the retpoline more than the out-of-line one.
And that one shouldn't have any relocagtion issues, because all the
offsets are relative.
We want to use that one for the entry stub anyway, can't we just
standardize on that one for all our assembly?
If the *compiler* uses the out-of-line version, that's a separate
thing. But for our asm cases, let's just make it all be the inline
case, ok?
It also should simplify the whole target generation. None of this
silly "__x86.indirect_thunk.\reg" crap with different targets for
different register choices.
Hmm?
Linus