Skip to content

Commit aa9ccb7

Browse files
hansendcdavehansenintel
authored andcommitted
x86/mpx: remove bounds exception code
From: Dave Hansen <dave.hansen@linux.intel.com> MPX is being removed from the kernel due to a lack of support in the toolchain going forward (gcc). Remove the other user-visible ABI: signal handling. This code should basically have been inactive after the prctl()s were removed, but there may be some small ABI remnants from this code. Remove it. Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: x86@kernel.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
1 parent 4ba68d0 commit aa9ccb7

1 file changed

Lines changed: 0 additions & 74 deletions

File tree

‎arch/x86/kernel/traps.c‎

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@
5757
#include <asm/mach_traps.h>
5858
#include <asm/alternative.h>
5959
#include <asm/fpu/xstate.h>
60-
#include <asm/trace/mpx.h>
61-
#include <asm/mpx.h>
6260
#include <asm/vm86.h>
6361
#include <asm/umip.h>
6462

@@ -430,8 +428,6 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code, unsign
430428

431429
dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
432430
{
433-
const struct mpx_bndcsr *bndcsr;
434-
435431
RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
436432
if (notify_die(DIE_TRAP, "bounds", regs, error_code,
437433
X86_TRAP_BR, SIGSEGV) == NOTIFY_STOP)
@@ -441,76 +437,6 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
441437
if (!user_mode(regs))
442438
die("bounds", regs, error_code);
443439

444-
if (!cpu_feature_enabled(X86_FEATURE_MPX)) {
445-
/* The exception is not from Intel MPX */
446-
goto exit_trap;
447-
}
448-
449-
/*
450-
* We need to look at BNDSTATUS to resolve this exception.
451-
* A NULL here might mean that it is in its 'init state',
452-
* which is all zeros which indicates MPX was not
453-
* responsible for the exception.
454-
*/
455-
bndcsr = get_xsave_field_ptr(XFEATURE_BNDCSR);
456-
if (!bndcsr)
457-
goto exit_trap;
458-
459-
trace_bounds_exception_mpx(bndcsr);
460-
/*
461-
* The error code field of the BNDSTATUS register communicates status
462-
* information of a bound range exception #BR or operation involving
463-
* bound directory.
464-
*/
465-
switch (bndcsr->bndstatus & MPX_BNDSTA_ERROR_CODE) {
466-
case 2: /* Bound directory has invalid entry. */
467-
if (mpx_handle_bd_fault())
468-
goto exit_trap;
469-
break; /* Success, it was handled */
470-
case 1: /* Bound violation. */
471-
{
472-
struct task_struct *tsk = current;
473-
struct mpx_fault_info mpx;
474-
475-
if (mpx_fault_info(&mpx, regs)) {
476-
/*
477-
* We failed to decode the MPX instruction. Act as if
478-
* the exception was not caused by MPX.
479-
*/
480-
goto exit_trap;
481-
}
482-
/*
483-
* Success, we decoded the instruction and retrieved
484-
* an 'mpx' containing the address being accessed
485-
* which caused the exception. This information
486-
* allows and application to possibly handle the
487-
* #BR exception itself.
488-
*/
489-
if (!do_trap_no_signal(tsk, X86_TRAP_BR, "bounds", regs,
490-
error_code))
491-
break;
492-
493-
show_signal(tsk, SIGSEGV, "trap ", "bounds", regs, error_code);
494-
495-
force_sig_bnderr(mpx.addr, mpx.lower, mpx.upper);
496-
break;
497-
}
498-
case 0: /* No exception caused by Intel MPX operations. */
499-
goto exit_trap;
500-
default:
501-
die("bounds", regs, error_code);
502-
}
503-
504-
return;
505-
506-
exit_trap:
507-
/*
508-
* This path out is for all the cases where we could not
509-
* handle the exception in some way (like allocating a
510-
* table or telling userspace about it. We will also end
511-
* up here if the kernel has MPX turned off at compile
512-
* time..
513-
*/
514440
do_trap(X86_TRAP_BR, SIGSEGV, "bounds", regs, error_code, 0, NULL);
515441
}
516442

0 commit comments

Comments
 (0)