From 74031521d567c6ba0101870b3799b63a6be4201c Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Sun, 8 Nov 2020 20:37:25 +0000 Subject: 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@ --- sys/arch/alpha/alpha/machdep.c | 19 +++++++------------ sys/arch/amd64/amd64/machdep.c | 12 +++++++----- sys/arch/arm/arm/sig_machdep.c | 18 +++++++----------- sys/arch/arm64/arm64/sig_machdep.c | 16 ++++++---------- sys/arch/hppa/hppa/machdep.c | 12 +++++++----- sys/arch/i386/i386/machdep.c | 18 +++++++----------- sys/arch/m88k/m88k/sig_machdep.c | 16 ++++++---------- sys/arch/macppc/macppc/machdep.c | 8 +++++--- sys/arch/mips64/mips64/sendsig.c | 20 ++++++++------------ sys/arch/powerpc64/powerpc64/machdep.c | 8 +++++--- sys/arch/sh/sh/sh_machdep.c | 16 ++++++---------- sys/arch/sparc64/sparc64/machdep.c | 9 +++++---- sys/kern/kern_sig.c | 14 +++++++++++--- sys/sys/signalvar.h | 4 ++-- 14 files changed, 89 insertions(+), 101 deletions(-) (limited to 'sys') diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 7ca968836dd..ca164c6acf0 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.194 2020/10/20 15:59:17 cheloha Exp $ */ +/* $OpenBSD: machdep.c,v 1.195 2020/11/08 20:37:21 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -1383,7 +1383,7 @@ regdump(framep) /* * Send an interrupt to process. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -1445,20 +1445,13 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) if (psp->ps_siginfo & sigmask(sig)) { sip = (void *)scp + kscsize; if (copyout(ksip, (caddr_t)sip, fsize - kscsize) != 0) - goto trash; + return 1; } else sip = NULL; ksc.sc_cookie = (long)scp ^ p->p_p->ps_sigcookie; - if (copyout((caddr_t)&ksc, (caddr_t)scp, kscsize) != 0) { -trash: - /* - * 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)scp, kscsize) != 0) + return 1; /* * Set up the registers to return to sigcode. @@ -1469,6 +1462,8 @@ trash: frame->tf_regs[FRAME_A2] = (u_int64_t)scp; frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */ alpha_pal_wrusp((unsigned long)scp); + + return 0; } /* diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index a08c375a1ee..e12700c1576 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.269 2020/08/20 15:12:35 kn Exp $ */ +/* $OpenBSD: machdep.c,v 1.270 2020/11/08 20:37:22 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -566,7 +566,7 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, * signal mask, the stack, and the frame pointer, it returns to the * user specified pc. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -618,7 +618,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) sp -= fpu_save_len; ksc.sc_fpstate = (struct fxsave64 *)sp; if (copyout(sfp, (void *)sp, fpu_save_len)) - sigexit(p, SIGILL); + return 1; /* Now reset the FPU state in PCB */ memcpy(&p->p_addr->u_pcb.pcb_savefpu, @@ -630,13 +630,13 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) sss += (sizeof(*ksip) + 15) & ~15; if (copyout(ksip, (void *)sip, sizeof(*ksip))) - sigexit(p, SIGILL); + return 1; } scp = sp - sss; ksc.sc_cookie = (long)scp ^ p->p_p->ps_sigcookie; if (copyout(&ksc, (void *)scp, sizeof(ksc))) - sigexit(p, SIGILL); + return 1; /* * Build context to run handler in. @@ -654,6 +654,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) /* The reset state _is_ the userspace state for this thread now */ curcpu()->ci_flags |= CPUF_USERXSTATE; + + return 0; } /* diff --git a/sys/arch/arm/arm/sig_machdep.c b/sys/arch/arm/arm/sig_machdep.c index 43e9eabc20f..faa4a8358d3 100644 --- a/sys/arch/arm/arm/sig_machdep.c +++ b/sys/arch/arm/arm/sig_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sig_machdep.c,v 1.18 2018/07/10 04:19:59 guenther Exp $ */ +/* $OpenBSD: sig_machdep.c,v 1.19 2020/11/08 20:37:22 mpi Exp $ */ /* $NetBSD: sig_machdep.c,v 1.22 2003/10/08 00:28:41 thorpej Exp $ */ /* @@ -74,7 +74,7 @@ process_frame(struct proc *p) * signal mask, the stack, and the frame pointer, it returns to the * user specified pc. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -145,14 +145,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) } frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ 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; /* * Build context to run handler in. We invoke the handler @@ -163,8 +157,10 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) tf->tf_r2 = (register_t)frame.sf_scp; tf->tf_pc = (register_t)frame.sf_handler; tf->tf_usr_sp = (register_t)fp; - + tf->tf_usr_lr = p->p_p->ps_sigcode; + + return 0; } /* diff --git a/sys/arch/arm64/arm64/sig_machdep.c b/sys/arch/arm64/arm64/sig_machdep.c index 016afc06832..b776ae4adc2 100644 --- a/sys/arch/arm64/arm64/sig_machdep.c +++ b/sys/arch/arm64/arm64/sig_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sig_machdep.c,v 1.6 2018/07/10 04:19:59 guenther Exp $ */ +/* $OpenBSD: sig_machdep.c,v 1.7 2020/11/08 20:37:22 mpi Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -94,7 +94,7 @@ process_frame(struct proc *p) * signal mask, the stack, and the frame pointer, it returns to the * user specified pc. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -143,14 +143,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) } frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ 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; /* * Build context to run handler in. We invoke the handler @@ -163,6 +157,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) tf->tf_sp = (register_t)fp; tf->tf_elr = p->p_p->ps_sigcode; + + return 0; } /* diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index 896255798ba..5c127853003 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.261 2020/10/21 04:10:56 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.262 2020/11/08 20:37:22 mpi Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -1207,7 +1207,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack, /* * Send an interrupt to process. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -1279,7 +1279,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) sizeof(ksc.sc_fpregs)); if (setstack(tf, scp + sss, tf->tf_r3)) - sigexit(p, SIGILL); + return 1; tf->tf_arg0 = sig; tf->tf_arg1 = sip; @@ -1293,12 +1293,14 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) ksc.sc_cookie = (long)scp ^ p->p_p->ps_sigcookie; if (copyout(&ksc, (void *)scp, sizeof(ksc))) - sigexit(p, SIGILL); + return 1; if (sip) { if (copyout(ksip, (void *)sip, sizeof *ksip)) - sigexit(p, SIGILL); + return 1; } + + return 0; } int diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index f029a9c2c78..90f71921020 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.640 2020/09/24 11:36:50 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.641 2020/11/08 20:37:23 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2443,7 +2443,7 @@ pentium_cpuspeed(int *freq) * frame pointer, it returns to the user * specified pc, psl. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -2475,7 +2475,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) frame.sf_sc.sc_fpstate = (void *)sp; if (copyout(&p->p_addr->u_pcb.pcb_savefpu, (void *)sp, sizeof(union savefpu))) - sigexit(p, SIGILL); + return 1; /* Signal handlers get a completely clean FP state */ p->p_md.md_flags &= ~MDP_USEDFPU; @@ -2516,14 +2516,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) /* XXX don't copyout siginfo if not needed? */ frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ 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; /* * Build context to run handler in. @@ -2537,6 +2531,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) tf->tf_eflags &= ~(PSL_T|PSL_D|PSL_VM|PSL_AC); tf->tf_esp = (int)fp; tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL); + + return 0; } /* diff --git a/sys/arch/m88k/m88k/sig_machdep.c b/sys/arch/m88k/m88k/sig_machdep.c index 579ac281b31..cf4e731093d 100644 --- a/sys/arch/m88k/m88k/sig_machdep.c +++ b/sys/arch/m88k/m88k/sig_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sig_machdep.c,v 1.29 2018/07/10 04:19:59 guenther Exp $ */ +/* $OpenBSD: sig_machdep.c,v 1.30 2020/11/08 20:37:23 mpi Exp $ */ /* * Copyright (c) 2014 Miodrag Vallat. * @@ -103,7 +103,7 @@ pid_t sigpid = 0; /* * Send an interrupt to process. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -152,14 +152,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) bcopy((const void *)&tf->tf_regs, (void *)&sf.sf_sc.sc_regs, sizeof(sf.sf_sc.sc_regs)); - if (copyout((caddr_t)&sf, (caddr_t)fp, fsize)) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - sigexit(p, SIGILL); - /* NOTREACHED */ - } + if (copyout((caddr_t)&sf, (caddr_t)fp, fsize)) + return 1; /* * Set up registers for the signal handler invocation. @@ -186,6 +180,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) ((sigdebug & SDB_KSTACK) && p->p_p->ps_pid == sigpid)) printf("sendsig(%d): sig %d returns\n", p->p_p->ps_pid, sig); #endif + + return 0; } /* diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index be055dde16f..c3347da0b96 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.192 2020/06/05 14:25:05 naddy Exp $ */ +/* $OpenBSD: machdep.c,v 1.193 2020/11/08 20:37:23 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -442,7 +442,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack, /* * Send a signal to process. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -480,7 +480,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) } frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie; if (copyout(&frame, fp, sizeof frame) != 0) - sigexit(p, SIGILL); + return 1; tf->fixreg[1] = (int)fp; tf->lr = (int)catcher; @@ -494,6 +494,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) syncicache(pa, (p->p_p->ps_emul->e_esigcode - p->p_p->ps_emul->e_sigcode)); #endif + + return 0; } /* 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; } /* diff --git a/sys/arch/powerpc64/powerpc64/machdep.c b/sys/arch/powerpc64/powerpc64/machdep.c index be308caecb8..2aa77e28269 100644 --- a/sys/arch/powerpc64/powerpc64/machdep.c +++ b/sys/arch/powerpc64/powerpc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.64 2020/10/31 17:57:53 patrick Exp $ */ +/* $OpenBSD: machdep.c,v 1.65 2020/11/08 20:37:24 mpi Exp $ */ /* * Copyright (c) 2020 Mark Kettenis @@ -887,7 +887,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack, pcb->pcb_flags = 0; } -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -948,7 +948,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie; if (copyout(&frame, fp, sizeof(frame))) - sigexit(p, SIGILL); + return 1; /* * Build context to run handler in. @@ -960,6 +960,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) tf->fixreg[12] = (register_t)catcher; tf->srr0 = p->p_p->ps_sigcode; + + return 0; } int 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; } /* diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index aaf05e1e6dd..fb6cff2f1a2 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.198 2020/06/23 01:21:29 jmatthew Exp $ */ +/* $OpenBSD: machdep.c,v 1.199 2020/11/08 20:37:24 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -402,7 +402,7 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, /* * Send an interrupt to process. */ -void +int sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; @@ -477,8 +477,7 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) printf("sendsig: stack was trashed trying to send sig %d, " "sending SIGILL\n", sig); #endif - sigexit(p, SIGILL); - /* NOTREACHED */ + return 1; } /* @@ -490,6 +489,8 @@ sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) tf->tf_pc = addr; tf->tf_npc = addr + 4; tf->tf_out[6] = newsp - STACK_OFFSET; + + return 0; } /* 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); } diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h index c8c71da3318..a4629a8f96f 100644 --- a/sys/sys/signalvar.h +++ b/sys/sys/signalvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signalvar.h,v 1.44 2020/09/16 13:50:42 mpi Exp $ */ +/* $OpenBSD: signalvar.h,v 1.45 2020/11/08 20:37:24 mpi Exp $ */ /* $NetBSD: signalvar.h,v 1.17 1996/04/22 01:23:31 christos Exp $ */ /* @@ -140,6 +140,6 @@ void sigactsfree(struct process *); /* * Machine-dependent functions: */ -void sendsig(sig_t _catcher, int _sig, sigset_t _mask, const siginfo_t *_si); +int sendsig(sig_t _catcher, int _sig, sigset_t _mask, const siginfo_t *_si); #endif /* _KERNEL */ #endif /* !_SYS_SIGNALVAR_H_ */ -- cgit v1.2.3