Re: [PATCH 08/24] x86,sme: Annotate indirect call

From: Peter Zijlstra
Date: Wed Jan 31 2018 - 11:00:52 EST


On Wed, Jan 31, 2018 at 09:04:51AM -0600, Josh Poimboeuf wrote:
> If there's no harm, it would be simpler and more robust to just do
> retpolines everywhere and not worry about special cases.
>
> (Forgetting paravirt for the moment, which is the eternal "special
> case".)
>
> I was also thinking about adding a debug option for _runtime_ retpoline
> verification that decodes all kernel text and reports any indirect
> branches it finds (yes, kind of like an in-kernel objtool). That would
> be a lot more straightforward without special cases. Obviously
> .init.text wouldn't be a problem there, but the other annotated safe
> locations would.

Like said, even retpolines themselves need annotation. We could simply
keep the section and not .discard. it.