Commit f71016a8 authored by Will Deacon's avatar Will Deacon

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: default avatarWill Deacon <will.deacon@arm.com>
parent 92ff0674
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <asm/fpsimd.h> #include <asm/fpsimd.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/signal32.h> #include <asm/signal32.h>
#include <asm/traps.h>
#include <asm/vdso.h> #include <asm/vdso.h>
/* /*
...@@ -565,11 +566,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) ...@@ -565,11 +566,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
return regs->regs[0]; return regs->regs[0];
badframe: badframe:
if (show_unhandled_signals) arm64_notify_segfault(regs->sp);
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);
return 0; return 0;
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <asm/esr.h> #include <asm/esr.h>
#include <asm/fpsimd.h> #include <asm/fpsimd.h>
#include <asm/signal32.h> #include <asm/signal32.h>
#include <asm/traps.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/unistd.h> #include <asm/unistd.h>
...@@ -307,11 +308,7 @@ asmlinkage int compat_sys_sigreturn(struct pt_regs *regs) ...@@ -307,11 +308,7 @@ asmlinkage int compat_sys_sigreturn(struct pt_regs *regs)
return regs->regs[0]; return regs->regs[0];
badframe: badframe:
if (show_unhandled_signals) arm64_notify_segfault(regs->compat_sp);
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);
return 0; return 0;
} }
...@@ -344,11 +341,7 @@ asmlinkage int compat_sys_rt_sigreturn(struct pt_regs *regs) ...@@ -344,11 +341,7 @@ asmlinkage int compat_sys_rt_sigreturn(struct pt_regs *regs)
return regs->regs[0]; return regs->regs[0];
badframe: badframe:
if (show_unhandled_signals) arm64_notify_segfault(regs->compat_sp);
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);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment