summaryrefslogtreecommitdiff
path: root/sys/arch/mips64
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/mips64
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/mips64')
-rw-r--r--sys/arch/mips64/mips64/sendsig.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/arch/mips64/mips64/sendsig.c b/sys/arch/mips64/mips64/sendsig.c
index 55ca6c36637..8d4de5df441 100644
--- a/sys/arch/mips64/mips64/sendsig.c
+++ b/sys/arch/mips64/mips64/sendsig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sendsig.c,v 1.33 2019/08/02 07:41:57 visa Exp $ */
+/* $OpenBSD: sendsig.c,v 1.34 2020/11/08 20:37:23 mpi Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -91,7 +91,7 @@ struct sigframe {
/*
* Send an interrupt to process.
*/
-void
+int
sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip)
{
struct cpu_info *ci = curcpu();
@@ -139,19 +139,13 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip)
if (psp->ps_siginfo & sigmask(sig)) {
if (copyout(ksip, (caddr_t)&fp->sf_si, sizeof *ksip))
- goto bail;
+ return 1;
}
ksc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie;
- if (copyout((caddr_t)&ksc, (caddr_t)&fp->sf_sc, sizeof(ksc))) {
-bail:
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
- sigexit(p, SIGILL);
- /* NOTREACHED */
- }
+ if (copyout((caddr_t)&ksc, (caddr_t)&fp->sf_sc, sizeof(ksc)))
+ return 1;
+
/*
* Build the argument list for the signal handler.
*/
@@ -165,6 +159,8 @@ bail:
regs->sp = (register_t)fp;
regs->ra = p->p_p->ps_sigcode;
+
+ return 0;
}
/*