diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-06-07 21:53:44 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-06-07 21:53:44 +0000 |
commit | cb2217552f38ec43706ed1cc4988a81b7c604f1d (patch) | |
tree | ceb4852d2d9191fab14e9573088f6c2327dec1b5 /sys/arch/m68k | |
parent | d9855ee6d02521634ac87eb5d03559b9b6296243 (diff) |
Pass M_CANFAIL to malloc() in sendsig(), and if it fails, kill the process;
this is better than panic'ing due to low memory condition.
Diffstat (limited to 'sys/arch/m68k')
-rw-r--r-- | sys/arch/m68k/m68k/sig_machdep.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/arch/m68k/m68k/sig_machdep.c b/sys/arch/m68k/m68k/sig_machdep.c index 17995871a6c..a416e658a75 100644 --- a/sys/arch/m68k/m68k/sig_machdep.c +++ b/sys/arch/m68k/m68k/sig_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sig_machdep.c,v 1.16 2005/11/06 17:23:41 miod Exp $ */ +/* $OpenBSD: sig_machdep.c,v 1.17 2006/06/07 21:53:43 miod Exp $ */ /* $NetBSD: sig_machdep.c,v 1.3 1997/04/30 23:28:03 gwr Exp $ */ /* @@ -162,7 +162,14 @@ sendsig(catcher, sig, mask, code, type, val) printf("sendsig(%d): sig %d ssp %p usp %p scp %p ft %d\n", p->p_pid, sig, &oonstack, fp, &fp->sf_sc, ft); #endif - kfp = (struct sigframe *)malloc((u_long)fsize, M_TEMP, M_WAITOK); + kfp = (struct sigframe *)malloc((u_long)fsize, M_TEMP, + M_WAITOK | M_CANFAIL); + if (kfp == NULL) { + /* Better halt the process in its track than panicing */ + sigexit(p, SIGILL); + /* NOTREACHED */ + } + /* * Build the argument list for the signal handler. */ |