Killing the correct process

Maarten Litmaath maart at cs.vu.nl
Fri Feb 23 11:12:42 AEST 1990


In article <5410 at buengc.BU.EDU>,
	bph at buengc.BU.EDU (Blair P. Houghton) writes:
)...
)Sending a kill -HUP to a login-shell in the console window
)of a uVAX workstation Running Ultrix clobbers all of a
)login's processes and cycles the X server.

Ever heard of `signal(SIGHUP, SIG_IGN)'?

)...
)>Therefore there's a time window between determining which processes have to
)>be killed, and actually killing them.  During this interval the user may have
)>created new processes.
)
)It's a matter of getting the right one and making sure it's
)the same user.  Right now I'm checking to see that the pid
)is running, that it's owned by the correct uid, on the same
)tty, and has the same name (e.g., "-sh", "-csh", "-ksh",
)etc.) as when the killer-program was started (i.e., at
)login time.)

It seems one can easily bypass your little scheme:

	execl("/bin/sh", "Will Blair find me?", (char *) 0);

Furthermore: race conditions!

)It's still a crap-shoot, but it's a crap-shoot with
)probability of failure that has an *upper* bound of
)1/30,000.  That is one in 30,000 times when the same
)person has logged out and logged back in on the same
)workstation on the same day.  Such a situation is not
)too common in a big lab with tons of students and lots
)of workstations.  [...]

I was talking of events with much higher probability.
--
  "Ever since the discovery of domain addresses in the French cave paintings
  [...]"  (Richard Sexton)      |  maart at cs.vu.nl,  uunet!mcsun!botter!maart



More information about the Comp.unix.questions mailing list