Re: funny behaviour of shutdown

Theodore Y. Ts'o (tytso@mit.edu)
Tue, 16 Apr 1996 21:54:11 -0400


Date: Tue, 16 Apr 1996 18:31:07 +0400 (MSD)
From: inr-linux-kernel@ms2.inr.ac.ru (A.Kuznetsov)

Very long ago, line marked by exclamations was missing
in tty_io.c.

void disassociate_ctty(int on_exit)
{
struct tty_struct *tty = current->tty;
struct task_struct *p;

if (tty) {
!!!!! if (on_exit && tty->driver.type != TTY_DRIVER_TYPE_PTY)
tty_vhangup(tty);
} else {
....

When it was inserted (I forgot patch level number),
my "shutdown" stopped to make any tty output after kill(-1, SIGKILL)

It was added deliberately as a security feature. The idea is that when
the controlling process dies, the tty should get hung up. This prevents
surviving processes from either maliciously or accidentally being able
to send/receive characters to the tty. For example, without this the
next person who is logging in to have access to a leftover program,
confusing the person and perhaps allowing that user to access files
owned by the previous user. It's also very useful way of cleaning up
after users on a dialup server.

As far as shutdown is concerned, it's clear how this causes a problem.
What I'd suggest doing to work around this is to reopen the tty after
kill() call.

- Ted