diff options
author | Will Deacon <will.deacon@arm.com> | 2018-02-20 18:05:17 +0300 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2018-03-06 21:52:25 +0300 |
commit | f71016a8a8c5696530ec7173ee969c68e91d3719 (patch) | |
tree | fbe0d09621bd8157802386195be3bf528d7de463 /arch/arm64 | |
parent | 92ff0674f5d8013704cbaeaceb8e3576b36754ee (diff) | |
download | linux-f71016a8a8c5696530ec7173ee969c68e91d3719.tar.xz |
arm64: signal: Call arm64_notify_segfault when failing to deliver signal
If we fail to deliver a signal due to taking an unhandled fault on the
stackframe, we can call arm64_notify_segfault to deliver a SEGV can deal
with printing any unhandled signal messages for us, rather than roll our
own printing code.
A side-effect of this change is that we now deliver the frame address
in si_addr along with an si_code of SEGV_{ACC,MAP}ERR, rather than an
si_addr of 0 and an si_code of SI_KERNEL as before.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/kernel/signal.c | 7 | ||||
-rw-r--r-- | arch/arm64/kernel/signal32.c | 13 |
2 files changed, 5 insertions, 15 deletions
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index f60c052e8d1c..e5c656d0e316 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -40,6 +40,7 @@ #include <asm/fpsimd.h> #include <asm/ptrace.h> #include <asm/signal32.h> +#include <asm/traps.h> #include <asm/vdso.h> /* @@ -565,11 +566,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) return regs->regs[0]; badframe: - if (show_unhandled_signals) - pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n", - current->comm, task_pid_nr(current), __func__, - regs->pc, regs->sp); - force_sig(SIGSEGV, current); + arm64_notify_segfault(regs->sp); return 0; } diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index 79feb861929b..68f5e07b592b 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c @@ -26,6 +26,7 @@ #include <asm/esr.h> #include <asm/fpsimd.h> #include <asm/signal32.h> +#include <asm/traps.h> #include <linux/uaccess.h> #include <asm/unistd.h> @@ -307,11 +308,7 @@ asmlinkage int compat_sys_sigreturn(struct pt_regs *regs) return regs->regs[0]; badframe: - if (show_unhandled_signals) - pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n", - current->comm, task_pid_nr(current), __func__, - regs->pc, regs->compat_sp); - force_sig(SIGSEGV, current); + arm64_notify_segfault(regs->compat_sp); return 0; } @@ -344,11 +341,7 @@ asmlinkage int compat_sys_rt_sigreturn(struct pt_regs *regs) return regs->regs[0]; badframe: - if (show_unhandled_signals) - pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n", - current->comm, task_pid_nr(current), __func__, - regs->pc, regs->compat_sp); - force_sig(SIGSEGV, current); + arm64_notify_segfault(regs->compat_sp); return 0; } |