Re: kill -9 <pid of X>

Linus Torvalds (torvalds@transmeta.com)
Wed, 12 Aug 1998 09:05:34 -0700 (PDT)


On Wed, 12 Aug 1998, Kenneth Albanowski wrote:
>
> May I therefore ask (as devil's advocate, please realize) why the kernel
> prevents init from receiving unwanted signals? Surely there is no reason
> root shouldn't be able to SIGKILL init, as you "could have killed the
> machine in easier ways", and we seem to be talking about the same level of
> mistake (accidentally killing the wrong process).

The reason I originally did this was simply that we didn't even have a
login program at all, the kernel just booted straight into a root shell.

And when things are unstable, it's really convenient to do a "kill -1" as
root to get rid of _everything_ (the kernel would just continue to respawn
the shell when the old one died). But you want to protect init, because
init is really special.

Init is not special because it knows about "runlevels" or any of that
stuff. That's something the kernel doesn't care about, never has, never
will. If init did just that, the kernel would be happy to kill it off.

Init is special because it inherits other peoples children. It's the only
process the kernel really cares about, because it's really the only
process that the kernel uses itself (see kernel/exit.c and search for "/*
init */").

And yes, I could remove that these days. Anybody who does "kill -1" as
root these days gets whatever he asked for. However, there's a large
difference between implementing a large subsystem like some have proposed
for graphics, and removing benign logic.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html