summaryrefslogtreecommitdiff
path: root/sys/arch/sh
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2020-11-08 20:37:25 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2020-11-08 20:37:25 +0000
commit74031521d567c6ba0101870b3799b63a6be4201c (patch)
tree3ef9403e70b4fa0f787d65c95afe5ddcfdae39e6 /sys/arch/sh
parentb6b37e2cad6e38e3e6bf47dabf031f65e846050a (diff)
In case of failure, call sigexit() from trapsignal instead of sensig().
Simplify MD code and reduce the amount of recursion into the signal code which helps when dealing with locks. ok cheloha@, deraadt@
Diffstat (limited to 'sys/arch/sh')
-rw-r--r--sys/arch/sh/sh/sh_machdep.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/arch/sh/sh/sh_machdep.c b/sys/arch/sh/sh/sh_machdep.c
index afdc4380552..7e4b1703104 100644
--- a/sys/arch/sh/sh/sh_machdep.c
+++ b/sys/arch/sh/sh/sh_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sh_machdep.c,v 1.51 2020/05/16 14:44:45 kettenis Exp $ */
+/* $OpenBSD: sh_machdep.c,v 1.52 2020/11/08 20:37:23 mpi Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */
/*
@@ -446,7 +446,7 @@ struct sigframe {
/*
* Send an interrupt to process.
*/
-void
+int
sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip)
{
struct proc *p = curproc;
@@ -485,14 +485,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip)
frame.sf_uc.sc_mask = mask;
frame.sf_uc.sc_cookie = (long)&fp->sf_uc ^ p->p_p->ps_sigcookie;
- if (copyout(&frame, fp, sizeof(frame)) != 0) {
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
- sigexit(p, SIGILL);
- /* NOTREACHED */
- }
+ if (copyout(&frame, fp, sizeof(frame)) != 0)
+ return 1;
tf->tf_r4 = sig; /* "signum" argument for handler */
tf->tf_r5 = (int)sip; /* "sip" argument for handler */
@@ -500,6 +494,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip)
tf->tf_spc = (int)catcher;
tf->tf_r15 = (int)fp;
tf->tf_pr = (int)p->p_p->ps_sigcode;
+
+ return 0;
}
/*