On Fri, Jun 19, 2020 at 10:41 AM Borislav Petkov <[email protected]> wrote:
>
> From: Petteri Aimonen <[email protected]>
>
> Add a selftest for the usage of FPU code in kernel mode.
>
> Currently only implemented for x86. In the future, kernel FPU testing
> could be unified between the different architectures supporting it.

Acked-by: Andy Lutomirski <[email protected]>

except:

> +#
> +# CFLAGS for compiling floating point code inside the kernel. x86/Makefile 
> turns
> +# off the generation of FPU/SSE* instructions for kernel proper but FPU_FLAGS
> +# get appended last to CFLAGS and thus override those previous compiler 
> options.
> +#
> +FPU_CFLAGS += -mhard-float -msse
> +ifdef CONFIG_CC_IS_GCC
> +  ifeq ($(call cc-ifversion, -lt, 0701, y), y)
> +    # Stack alignment mismatch, proceed with caution.
> +    # GCC < 7.1 cannot compile code using `double` and 
> -mpreferred-stack-boundary=3
> +    # (8B stack alignment).
> +    FPU_CFLAGS += -mpreferred-stack-boundary=4
> +  else
> +    FPU_CFLAGS += -msse2
> +  endif
> +endif

This should be cc-option, not cc-ifversion, I think.  But maybe we
should consider dropping the problematic GCC version instead?  The old
GCC versions with stack alignment problems are seriously problematic
for x86 kernels, and I don't really trust kernels built with them.

Reply via email to