From d1b0415a5f6e0687db6b4e0f32ffd6d3f1d0fb2e Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 6 Aug 2005 12:10:29 +0000 Subject: If a process has trashed its stack, use sigexit() instead of psignal() to terminate it with prejudice, as done in native sendsig(). Plus you get a memory leak in COMPAT_HPUX on m68k fixed for free. review art@ test martin@ --- sys/arch/alpha/alpha/netbsd_machdep.c | 11 +++-------- sys/arch/hp300/hp300/hpux_machdep.c | 14 +++++--------- sys/arch/m68k/m68k/sunos_machdep.c | 19 +++++-------------- sys/arch/mvme68k/mvme68k/hpux_machdep.c | 12 ++++-------- 4 files changed, 17 insertions(+), 39 deletions(-) (limited to 'sys') diff --git a/sys/arch/alpha/alpha/netbsd_machdep.c b/sys/arch/alpha/alpha/netbsd_machdep.c index 99f1b47b1d7..bbbf4a5773a 100644 --- a/sys/arch/alpha/alpha/netbsd_machdep.c +++ b/sys/arch/alpha/alpha/netbsd_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netbsd_machdep.c,v 1.10 2003/08/10 00:03:21 miod Exp $ */ +/* $OpenBSD: netbsd_machdep.c,v 1.11 2005/08/06 12:10:25 miod Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -182,13 +182,8 @@ netbsd_sendsig(catcher, sig, mask, code, type, val) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ - SIGACTION(p, SIGILL) = SIG_DFL; - sig = sigmask(SIGILL); - p->p_sigignore &= ~sig; - p->p_sigcatch &= ~sig; - p->p_sigmask &= ~sig; - psignal(p, SIGILL); - return; + sigexit(p, SIGILL); + /* NOTREACHED */ } #ifdef DEBUG if (sigdebug & SDB_FOLLOW) diff --git a/sys/arch/hp300/hp300/hpux_machdep.c b/sys/arch/hp300/hp300/hpux_machdep.c index 1dd18e990f9..33f74e1caab 100644 --- a/sys/arch/hp300/hp300/hpux_machdep.c +++ b/sys/arch/hp300/hp300/hpux_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hpux_machdep.c,v 1.18 2005/01/15 21:13:08 miod Exp $ */ +/* $OpenBSD: hpux_machdep.c,v 1.19 2005/08/06 12:10:28 miod Exp $ */ /* $NetBSD: hpux_machdep.c,v 1.19 1998/02/16 20:58:30 thorpej Exp $ */ /* @@ -36,7 +36,7 @@ */ /* - * Machinde-dependent bits for HP-UX binary compatibility. + * Machine-dependent bits for HP-UX binary compatibility. */ #include @@ -506,13 +506,9 @@ hpux_sendsig(catcher, sig, mask, code, type, val) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ - SIGACTION(p, SIGILL) = SIG_DFL; - sig = sigmask(SIGILL); - p->p_sigignore &= ~sig; - p->p_sigcatch &= ~sig; - p->p_sigmask &= ~sig; - psignal(p, SIGILL); - return; + free((caddr_t)kfp, M_TEMP); + sigexit(p, SIGILL); + /* NOTREACHED */ } frame->f_regs[SP] = (int)fp; diff --git a/sys/arch/m68k/m68k/sunos_machdep.c b/sys/arch/m68k/m68k/sunos_machdep.c index 18a8874fed9..6aec0cd9477 100644 --- a/sys/arch/m68k/m68k/sunos_machdep.c +++ b/sys/arch/m68k/m68k/sunos_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sunos_machdep.c,v 1.16 2003/08/01 18:37:28 miod Exp $ */ +/* $OpenBSD: sunos_machdep.c,v 1.17 2005/08/06 12:10:28 miod Exp $ */ /* $NetBSD: sunos_machdep.c,v 1.12 1996/10/13 03:19:22 christos Exp $ */ /* @@ -116,12 +116,8 @@ sunos_sendsig(catcher, sig, mask, code, type, val) * have the process die unconditionally. */ if (ft >= FMT9) { - SIGACTION(p, sig) = SIG_DFL; - p->p_sigignore &= ~sig; - p->p_sigcatch &= ~sig; - p->p_sigmask &= ~sig; - psignal(p, sig); - return; + sigexit(p, sig); + /* NOTREACHED */ } /* @@ -173,13 +169,8 @@ sunos_sendsig(catcher, sig, mask, code, type, val) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ - SIGACTION(p, SIGILL) = SIG_DFL; - sig = sigmask(SIGILL); - p->p_sigignore &= ~sig; - p->p_sigcatch &= ~sig; - p->p_sigmask &= ~sig; - psignal(p, SIGILL); - return; + sigexit(p, SIGILL); + /* NOTREACHED */ } frame->f_regs[SP] = (int)fp; diff --git a/sys/arch/mvme68k/mvme68k/hpux_machdep.c b/sys/arch/mvme68k/mvme68k/hpux_machdep.c index 612b7a1c92b..e144e62ae06 100644 --- a/sys/arch/mvme68k/mvme68k/hpux_machdep.c +++ b/sys/arch/mvme68k/mvme68k/hpux_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hpux_machdep.c,v 1.12 2003/08/01 18:37:28 miod Exp $ */ +/* $OpenBSD: hpux_machdep.c,v 1.13 2005/08/06 12:10:28 miod Exp $ */ /* $NetBSD: hpux_machdep.c,v 1.9 1997/03/16 10:00:45 thorpej Exp $ */ /* @@ -544,13 +544,9 @@ hpux_sendsig(catcher, sig, mask, code, type, val) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ - SIGACTION(p, SIGILL) = SIG_DFL; - sig = sigmask(SIGILL); - p->p_sigignore &= ~sig; - p->p_sigcatch &= ~sig; - p->p_sigmask &= ~sig; - psignal(p, SIGILL); - return; + free((caddr_t)kfp, M_TEMP); + sigexit(p, SIGILL); + /* NOTREACHED */ } frame->f_regs[SP] = (int)fp; -- cgit v1.2.3