Re: [PATCH 4/7] x86,nospec: Annotate indirect calls/jumps

From: Peter Zijlstra
Date: Thu Feb 01 2018 - 10:30:24 EST


On Thu, Feb 01, 2018 at 09:21:34AM -0600, Josh Poimboeuf wrote:
> On Thu, Feb 01, 2018 at 04:13:48PM +0100, Peter Zijlstra wrote:

> > arch/x86/entry/.tmp_entry_64.o: warning: objtool: .altinstr_replacement+0x19: indirect jump found in RETPOLINE build
>
> Right, objtool was recently made smarter, such that it actually decodes
> the ignored alternatives.

I think it always did, you just ignored the alternatives for the code
flow stuff.

> The check for that warning needs to also check that insn->ignore isn't
> set.

So I tried to keep the two annotations independent, thinking the code
flow ignore would eventually go away when we got smarter about it. It
even has a comment about that:

/*
* FIXME: For now, just ignore any alternatives which add retpolines. This is
* a temporary hack, as it doesn't allow ORC to unwind from inside a retpoline.
* But it at least allows objtool to understand the control flow *around* the
* retpoline.
*/

So I'm not seeing how making retpoline_safe depend on nospec_ignores is
a good thing.