aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/traps.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2017-08-19 12:14:49 -0500
committerEric W. Biederman <ebiederm@xmission.com>2018-09-21 14:46:27 +0200
commit851ce9e697b8a432ad1847a0c2d464b412353829 (patch)
treea4b1578caa81973037b4e3efd567b1dfa5e7c27c /arch/x86/kernel/traps.c
parentsignal/x86/traps: Move more code into do_trap_no_signal so it can be reused (diff)
downloadlinux-dev-851ce9e697b8a432ad1847a0c2d464b412353829.tar.xz
linux-dev-851ce9e697b8a432ad1847a0c2d464b412353829.zip
signal/x86/traps: Use force_sig_bnderr
Instead of generating the siginfo in x86 specific code use the new helper function force_sig_bnderr to separate the concerns of collecting the information and generating a proper siginfo. Making the code easier to understand and maintain. Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to '')
-rw-r--r--arch/x86/kernel/traps.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 23ac69a61a95..2d44e63cb583 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -498,8 +498,8 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
break; /* Success, it was handled */
case 1: /* Bound violation. */
{
+ struct task_struct *tsk = current;
struct mpx_fault_info mpx;
- struct siginfo info;
if (mpx_fault_info(&mpx, regs)) {
/*
@@ -510,19 +510,18 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)
}
/*
* Success, we decoded the instruction and retrieved
- * an 'info' containing the address being accessed
+ * an 'mpx' containing the address being accessed
* which caused the exception. This information
* allows and application to possibly handle the
* #BR exception itself.
*/
- clear_siginfo(&info);
- info.si_signo = SIGSEGV;
- info.si_errno = 0;
- info.si_code = SEGV_BNDERR;
- info.si_addr = mpx.addr;
- info.si_lower = mpx.lower;
- info.si_upper = mpx.upper;
- do_trap(X86_TRAP_BR, SIGSEGV, "bounds", regs, error_code, &info);
+ if (!do_trap_no_signal(tsk, X86_TRAP_BR, "bounds", regs,
+ error_code))
+ break;
+
+ show_signal(tsk, SIGSEGV, "trap ", "bounds", regs, error_code);
+
+ force_sig_bnderr(mpx.addr, mpx.lower, mpx.upper);
break;
}
case 0: /* No exception caused by Intel MPX operations. */