Le 02. 10. 15 12:35, Thomas Osterried a écrit :
I also wonder why userspace processes like kissattach do not get a signal by the kernel, indicating that the filedescriptor is not valid anymore.
Who’s job would it be to signal, the serial driver’s (slip, ppp, mkiss, ..), or ldisc’s?
It's a complete other problem, not kernel related. The safety of the kernel cannot depend on a user application closing a file descriptor. Even if the user application close his file descriptor, process scheduling can make this delayed long enough to let's a packet reach the parasitic uninitialized interface and completely crash the system. This will at best only reduce the race window but do nothing to fix the real bug. That said, kissattach uses a while (1) { sleep(); } loop that can be cheaply replaced by a single old select() waiting on the file descriptor. My understanding is that after the the AX25 discipline is in place the only event that can happen is that the descriptor is to be closed. I will test a kissattach patch for this.
AFAIK tty_ldisc_hangup() already signal EOF to the file descriptor owner with these lines:
wake_up_interruptible_poll(&tty->write_wait, POLLOUT);
wake_up_interruptible_poll(&tty->read_wait, POLLIN);