[BusyBox] init blocks signals and forgets to clear signal mask before executing news processes

Jean Wolter jw5 at os.inf.tu-dresden.de
Sun Sep 21 21:27:31 UTC 2003


Hello,

init blocks signals (especially SIGHUP) and forgets to clear the
signal mask before calling execve. Therefore new processes never see
SIGHUP if they don't unblock it themself.

init_main:

	/* Set up sig handlers  -- be sure to
	 * clear all of these in run() */
	sigemptyset(&mask);
	sigaddset(&mask, SIGHUP);
	sigprocmask(SIG_BLOCK, &mask, NULL);

But there is no code in run clearing this procmask. As a temporary
workaround I have added the following:

--- init.c      9 Sep 2003 21:36:47 -0000       1.2
+++ init.c      21 Sep 2003 20:24:21 -0000      1.3
@@ -602,6 +602,8 @@
 
                /* Now run it.  The new program will take over this PID, 
                 * so nothing further in init.c should be run. */
+               sigemptyset(&omask);
+               sigprocmask(SIG_SETMASK, &omask, NULL);
                execv(cmdpath, cmd);
 
                /* We're still here?  Some error happened. */

I am sure there is a better fix for this problem.

Regards,
Jean



More information about the busybox mailing list