Re: [RFD] x86: The future of MPX

From: Ingo Molnar
Date: Sat Apr 28 2018 - 05:18:39 EST



* Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:

> Dave,
>
> I've got the following MPX related information:
>
> .... But they [Intel] certainly haven't maintained the whole MPX support
> in GCC at all since two or three years (e.g. bootstrap with MPX was broken
> since forever), so now it's gone from GCC. ....
>
> and I know that GCC is discussing MPX removal since May last year at least.
> To the best of my knowledge clang does not support it either.
>
> So what's the state of this stuff? If we don't have a compiler supporting
> it how on earth is that useful or even testable for anyone who does not
> have access to some magic Intel internal compiler version?
>
> If that's the sad state of affairs, then we just should move the whole
> stuff into staging or simply queue it for removal in 4.18.

I just tried the MPX testcases with the latest kernel:

deimos:~/tip/tools/testing/selftests/x86> ./mpx-mini-test_64
XSAVE is supported by HW & OS
XSAVE processor supported state mask: 0x21f
XSAVE OS supported state mask: 0x21f
BNDREGS: size: 64 user: 1 supervisor: 0 aligned: 0
BNDCSR: size: 64 user: 1 supervisor: 0 aligned: 0
mpx-mini-test_64: mpx-mini-test.c:58: write_int_to: Assertion `fd >= 0' failed.
Aborted (core dumped)

deimos:~/tip/tools/testing/selftests/x86> ./mpx-mini-test_32
XSAVE is supported by HW & OS
XSAVE processor supported state mask: 0x21f
XSAVE OS supported state mask: 0x21f
BNDREGS: size: 64 user: 1 supervisor: 0 aligned: 0
BNDCSR: size: 64 user: 1 supervisor: 0 aligned: 0
mpx-mini-test_32: mpx-mini-test.c:58: write_int_to: Assertion `fd >= 0' failed.
Aborted (core dumped)

... and both of them crashed.

The CPU has MPX support and the kernel has CONFIG_X86_INTEL_MPX=y:

deimos:~> dmesg | grep -i mpx
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x008: 'MPX bounds registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x010: 'MPX CSR'

Thanks,

Ingo