RE: [PATCH] retpoline/module: Taint kernel for missing retpoline in module

From: David Laight
Date: Mon Jan 15 2018 - 07:47:31 EST


From: Andi Kleen
> Sent: 12 January 2018 17:55
>
> There's a risk that a kernel that has full retpoline mitigations
> becomes vulnerable when a module gets loaded that hasn't been
> compiled with the right compiler or the right option.
>
> We cannot fix it, but should at least warn the user when that
> happens.
>
> Add a flag to each module if it has been compiled with RETPOLINE
>
> When the a module hasn't been compiled with a retpoline
> aware compiler, print a warning and set a taint flag.
>
> For modules it is checked at compile time, however it cannot
> check assembler or other non compiled objects used in the module link.

It is not unlikely that most of a module's code is released as a
binary 'blob', with only the part that needs to match the kernel ABI
compiled on the target system.
(This allows a single binary driver be loaded onto different Linux
kernel versions.)
Such code is unlikely to be compiled with the latest compiler.
Indeed, doing so may stop the module loading on old kernels.

David