Re: [PATCH v8 04/12] x86/spectre: Add boot time option to select Spectre v2 mitigation

From: Andi Kleen
Date: Tue Jan 23 2018 - 18:06:07 EST


> > And it probably should be a more reliable method which we probably could
> > use to detect !retpolined modules too.
>
> Andi actually implemented this, but it ended up being watered down
> somewhat.

It's enforced in mainline with the following patch

It's not fully bullet proof, but should be good enough to protect
against mistakes at least.

commit 6cfb521ac0d5b97470883ff9b7facae264b7ab12
Author: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Date: Tue Jan 16 12:52:28 2018 -0800

module: Add retpoline tag to VERMAGIC

Add a marker for retpoline to the module VERMAGIC. This catches the case
when a non RETPOLINE compiled module gets loaded into a retpoline kernel,
making it insecure.

It doesn't handle the case when retpoline has been runtime disabled. Even
in this case the match of the retcompile status will be enforced. This
implies that even with retpoline run time disabled all modules loaded need
to be recompiled.