Re: [RFD] x86: The future of MPX

From: Ingo Molnar
Date: Sat Apr 28 2018 - 13:50:56 EST

* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Sat, Apr 28, 2018 at 2:18 AM Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> > I just tried the MPX testcases with the latest kernel:
> > deimos:~/tip/tools/testing/selftests/x86> ./mpx-mini-test_64
> They need to be run as root. They try to access
> /sys/kernel/debug/tracing/set_ftrace_pid
> /sys/kernel/debug/tracing/trace
> and that's root-only.

Indeed - but note that they are crashing as root as well here:

root@deimos:/home/mingo/tip/tools/testing/selftests/x86# ./mpx-mini-test_64
Aborted (core dumped)

... because I don't even have /sys/kernel/debug/tracing/set_ftrace_pid... :-/

That's despite having ftrace enabled.

After some digging I found out that 'set_ftrace_pid' is dependent on
have enabled on this kernel.

After enabling it I got the 64-bit testcase to work:

./mpx-mini-test_64 completed successfully

But the 32-bit testcase is erroring out:

root@deimos:/home/mingo/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
executing unmaptest
mpx dig ( 1) complete, SUCCESS ( 0 / 0)
#BR status == 2, missing bounds table,kernel should have handled!!

v4.17-rc2 based kernel, so it should have the latest MPX code.