Subject: port-i386/4177: pccons.c scroll crash
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 09/28/1997 01:16:45
>Number:         4177
>Category:       port-i386
>Synopsis:       use of scroll-lock w. pccons.c can hang the machine
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 28 05:50:00 1997
>Last-Modified:
>Originator:     dholland@eecs.harvard.edu
>Organization:
   - David A. Holland             |    VINO project home page:
     dholland@eecs.harvard.edu    | http://www.eecs.harvard.edu/vino
>Release:        1.2.1
>Environment:
	
System: NetBSD chianti.eecs.harvard.edu 1.2.1 NetBSD 1.2.1 (CHIANTI) #1: Tue Sep 9 16:52:39 EDT 1997 root@chianti.eecs.harvard.edu:/usr/src/sys/arch/i386/compile/CHIANTI i386


>Description:
	The tsleep() in sput() that pccons.c uses to hold output 
	when scroll-lock is on can sometimes get called from an
	interrupt handler, leading to a total system lockup.

	This happens when you have tty echo on, you press scroll-lock,
	and you go off the bottom of the screen by pressing return
	(that is, nothing else is in the output queue). The return 
	comes out of sget() in pcintr() and gets handed to l_rint().
	l_rint is ttyinput(), and if tty echo is set, the newline
	gets echoed to ttyoutput(). This would be fine, except that
	ttyinput() calls ttstart() at the bottom, and pcstart(), 
	which this calls, tries to handle the output right away.
	This means that sput() gets called with the newline... and
	since scroll-lock is on, it tries to sleep to wait for it
	to turn off. Boom.

>How-To-Repeat:
	Make sure you're running a shell that doesn't put the tty
	in raw mode (eg, sh or csh, not tcsh, bash, or zsh), go to
	the bottom of the screen, hit scroll-lock, and press return.
	Machine hangs completely.
>Fix:
	Unfortunately, I don't have any suggestions. This looks like
	it could easily turn out to require a substantial rewrite.
	Or scroll-lock support could be sacrificed.

>Audit-Trail:
>Unformatted: