diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2018-01-04 04:22:04 +0300 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2018-09-19 16:53:11 +0300 |
commit | 8d68fa0e083995b48be6b66e04afe746d4654b0c (patch) | |
tree | 6c939685f89f57cbc13b178c0310c79b98db4072 /arch/x86/kernel/traps.c | |
parent | 8a35eb22c02baf0c58b44ba28fc163270ef147f8 (diff) | |
download | linux-8d68fa0e083995b48be6b66e04afe746d4654b0c.tar.xz |
signal/x86: Move mpx siginfo generation into do_bounds
This separates the logic of generating the signal from the logic of
gathering the information about the bounds violation.
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'arch/x86/kernel/traps.c')
-rw-r--r-- | arch/x86/kernel/traps.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index e6db475164ed..2155d2c7f49b 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -455,7 +455,6 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) { const struct mpx_bndcsr *bndcsr; - siginfo_t *info; RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); if (notify_die(DIE_TRAP, "bounds", regs, error_code, @@ -493,8 +492,11 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) goto exit_trap; break; /* Success, it was handled */ case 1: /* Bound violation. */ - info = mpx_generate_siginfo(regs); - if (IS_ERR(info)) { + { + struct mpx_fault_info mpx; + struct siginfo info; + + if (mpx_fault_info(&mpx, regs)) { /* * We failed to decode the MPX instruction. Act as if * the exception was not caused by MPX. @@ -508,9 +510,16 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) * allows and application to possibly handle the * #BR exception itself. */ - do_trap(X86_TRAP_BR, SIGSEGV, "bounds", regs, error_code, info); - kfree(info); + 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); break; + } case 0: /* No exception caused by Intel MPX operations. */ goto exit_trap; default: |