Re: tty->count(1) != #fd's(2)

Ian Viemeister (ian@viemeister.com)
Tue, 04 Mar 1997 11:53:50 -0400


This is definitely a side effect of changing to the new
tty major/minors -- sshd did this for the first time right
after I replaced /dev/tty[p-e][1-f].
Have you also noticed that you start losing tty's?
With every ssh connection (and with some other connections,
but less predicatably), I lose one tty device.
Watch:
viemeister.com:~$ w
4:41pm up 11 days, 20:00, 1 user, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
ian ttypb nj010c-035.cybe 4:39pm 0.00s 0.14s 0.03s w
viemeister.com:~$

Currently I've lost ttyp0 through ttypa.
Not only that, but every time a process (like telnetd) tries
to allocate a tty, I get one error in syslog for each missing
tty. (same error as below)

I'd try to put a fix together, but I don't really understand
how the kernel handles psuedo-ttys internally.

Ian Viemeister
ian@viemeister.com
http://www.viemeister.com/

Doug Ledford <dledford@dialnet.net> said:
> On Tue, 25 Feb 1997, Jon Lewis wrote:
>
> > I got this with 2.0.28 today. I don't remember getting these since very
> > shortly after upgrading to 2.0.x and the new 256 ptys.
> >
> > Feb 24 22:17:14 yoda sshd[17348]: log: Password authentication for flaboy
> > accepted.
> > Feb 24 22:17:16 yoda kernel: Warning: dev (03:b3) tty->count(1) != #fd's(2)
> > in do_tty_hangup
> > Feb 24 22:17:17 yoda sshd[17348]: log: Closing connection to 205.229.48.120
>
> I just got this again, and again it's right about the same time as an sshd
> session ending:
>
> Feb 27 16:51:46 yoda kernel: Warning: dev (03:b4) tty->count(1) !=
> #fd's(2) in do_tty_hangup
> Feb 27 16:51:46 yoda sshd[25049]: log: Closing connection to 205.229.48.42
>
> I only have the new tty/pty devices...the old ones were rm'd many months
> ago. It seems to me this must be a kernel bug sshd is exposing. I'm
> using sshd 1.2.17 (ELF) and kernel 2.0.28 on the server.