linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFD] x86: The future of MPX
@ 2018-04-27 19:37 Thomas Gleixner
  2018-04-28  9:18 ` Ingo Molnar
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Gleixner @ 2018-04-27 19:37 UTC (permalink / raw)
  To: LKML; +Cc: Dave Hansen, Ingo Molnar, Peter Zijlstra, Borislav Petkov

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.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFD] x86: The future of MPX
  2018-04-27 19:37 [RFD] x86: The future of MPX Thomas Gleixner
@ 2018-04-28  9:18 ` Ingo Molnar
  2018-04-28 16:36   ` Linus Torvalds
  0 siblings, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2018-04-28  9:18 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Dave Hansen, Peter Zijlstra, Borislav Petkov, Linus Torvalds


* Thomas Gleixner <tglx@linutronix.de> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFD] x86: The future of MPX
  2018-04-28  9:18 ` Ingo Molnar
@ 2018-04-28 16:36   ` Linus Torvalds
  2018-04-28 16:44     ` Linus Torvalds
  2018-04-28 17:50     ` Ingo Molnar
  0 siblings, 2 replies; 9+ messages in thread
From: Linus Torvalds @ 2018-04-28 16:36 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Thomas Gleixner, Linux Kernel Mailing List, Dave Hansen,
	Peter Zijlstra, Borislav Petkov

On Sat, Apr 28, 2018 at 2:18 AM Ingo Molnar <mingo@kernel.org> 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.

> ... and both of them crashed.

That's just because they use "assert()" to check that the file open worked.

"assert()" is evil and bad bad bad.

                      Linus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFD] x86: The future of MPX
  2018-04-28 16:36   ` Linus Torvalds
@ 2018-04-28 16:44     ` Linus Torvalds
  2018-04-30  4:44       ` Dave Hansen
  2018-04-28 17:50     ` Ingo Molnar
  1 sibling, 1 reply; 9+ messages in thread
From: Linus Torvalds @ 2018-04-28 16:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Thomas Gleixner, Linux Kernel Mailing List, Dave Hansen,
	Peter Zijlstra, Borislav Petkov

On Sat, Apr 28, 2018 at 9:36 AM Linus Torvalds <
torvalds@linux-foundation.org> wrote:

> They need to be run as root.

Side note: don't get me wrong. If the MPX stuff isn't supported by gcc,
then there is little point in us supporting it in the kernel either.

So I'm just saying that the test-case is root-only and the crash doesn't
necessarily mean anything else than "badly written test".

                   Linus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFD] x86: The future of MPX
  2018-04-28 16:36   ` Linus Torvalds
  2018-04-28 16:44     ` Linus Torvalds
@ 2018-04-28 17:50     ` Ingo Molnar
  2018-04-29  4:46       ` Eric W. Biederman
  1 sibling, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2018-04-28 17:50 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Thomas Gleixner, Linux Kernel Mailing List, Dave Hansen,
	Peter Zijlstra, Borislav Petkov


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Sat, Apr 28, 2018 at 2:18 AM Ingo Molnar <mingo@kernel.org> 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 
CONFIG_FUNCTION_TRACING=y (not just CONFIG_TRACING=y), which I didn't
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.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFD] x86: The future of MPX
  2018-04-28 17:50     ` Ingo Molnar
@ 2018-04-29  4:46       ` Eric W. Biederman
  0 siblings, 0 replies; 9+ messages in thread
From: Eric W. Biederman @ 2018-04-29  4:46 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, Thomas Gleixner, Linux Kernel Mailing List,
	Dave Hansen, Peter Zijlstra, Borislav Petkov

Ingo Molnar <mingo@kernel.org> writes:

> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
>> On Sat, Apr 28, 2018 at 2:18 AM Ingo Molnar <mingo@kernel.org> 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 
> CONFIG_FUNCTION_TRACING=y (not just CONFIG_TRACING=y), which I didn't
> 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.

If you remove this which tree will this be going into?

I have some refactoring and cleanups of the x86 siginfo code I am
hoping to get in later this development cycle and part of that was
refactoring the mpx code so it works more like everything else.

If the codes away I can just that part of the patchset.

Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFD] x86: The future of MPX
  2018-04-28 16:44     ` Linus Torvalds
@ 2018-04-30  4:44       ` Dave Hansen
  2018-05-02 14:00         ` Borislav Petkov
  0 siblings, 1 reply; 9+ messages in thread
From: Dave Hansen @ 2018-04-30  4:44 UTC (permalink / raw)
  To: Linus Torvalds, Ingo Molnar
  Cc: Thomas Gleixner, Linux Kernel Mailing List, Peter Zijlstra,
	Borislav Petkov

On 04/28/2018 09:44 AM, Linus Torvalds wrote:
> On Sat, Apr 28, 2018 at 9:36 AM Linus Torvalds <
> torvalds@linux-foundation.org> wrote:
> 
>> They need to be run as root.
> Side note: don't get me wrong. If the MPX stuff isn't supported by gcc,
> then there is little point in us supporting it in the kernel either.

The loss of the GCC support is definitely a bummer.

There are no objections from me against removing it from future kernels.
 I think it will be pretty straightforward, just leaving the prctl()
numbers as placeholders.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFD] x86: The future of MPX
  2018-04-30  4:44       ` Dave Hansen
@ 2018-05-02 14:00         ` Borislav Petkov
  2018-05-03 16:23           ` Eric W. Biederman
  0 siblings, 1 reply; 9+ messages in thread
From: Borislav Petkov @ 2018-05-02 14:00 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Linus Torvalds, Ingo Molnar, Thomas Gleixner,
	Linux Kernel Mailing List, Peter Zijlstra

On Sun, Apr 29, 2018 at 09:44:00PM -0700, Dave Hansen wrote:
> The loss of the GCC support is definitely a bummer.

https://gcc.gnu.org/ml/gcc-patches/2018-05/msg00027.html

Will go into gcc9.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFD] x86: The future of MPX
  2018-05-02 14:00         ` Borislav Petkov
@ 2018-05-03 16:23           ` Eric W. Biederman
  0 siblings, 0 replies; 9+ messages in thread
From: Eric W. Biederman @ 2018-05-03 16:23 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Dave Hansen, Linus Torvalds, Ingo Molnar, Thomas Gleixner,
	Linux Kernel Mailing List, Peter Zijlstra

Borislav Petkov <bp@alien8.de> writes:

> On Sun, Apr 29, 2018 at 09:44:00PM -0700, Dave Hansen wrote:
>> The loss of the GCC support is definitely a bummer.
>
> https://gcc.gnu.org/ml/gcc-patches/2018-05/msg00027.html
>
> Will go into gcc9.

So we should see this in a released version of gcc in about a year?

Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-05-03 16:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27 19:37 [RFD] x86: The future of MPX Thomas Gleixner
2018-04-28  9:18 ` Ingo Molnar
2018-04-28 16:36   ` Linus Torvalds
2018-04-28 16:44     ` Linus Torvalds
2018-04-30  4:44       ` Dave Hansen
2018-05-02 14:00         ` Borislav Petkov
2018-05-03 16:23           ` Eric W. Biederman
2018-04-28 17:50     ` Ingo Molnar
2018-04-29  4:46       ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).