[net.bugs.2bsd] init

smiles@lsrhs.UUCP (Kevin "Mr. Boots" Ruddy) (01/06/86)

There is apparently a very interesting (and annoying) bug in 2.9's init, or
so we have encountered.  If ^C is hit in between when init forks and when
getty is exec'd, SIGINT is sent to init.  Sometimes this even happened to
running login's.

This bug should be able to be reproduced by repeatedly hitting ^C at any
currently running getty or login.  The result of this is that init's child
thinks it's going into special session.  It logs everyone out and is a
rather nasty problem.  (A question: when this happens, it sometimes happens
that not everyone is logged out.  Why would kill(-1, SIGKILL) not always
work?)

The best fix for this would be this: after init forks in dfork(), have
it firstly setpgrp(0, getpid()).  This should solve all problems.  For
some odd reason, when we do this, and compile -ljobs, init "breaks" and
things go temporarily haywire, and it becomes impossible to log in.
Our second solution was to signal(SIGINT, SIG_DFL), rather than setpgrp().
This seems to have fixed the problem.

Has anyone else experienced this problem?  It became very annoying when
we started to use the 'B' option in getty, and people tried to set speeds
by hitting ^C many times in a row ...
--
ADDR: Kevin Ruddy, 42 Pantry Road, Sudbury MA  01776
UUCP: {genrad!grkermit,harvard!wjh12,bbncca,mit-eddie!frog}!lsrhs!smiles
ARPA: lsrhs!smiles@bbncca.arpa

root@uokmet.UUCP (01/09/86)

>There is apparently a very interesting (and annoying) bug in 2.9's init, or
>so we have encountered.  If ^C is hit in between when init forks and when
>getty is exec'd, SIGINT is sent to init.  Sometimes this even happened to
>running login's.
>
>This bug should be able to be reproduced by repeatedly hitting ^C at any
>currently running getty or login.  The result of this is that init's child
>thinks it's going into special session.  It logs everyone out and is a
>rather nasty problem.  (A question: when this happens, it sometimes happens
>that not everyone is logged out.  Why would kill(-1, SIGKILL) not always
>work?)
>
>Our second solution was to signal(SIGINT, SIG_DFL), rather than setpgrp().

You should also add:
	signal(SIGQUIT, SIG_DFL);

Another way to produce the problems is to have root do a "kill -2" on *ANY*
init processes.

	Kevin W. Thomas
	Univ. of Oklahoma
	School of Meteorology
	Norman, OK

UUCP:	...!ihnp4!okstate!uokvax!uokmet!kwthomas