summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sig.c
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/kern/kern_sig.c
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/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index b1c6f11c745..0cd78b46de5 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.263 2020/09/16 13:50:42 mpi Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.264 2020/11/08 20:37:24 mpi Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -464,6 +464,8 @@ sys_sigprocmask(struct proc *p, void *v, register_t *retval)
int error = 0;
sigset_t mask;
+ KASSERT(p == curproc);
+
*retval = p->p_sigmask;
mask = SCARG(uap, mask) &~ sigcantmask;
@@ -824,7 +826,10 @@ trapsignal(struct proc *p, int signum, u_long trapno, int code,
p->p_sigmask, code, &si);
}
#endif
- sendsig(ps->ps_sigact[signum], signum, p->p_sigmask, &si);
+ if (sendsig(ps->ps_sigact[signum], signum, p->p_sigmask, &si)) {
+ sigexit(p, SIGILL);
+ /* NOTREACHED */
+ }
postsig_done(p, signum, ps);
} else {
p->p_sisig = signum;
@@ -1452,7 +1457,10 @@ postsig(struct proc *p, int signum)
p->p_sigval.sival_ptr = NULL;
}
- sendsig(action, signum, returnmask, &si);
+ if (sendsig(action, signum, returnmask, &si)) {
+ sigexit(p, SIGILL);
+ /* NOTREACHED */
+ }
postsig_done(p, signum, ps);
splx(s);
}