🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.4bsd
Article #1701

tty bug in 4.3bsd

#1701
From: Ron Hutchins
Date: Thu, 16 Oct 1986 21:01
78 lines
2824 bytes
There have been several reports in our area of system crashes on 4.3bsd which
show a segmentation fault on the console panic message. We have been experiencing 
them quite frequently and it appears that running layers on 4.3 exercises the
bug. After looking through the crash dumps it appeared that the stack showed
	ptsclose
	ttylclose
	ttywflush
	ttywait

and then off into never never land and various syscalls from the kernel or a
panic from the Xtransflt routine, etc.
	As it turns out the ttywait routine calls the tp->t_oproc routine
which for ptys is ptsstart. BUT if the controlling side of the pty closes
first, it zeros the pointer to the routine as a flag that it is closed. Thus
when ttywait calls the function, it jumps through a 0 pointer.
	Looking at the 4.2 (BRL fixes) code there is a comment in the 
ttywait routine which says "kludge for pty" which does a check for the 
pointer being 0 before doing the jump. We added this to the 4.3 code and it
appears to be working so far. The differences are #ifdef'd with GATECH below.


Ron Hutchins
School of Information & Computer Science, Georgia Tech, Atlanta GA 30332
CSNet:  ron @ GATech		ARPA:  ron%GATech.CSNet @ CSNet-Relay.ARPA
uucp:  ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!ron


***********************************************************************************



/*
 * Copyright (c) 1982, 1986 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)tty.c	7.1 (Berkeley) 6/5/86
 */


*
*
*
*
*
*
*
ttywait(tp)
	register struct tty *tp;
{
	register int s = spltty();

	while ((tp->t_outq.c_cc || tp->t_state&TS_BUSY) &&
#ifdef GATECH
	    tp->t_state&TS_CARR_ON && tp->t_oproc) {        /*KLUDGE for pty from BRL*/
#else
	    tp->t_state&TS_CARR_ON) {
#endif
		(*tp->t_oproc)(tp);
		tp->t_state |= TS_ASLEEP;
		sleep((caddr_t)&tp->t_outq, TTOPRI);
	}
	splx(s);
}
*
*
*
*
*
*
*
*

-- 
Ron Hutchins
School of Information & Computer Science, Georgia Tech, Atlanta GA 30332
CSNet:  ron @ GATech		ARPA:  ron%GATech.CSNet @ CSNet-Relay.ARPA
uucp:  ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!ron
Technical Details
Message-ID: <4721@gatech.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!sri-spam!sri-unix!hplabs!gatech!ron

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!sri-spam!sri-unix!hplabs!gatech!ron
From: ron@gatech.EDU (Ron Hutchins)
Newsgroups: net.bugs.4bsd
Subject: tty bug in 4.3bsd
Message-ID: <4721@gatech.EDU>
Date: Thu, 16-Oct-86 17:01:51 EDT
Article-I.D.: gatech.4721
Posted: Thu Oct 16 17:01:51 1986
Date-Received: Fri, 17-Oct-86 04:03:02 EDT
Organization: School of Information and Computer Science, Georgia Tech, Atlanta
Lines: 78
Keywords: bug pty panic segmentation fault