Subject: Re: kern/5504: signal handler does not get called again after execve
To: John Kohl <jtk@kolvir.arlington.ma.us>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 05/28/1998 09:20:07
> This seems related to a bug I ran into on SunOS, which is present in
> NetBSD as well.  Solaris and Digital UNIX do not have this bug.

> Signal delivery masks (the sigmasks installed while a signal is
> handled) should be cleared at exec() time, but they are not.

[referring not to unblocking signals at exec time, but rather to
resetting the signals-to-block-on-delivery masks]

In NetBSD, this amounts to just clearing the ps_catchmask[] entries in
execsigs() (sys/kern/kern_sig.c).  Depending on your philosophy, you
can either sigemptyset() (or kernel equivalent) them all, or just the
ones corresponding to caught signals.  Personally, I'd tend towards the
former; here's a (COMPLETELY UNTESTED) patch for it, relative to
$NetBSD: kern_sig.c,v 1.71 1998/03/01 02:22:30 fvdl Exp $

--- OLD/sys/kern/kern_sig.c	Thu Jan  1 00:00:00 1970
+++ NEW/sys/kern/kern_sig.c	Thu Jan  1 00:00:00 1970
@@ -253,6 +253,11 @@
 		ps->ps_sigact[nc] = SIG_DFL;
 	}
 	/*
+	 * Reset all the ps_catchmask masks to "no signals".
+	 */
+	for (nc=0; nc<NSIG; nc++)
+		ps->ps_catchmask[nc] = 0;
+	/*
 	 * Reset stack state to the user stack.
 	 * Clear set of signals caught on the signal stack.
 	 */

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B