Re: [PATCH v3 0/4] Intel MPX support

2014-01-28 Thread H. Peter Anvin
On 01/27/2014 11:01 PM, Ren Qiaowei wrote:
> 
> Yes. Though all non-MPX threads are slowed down, the whole process
> benefit from MPX.
> 
> Anyway, HPA suggest these syscalls, which use MMU notifier, should be
> not needed, we can do what they do in userspace runtime. What do you
> think about it? I guess that I should remove the third patch which adds
> new prctl() syscalls in next version of this patchset.
> 

The syscalls is one thing, managing the bounds map in kernel space is
another.

We could manage the bounds map entirely in user space in a signal
handler, but that has both ABI issues (#BR currently turns into SIGSEGV
which is commonly hooked by applications; we could switch to a different
signal but there aren't many unclaimed ones) and performance issues.

I would think it would be extremely unusual for an application to have
some MPX and some non-MPX threads, since they would share the same
address space and the non-MPX threads would mess up the bounds.

-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-28 Thread H. Peter Anvin
On 01/27/2014 11:01 PM, Ren Qiaowei wrote:
 
 Yes. Though all non-MPX threads are slowed down, the whole process
 benefit from MPX.
 
 Anyway, HPA suggest these syscalls, which use MMU notifier, should be
 not needed, we can do what they do in userspace runtime. What do you
 think about it? I guess that I should remove the third patch which adds
 new prctl() syscalls in next version of this patchset.
 

The syscalls is one thing, managing the bounds map in kernel space is
another.

We could manage the bounds map entirely in user space in a signal
handler, but that has both ABI issues (#BR currently turns into SIGSEGV
which is commonly hooked by applications; we could switch to a different
signal but there aren't many unclaimed ones) and performance issues.

I would think it would be extremely unusual for an application to have
some MPX and some non-MPX threads, since they would share the same
address space and the non-MPX threads would mess up the bounds.

-hpa


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-27 Thread Ren Qiaowei

On 01/28/2014 02:42 PM, Ingo Molnar wrote:


* Ren Qiaowei  wrote:


MPX kernel code, namely this patchset, has mainly the 2
responsibilities: provide handlers for bounds faults (#BR), and
manage bounds memory.


AFAICS the kernel side implementation causes no runtime overhead
for non-MPX workloads, and also causes no runtime overhead for
non-MPX hardware, right?


Yes.


Actually, I think that's not entirely true.

For example if within the same mm there's a lot of non-MPX threads and
an MPX thread, then the MMU notifier will be called for MMU operations
of every non-MPX thread as well!

So MPX state of a thread will slow down all the other non-MPX threads
as well.

The statement is only true for non-MPX tasks that have their separate
mm's that does not have a single MPX thread.



Yes. Though all non-MPX threads are slowed down, the whole process 
benefit from MPX.


Anyway, HPA suggest these syscalls, which use MMU notifier, should be 
not needed, we can do what they do in userspace runtime. What do you 
think about it? I guess that I should remove the third patch which adds 
new prctl() syscalls in next version of this patchset.


Thanks,
Qiaowei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-27 Thread Ingo Molnar

* Ren Qiaowei  wrote:

> >> MPX kernel code, namely this patchset, has mainly the 2 
> >> responsibilities: provide handlers for bounds faults (#BR), and 
> >> manage bounds memory.
> >
> > AFAICS the kernel side implementation causes no runtime overhead 
> > for non-MPX workloads, and also causes no runtime overhead for 
> > non-MPX hardware, right?
>
> Yes.

Actually, I think that's not entirely true.

For example if within the same mm there's a lot of non-MPX threads and 
an MPX thread, then the MMU notifier will be called for MMU operations 
of every non-MPX thread as well!

So MPX state of a thread will slow down all the other non-MPX threads 
as well.

The statement is only true for non-MPX tasks that have their separate 
mm's that does not have a single MPX thread.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-27 Thread Ingo Molnar

* Ren Qiaowei qiaowei@intel.com wrote:

  MPX kernel code, namely this patchset, has mainly the 2 
  responsibilities: provide handlers for bounds faults (#BR), and 
  manage bounds memory.
 
  AFAICS the kernel side implementation causes no runtime overhead 
  for non-MPX workloads, and also causes no runtime overhead for 
  non-MPX hardware, right?

 Yes.

Actually, I think that's not entirely true.

For example if within the same mm there's a lot of non-MPX threads and 
an MPX thread, then the MMU notifier will be called for MMU operations 
of every non-MPX thread as well!

So MPX state of a thread will slow down all the other non-MPX threads 
as well.

The statement is only true for non-MPX tasks that have their separate 
mm's that does not have a single MPX thread.

Thanks,

Ingo
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-27 Thread Ren Qiaowei

On 01/28/2014 02:42 PM, Ingo Molnar wrote:


* Ren Qiaowei qiaowei@intel.com wrote:


MPX kernel code, namely this patchset, has mainly the 2
responsibilities: provide handlers for bounds faults (#BR), and
manage bounds memory.


AFAICS the kernel side implementation causes no runtime overhead
for non-MPX workloads, and also causes no runtime overhead for
non-MPX hardware, right?


Yes.


Actually, I think that's not entirely true.

For example if within the same mm there's a lot of non-MPX threads and
an MPX thread, then the MMU notifier will be called for MMU operations
of every non-MPX thread as well!

So MPX state of a thread will slow down all the other non-MPX threads
as well.

The statement is only true for non-MPX tasks that have their separate
mm's that does not have a single MPX thread.



Yes. Though all non-MPX threads are slowed down, the whole process 
benefit from MPX.


Anyway, HPA suggest these syscalls, which use MMU notifier, should be 
not needed, we can do what they do in userspace runtime. What do you 
think about it? I guess that I should remove the third patch which adds 
new prctl() syscalls in next version of this patchset.


Thanks,
Qiaowei
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-26 Thread Ren Qiaowei

On 01/26/2014 04:19 PM, Ingo Molnar wrote:


* Qiaowei Ren  wrote:


This patchset adds support for the Memory Protection Extensions
(MPX) feature found in future Intel processors.

MPX can be used in conjunction with compiler changes to check memory
references, for those references whose compile-time normal intentions
are usurped at runtime due to buffer overflow or underflow.

MPX provides this capability at very low performance overhead for
newly compiled code, and provides compatibility mechanisms with legacy
software components. MPX architecture is designed allow a machine to
run both MPX enabled software and legacy software that is MPX unaware.
In such a case, the legacy software does not benefit from MPX, but it
also does not experience any change in functionality or reduction in
performance.

More information about Intel MPX can be found in "Intel(R) Architecture
Instruction Set Extensions Programming Reference".

To get the advantage of MPX, changes are required in the OS kernel,
binutils, compiler, system libraries support.

New GCC option -fmpx is introduced to utilize MPX instructions.
Currently GCC compiler sources with MPX support is available in a
separate branch in common GCC SVN repository. See GCC SVN page
(http://gcc.gnu.org/svn.html) for details.

To have the full protection, we had to add MPX instrumentation to all
the necessary Glibc routines (e.g. memcpy) written on assembler, and
compile Glibc with the MPX enabled GCC compiler. Currently MPX enabled
Glibc source can be found in Glibc git repository.

Enabling an application to use MPX will generally not require source
code updates but there is some runtime code, which is responsible for
configuring and enabling MPX, needed in order to make use of MPX.
For most applications this runtime support will be available by linking
to a library supplied by the compiler or possibly it will come directly
from the OS once OS versions that support MPX are available.

MPX kernel code, namely this patchset, has mainly the 2 responsibilities:
provide handlers for bounds faults (#BR), and manage bounds memory.


AFAICS the kernel side implementation causes no runtime overhead for
non-MPX workloads, and also causes no runtime overhead for non-MPX
hardware, right?


Yes.


Currently no hardware with MPX ISA is available but it is always
possible to use SDE (Intel(R) software Development Emulator) instead,
which can be downloaded from
http://software.intel.com/en-us/articles/intel-software-development-emulator


Changes since v1:
   * check to see if #BR occurred in userspace or kernel space.
   * use generic structure and macro as much as possible when
 decode mpx instructions.

Changes since v2:
   * fix some compile warnings.
   * update documentation.

Qiaowei Ren (4):
   x86, mpx: add documentation on Intel MPX
   x86, mpx: hook #BR exception handler to allocate bound tables
   x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE
   x86, mpx: extend siginfo structure to include bound violation
 information

  Documentation/x86/intel_mpx.txt|  226 
  arch/x86/Kconfig   |4 +
  arch/x86/include/asm/mpx.h |   63 ++
  arch/x86/include/asm/processor.h   |   16 ++
  arch/x86/kernel/Makefile   |1 +
  arch/x86/kernel/mpx.c  |  415 
  arch/x86/kernel/traps.c|   61 +-
  include/uapi/asm-generic/siginfo.h |9 +-
  include/uapi/linux/prctl.h |6 +
  kernel/signal.c|4 +
  kernel/sys.c   |   12 +
  11 files changed, 815 insertions(+), 2 deletions(-)
  create mode 100644 Documentation/x86/intel_mpx.txt
  create mode 100644 arch/x86/include/asm/mpx.h
  create mode 100644 arch/x86/kernel/mpx.c


Ok, this summary was pretty good - it addresses my prior objections
wrt. submission quality. Once the details are fleshed out this sure
looks like a useful feature.


Thanks. I apologize for previous submission.

Thanks,
Qiaowei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-26 Thread Ingo Molnar

* Qiaowei Ren  wrote:

> This patchset adds support for the Memory Protection Extensions
> (MPX) feature found in future Intel processors.
> 
> MPX can be used in conjunction with compiler changes to check memory
> references, for those references whose compile-time normal intentions
> are usurped at runtime due to buffer overflow or underflow.
> 
> MPX provides this capability at very low performance overhead for
> newly compiled code, and provides compatibility mechanisms with legacy
> software components. MPX architecture is designed allow a machine to
> run both MPX enabled software and legacy software that is MPX unaware.
> In such a case, the legacy software does not benefit from MPX, but it
> also does not experience any change in functionality or reduction in
> performance.
> 
> More information about Intel MPX can be found in "Intel(R) Architecture
> Instruction Set Extensions Programming Reference".
> 
> To get the advantage of MPX, changes are required in the OS kernel,
> binutils, compiler, system libraries support.
> 
> New GCC option -fmpx is introduced to utilize MPX instructions.
> Currently GCC compiler sources with MPX support is available in a
> separate branch in common GCC SVN repository. See GCC SVN page
> (http://gcc.gnu.org/svn.html) for details.
> 
> To have the full protection, we had to add MPX instrumentation to all
> the necessary Glibc routines (e.g. memcpy) written on assembler, and
> compile Glibc with the MPX enabled GCC compiler. Currently MPX enabled
> Glibc source can be found in Glibc git repository.
> 
> Enabling an application to use MPX will generally not require source
> code updates but there is some runtime code, which is responsible for
> configuring and enabling MPX, needed in order to make use of MPX.
> For most applications this runtime support will be available by linking
> to a library supplied by the compiler or possibly it will come directly
> from the OS once OS versions that support MPX are available.
> 
> MPX kernel code, namely this patchset, has mainly the 2 responsibilities:
> provide handlers for bounds faults (#BR), and manage bounds memory.

AFAICS the kernel side implementation causes no runtime overhead for 
non-MPX workloads, and also causes no runtime overhead for non-MPX 
hardware, right?

> Currently no hardware with MPX ISA is available but it is always
> possible to use SDE (Intel(R) software Development Emulator) instead,
> which can be downloaded from
> http://software.intel.com/en-us/articles/intel-software-development-emulator
> 
> 
> Changes since v1:
>   * check to see if #BR occurred in userspace or kernel space.
>   * use generic structure and macro as much as possible when
> decode mpx instructions.
> 
> Changes since v2:
>   * fix some compile warnings.
>   * update documentation.
> 
> Qiaowei Ren (4):
>   x86, mpx: add documentation on Intel MPX
>   x86, mpx: hook #BR exception handler to allocate bound tables
>   x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE
>   x86, mpx: extend siginfo structure to include bound violation
> information
> 
>  Documentation/x86/intel_mpx.txt|  226 
>  arch/x86/Kconfig   |4 +
>  arch/x86/include/asm/mpx.h |   63 ++
>  arch/x86/include/asm/processor.h   |   16 ++
>  arch/x86/kernel/Makefile   |1 +
>  arch/x86/kernel/mpx.c  |  415 
> 
>  arch/x86/kernel/traps.c|   61 +-
>  include/uapi/asm-generic/siginfo.h |9 +-
>  include/uapi/linux/prctl.h |6 +
>  kernel/signal.c|4 +
>  kernel/sys.c   |   12 +
>  11 files changed, 815 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/x86/intel_mpx.txt
>  create mode 100644 arch/x86/include/asm/mpx.h
>  create mode 100644 arch/x86/kernel/mpx.c

Ok, this summary was pretty good - it addresses my prior objections 
wrt. submission quality. Once the details are fleshed out this sure 
looks like a useful feature.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-26 Thread Ingo Molnar

* Qiaowei Ren qiaowei@intel.com wrote:

 This patchset adds support for the Memory Protection Extensions
 (MPX) feature found in future Intel processors.
 
 MPX can be used in conjunction with compiler changes to check memory
 references, for those references whose compile-time normal intentions
 are usurped at runtime due to buffer overflow or underflow.
 
 MPX provides this capability at very low performance overhead for
 newly compiled code, and provides compatibility mechanisms with legacy
 software components. MPX architecture is designed allow a machine to
 run both MPX enabled software and legacy software that is MPX unaware.
 In such a case, the legacy software does not benefit from MPX, but it
 also does not experience any change in functionality or reduction in
 performance.
 
 More information about Intel MPX can be found in Intel(R) Architecture
 Instruction Set Extensions Programming Reference.
 
 To get the advantage of MPX, changes are required in the OS kernel,
 binutils, compiler, system libraries support.
 
 New GCC option -fmpx is introduced to utilize MPX instructions.
 Currently GCC compiler sources with MPX support is available in a
 separate branch in common GCC SVN repository. See GCC SVN page
 (http://gcc.gnu.org/svn.html) for details.
 
 To have the full protection, we had to add MPX instrumentation to all
 the necessary Glibc routines (e.g. memcpy) written on assembler, and
 compile Glibc with the MPX enabled GCC compiler. Currently MPX enabled
 Glibc source can be found in Glibc git repository.
 
 Enabling an application to use MPX will generally not require source
 code updates but there is some runtime code, which is responsible for
 configuring and enabling MPX, needed in order to make use of MPX.
 For most applications this runtime support will be available by linking
 to a library supplied by the compiler or possibly it will come directly
 from the OS once OS versions that support MPX are available.
 
 MPX kernel code, namely this patchset, has mainly the 2 responsibilities:
 provide handlers for bounds faults (#BR), and manage bounds memory.

AFAICS the kernel side implementation causes no runtime overhead for 
non-MPX workloads, and also causes no runtime overhead for non-MPX 
hardware, right?

 Currently no hardware with MPX ISA is available but it is always
 possible to use SDE (Intel(R) software Development Emulator) instead,
 which can be downloaded from
 http://software.intel.com/en-us/articles/intel-software-development-emulator
 
 
 Changes since v1:
   * check to see if #BR occurred in userspace or kernel space.
   * use generic structure and macro as much as possible when
 decode mpx instructions.
 
 Changes since v2:
   * fix some compile warnings.
   * update documentation.
 
 Qiaowei Ren (4):
   x86, mpx: add documentation on Intel MPX
   x86, mpx: hook #BR exception handler to allocate bound tables
   x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE
   x86, mpx: extend siginfo structure to include bound violation
 information
 
  Documentation/x86/intel_mpx.txt|  226 
  arch/x86/Kconfig   |4 +
  arch/x86/include/asm/mpx.h |   63 ++
  arch/x86/include/asm/processor.h   |   16 ++
  arch/x86/kernel/Makefile   |1 +
  arch/x86/kernel/mpx.c  |  415 
 
  arch/x86/kernel/traps.c|   61 +-
  include/uapi/asm-generic/siginfo.h |9 +-
  include/uapi/linux/prctl.h |6 +
  kernel/signal.c|4 +
  kernel/sys.c   |   12 +
  11 files changed, 815 insertions(+), 2 deletions(-)
  create mode 100644 Documentation/x86/intel_mpx.txt
  create mode 100644 arch/x86/include/asm/mpx.h
  create mode 100644 arch/x86/kernel/mpx.c

Ok, this summary was pretty good - it addresses my prior objections 
wrt. submission quality. Once the details are fleshed out this sure 
looks like a useful feature.

Thanks,

Ingo
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/4] Intel MPX support

2014-01-26 Thread Ren Qiaowei

On 01/26/2014 04:19 PM, Ingo Molnar wrote:


* Qiaowei Ren qiaowei@intel.com wrote:


This patchset adds support for the Memory Protection Extensions
(MPX) feature found in future Intel processors.

MPX can be used in conjunction with compiler changes to check memory
references, for those references whose compile-time normal intentions
are usurped at runtime due to buffer overflow or underflow.

MPX provides this capability at very low performance overhead for
newly compiled code, and provides compatibility mechanisms with legacy
software components. MPX architecture is designed allow a machine to
run both MPX enabled software and legacy software that is MPX unaware.
In such a case, the legacy software does not benefit from MPX, but it
also does not experience any change in functionality or reduction in
performance.

More information about Intel MPX can be found in Intel(R) Architecture
Instruction Set Extensions Programming Reference.

To get the advantage of MPX, changes are required in the OS kernel,
binutils, compiler, system libraries support.

New GCC option -fmpx is introduced to utilize MPX instructions.
Currently GCC compiler sources with MPX support is available in a
separate branch in common GCC SVN repository. See GCC SVN page
(http://gcc.gnu.org/svn.html) for details.

To have the full protection, we had to add MPX instrumentation to all
the necessary Glibc routines (e.g. memcpy) written on assembler, and
compile Glibc with the MPX enabled GCC compiler. Currently MPX enabled
Glibc source can be found in Glibc git repository.

Enabling an application to use MPX will generally not require source
code updates but there is some runtime code, which is responsible for
configuring and enabling MPX, needed in order to make use of MPX.
For most applications this runtime support will be available by linking
to a library supplied by the compiler or possibly it will come directly
from the OS once OS versions that support MPX are available.

MPX kernel code, namely this patchset, has mainly the 2 responsibilities:
provide handlers for bounds faults (#BR), and manage bounds memory.


AFAICS the kernel side implementation causes no runtime overhead for
non-MPX workloads, and also causes no runtime overhead for non-MPX
hardware, right?


Yes.


Currently no hardware with MPX ISA is available but it is always
possible to use SDE (Intel(R) software Development Emulator) instead,
which can be downloaded from
http://software.intel.com/en-us/articles/intel-software-development-emulator


Changes since v1:
   * check to see if #BR occurred in userspace or kernel space.
   * use generic structure and macro as much as possible when
 decode mpx instructions.

Changes since v2:
   * fix some compile warnings.
   * update documentation.

Qiaowei Ren (4):
   x86, mpx: add documentation on Intel MPX
   x86, mpx: hook #BR exception handler to allocate bound tables
   x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE
   x86, mpx: extend siginfo structure to include bound violation
 information

  Documentation/x86/intel_mpx.txt|  226 
  arch/x86/Kconfig   |4 +
  arch/x86/include/asm/mpx.h |   63 ++
  arch/x86/include/asm/processor.h   |   16 ++
  arch/x86/kernel/Makefile   |1 +
  arch/x86/kernel/mpx.c  |  415 
  arch/x86/kernel/traps.c|   61 +-
  include/uapi/asm-generic/siginfo.h |9 +-
  include/uapi/linux/prctl.h |6 +
  kernel/signal.c|4 +
  kernel/sys.c   |   12 +
  11 files changed, 815 insertions(+), 2 deletions(-)
  create mode 100644 Documentation/x86/intel_mpx.txt
  create mode 100644 arch/x86/include/asm/mpx.h
  create mode 100644 arch/x86/kernel/mpx.c


Ok, this summary was pretty good - it addresses my prior objections
wrt. submission quality. Once the details are fleshed out this sure
looks like a useful feature.


Thanks. I apologize for previous submission.

Thanks,
Qiaowei
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 0/4] Intel MPX support

2014-01-25 Thread Qiaowei Ren
This patchset adds support for the Memory Protection Extensions
(MPX) feature found in future Intel processors.

MPX can be used in conjunction with compiler changes to check memory
references, for those references whose compile-time normal intentions
are usurped at runtime due to buffer overflow or underflow.

MPX provides this capability at very low performance overhead for
newly compiled code, and provides compatibility mechanisms with legacy
software components. MPX architecture is designed allow a machine to
run both MPX enabled software and legacy software that is MPX unaware.
In such a case, the legacy software does not benefit from MPX, but it
also does not experience any change in functionality or reduction in
performance.

More information about Intel MPX can be found in "Intel(R) Architecture
Instruction Set Extensions Programming Reference".

To get the advantage of MPX, changes are required in the OS kernel,
binutils, compiler, system libraries support.

New GCC option -fmpx is introduced to utilize MPX instructions.
Currently GCC compiler sources with MPX support is available in a
separate branch in common GCC SVN repository. See GCC SVN page
(http://gcc.gnu.org/svn.html) for details.

To have the full protection, we had to add MPX instrumentation to all
the necessary Glibc routines (e.g. memcpy) written on assembler, and
compile Glibc with the MPX enabled GCC compiler. Currently MPX enabled
Glibc source can be found in Glibc git repository.

Enabling an application to use MPX will generally not require source
code updates but there is some runtime code, which is responsible for
configuring and enabling MPX, needed in order to make use of MPX.
For most applications this runtime support will be available by linking
to a library supplied by the compiler or possibly it will come directly
from the OS once OS versions that support MPX are available.

MPX kernel code, namely this patchset, has mainly the 2 responsibilities:
provide handlers for bounds faults (#BR), and manage bounds memory.

Currently no hardware with MPX ISA is available but it is always
possible to use SDE (Intel(R) software Development Emulator) instead,
which can be downloaded from
http://software.intel.com/en-us/articles/intel-software-development-emulator


Changes since v1:
  * check to see if #BR occurred in userspace or kernel space.
  * use generic structure and macro as much as possible when
decode mpx instructions.

Changes since v2:
  * fix some compile warnings.
  * update documentation.

Qiaowei Ren (4):
  x86, mpx: add documentation on Intel MPX
  x86, mpx: hook #BR exception handler to allocate bound tables
  x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE
  x86, mpx: extend siginfo structure to include bound violation
information

 Documentation/x86/intel_mpx.txt|  226 
 arch/x86/Kconfig   |4 +
 arch/x86/include/asm/mpx.h |   63 ++
 arch/x86/include/asm/processor.h   |   16 ++
 arch/x86/kernel/Makefile   |1 +
 arch/x86/kernel/mpx.c  |  415 
 arch/x86/kernel/traps.c|   61 +-
 include/uapi/asm-generic/siginfo.h |9 +-
 include/uapi/linux/prctl.h |6 +
 kernel/signal.c|4 +
 kernel/sys.c   |   12 +
 11 files changed, 815 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/x86/intel_mpx.txt
 create mode 100644 arch/x86/include/asm/mpx.h
 create mode 100644 arch/x86/kernel/mpx.c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 0/4] Intel MPX support

2014-01-25 Thread Qiaowei Ren
This patchset adds support for the Memory Protection Extensions
(MPX) feature found in future Intel processors.

MPX can be used in conjunction with compiler changes to check memory
references, for those references whose compile-time normal intentions
are usurped at runtime due to buffer overflow or underflow.

MPX provides this capability at very low performance overhead for
newly compiled code, and provides compatibility mechanisms with legacy
software components. MPX architecture is designed allow a machine to
run both MPX enabled software and legacy software that is MPX unaware.
In such a case, the legacy software does not benefit from MPX, but it
also does not experience any change in functionality or reduction in
performance.

More information about Intel MPX can be found in Intel(R) Architecture
Instruction Set Extensions Programming Reference.

To get the advantage of MPX, changes are required in the OS kernel,
binutils, compiler, system libraries support.

New GCC option -fmpx is introduced to utilize MPX instructions.
Currently GCC compiler sources with MPX support is available in a
separate branch in common GCC SVN repository. See GCC SVN page
(http://gcc.gnu.org/svn.html) for details.

To have the full protection, we had to add MPX instrumentation to all
the necessary Glibc routines (e.g. memcpy) written on assembler, and
compile Glibc with the MPX enabled GCC compiler. Currently MPX enabled
Glibc source can be found in Glibc git repository.

Enabling an application to use MPX will generally not require source
code updates but there is some runtime code, which is responsible for
configuring and enabling MPX, needed in order to make use of MPX.
For most applications this runtime support will be available by linking
to a library supplied by the compiler or possibly it will come directly
from the OS once OS versions that support MPX are available.

MPX kernel code, namely this patchset, has mainly the 2 responsibilities:
provide handlers for bounds faults (#BR), and manage bounds memory.

Currently no hardware with MPX ISA is available but it is always
possible to use SDE (Intel(R) software Development Emulator) instead,
which can be downloaded from
http://software.intel.com/en-us/articles/intel-software-development-emulator


Changes since v1:
  * check to see if #BR occurred in userspace or kernel space.
  * use generic structure and macro as much as possible when
decode mpx instructions.

Changes since v2:
  * fix some compile warnings.
  * update documentation.

Qiaowei Ren (4):
  x86, mpx: add documentation on Intel MPX
  x86, mpx: hook #BR exception handler to allocate bound tables
  x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE
  x86, mpx: extend siginfo structure to include bound violation
information

 Documentation/x86/intel_mpx.txt|  226 
 arch/x86/Kconfig   |4 +
 arch/x86/include/asm/mpx.h |   63 ++
 arch/x86/include/asm/processor.h   |   16 ++
 arch/x86/kernel/Makefile   |1 +
 arch/x86/kernel/mpx.c  |  415 
 arch/x86/kernel/traps.c|   61 +-
 include/uapi/asm-generic/siginfo.h |9 +-
 include/uapi/linux/prctl.h |6 +
 kernel/signal.c|4 +
 kernel/sys.c   |   12 +
 11 files changed, 815 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/x86/intel_mpx.txt
 create mode 100644 arch/x86/include/asm/mpx.h
 create mode 100644 arch/x86/kernel/mpx.c

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/