How do you handle while(1) fork(); ?
Michael P. Lindner
mpl at pegasus.ATT.COM
Fri Jul 13 06:04:42 AEST 1990
In article <4261 at uqcspe.cs.uq.oz.au> rhys at batserver.cs.uq.oz.au writes:
>peter at aucs.uucp (Peter Steele) writes:
>>ARaman at massey.ac.nz (A.V. Raman) writes:
>>>Is there any way to kill all instances of a process that has the
>>>following piece of code in it without having to bring the system down?
>
>>> while (1)
>>> fork();
>
>>>Any help (by email) would be appreciated.
>
>>I think a summary of responses to this question would be appreciated.
>>We've had students do this on many occasions on our Sun.
deleted stuff
How about something like:
main(argc, argv)
int argc;
char *argv[];
{
setuid(atoi(argv[1]));
kill(-1, 9);
}
With appropriate checks for validity of arguments and return codes, of
course. Man page for kill(2)... "if pid is -1, and the effective user ID
of the sender is not super-user, sig will be sent to all processes excluding
proc0 and proc1 whose real user ID is equal to the effective user ID of
the sender. When the above program is run as super-user, with the offender's
numerical user ID as its argument, it makes its user ID the same as the
offender's and kills all processes belonging to that user. Not sure if
this'll work on non-System V machines.
Mike Lindner
attmail!mplindner
More information about the Comp.unix.questions
mailing list