From e10abb2f770eeb673d23c19980216b0fb62b4f50 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 25 Nov 2014 20:21:14 +0300 Subject: x86_64/traps: Fix always true condition We should be checking IS_ERR() here. PTR_ERR() is always true. Fixes: fe3d197f8431 ('x86, mpx: On-demand kernel allocation of bounds tables') Signed-off-by: Dan Carpenter Cc: Oleg Nesterov Cc: Masami Hiramatsu Cc: Andy Lutomirski Cc: Dave Hansen Link: http://lkml.kernel.org/r/20141125172114.GA24535@mwanda Signed-off-by: Ingo Molnar --- arch/x86/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 651d5d4..f73fc4a 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -323,7 +323,7 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) break; /* Success, it was handled */ case 1: /* Bound violation. */ info = mpx_generate_siginfo(regs, xsave_buf); - if (PTR_ERR(info)) { + if (IS_ERR(info)) { /* * We failed to decode the MPX instruction. Act as if * the exception was not caused by MPX. -- cgit v1.1 From 72e9b5fe9bee0826e7ce7599adbdc64e544780ef Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Fri, 12 Dec 2014 10:38:36 -0800 Subject: x86, mpx: Give MPX a real config option prompt Give MPX a real config option. The CPUs that support it (referenced here): https://software.intel.com/en-us/forums/topic/402393 are not available publicly yet. Right now only the software emulator provides MPX for the general public. [ tglx: Make it default off. There is no point in having it on right now as no hardware and no proper tooling support are available ] Signed-off-by: Dave Hansen Cc: Dave Hansen Link: http://lkml.kernel.org/r/20141212183836.2569D58D@viggo.jf.intel.com Signed-off-by: Thomas Gleixner --- arch/x86/Kconfig | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'arch') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 967dfe0..cc91e5e 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -248,10 +248,6 @@ config HAVE_INTEL_TXT def_bool y depends on INTEL_IOMMU && ACPI -config X86_INTEL_MPX - def_bool y - depends on CPU_SUP_INTEL - config X86_32_SMP def_bool y depends on X86_32 && SMP @@ -1575,6 +1571,32 @@ config X86_SMAP If unsure, say Y. +config X86_INTEL_MPX + prompt "Intel MPX (Memory Protection Extensions)" + def_bool n + depends on CPU_SUP_INTEL + ---help--- + MPX provides hardware features that can be used in + conjunction with compiler-instrumented code to check + memory references. It is designed to detect buffer + overflow or underflow bugs. + + This option enables running applications which are + instrumented or otherwise use MPX. It does not use MPX + itself inside the kernel or to protect the kernel + against bad memory references. + + Enabling this option will make the kernel larger: + ~8k of kernel text and 36 bytes of data on a 64-bit + defconfig. It adds a long to the 'mm_struct' which + will increase the kernel memory overhead of each + process and adds some branches to paths used during + exec() and munmap(). + + For details, see Documentation/x86/intel_mpx.txt + + If unsure, say N. + config EFI bool "EFI runtime service support" depends on ACPI -- cgit v1.1