[5508] in Athena Bugs
RT kernel: pty close
daemon@ATHENA.MIT.EDU (John Carr)
Wed Jul 11 16:08:15 1990
To: bugs@ATHENA.MIT.EDU
Cc: mar@ATHENA.MIT.EDU
Date: Wed, 11 Jul 90 16:07:49 EDT
From: John Carr <jfc@ATHENA.MIT.EDU>
E40-008-8 crashed recently. The fault was an attempt to call a NULL function
pointer in ttywait. The VAX version of this function fixes the problem by
checking the function pointer against NULL. This may or may not be the best
fix, but it will prevent crashes.
If anyone wants to look at the dump, it is achates:/u1/dumps/rt/vm*.2. Stack
trace:
ttywait(e00b1664)
ttywflush(e00b1664)
ttylclose(e00b1664)
ptsclose(???)
ufs_close(???)
vn_close(???)
vno_close(???)
closef(???)
exit()
psig()
syscall(00000000, 0x00000054 = SYS_wait, 0x0e870020, 0x10005d88)
svc_call_c
The following are patches to sys/sys/tty.c. They should fix this bug. I have
been running a kernel with this version on my workstation for 3 months. The
diffs are relative to the RT sources, but the patched file should be put in
the common sources (it is a merge of RT and VAX sources).
Failure to include this patch will prevent dialup kernels from being built
with standard sources. Most of the changes are to #ifdef/#endif lines; there
aren't a lot of real changes to audit.
This is the RCS log of my changes:
RCS file: RCS/tty.c,v; Working file: tty.c
head: 1.4
branch:
locks: jfc: 1.4; strict
access list:
symbolic names:
comment leader: " * "
total revisions: 4; selected revisions: 4
description:
----------------------------
revision 1.4 locked by: jfc;
date: 90/04/09 01:07:39; author: jfc; state: Exp; lines added/del: 29/21
Merged with VAX version.
----------------------------
revision 1.3
date: 90/04/02 01:47:33; author: jfc; state: Exp; lines added/del: 3/3
ANSI cpp changes (CTRL macro).
----------------------------
revision 1.2
date: 90/04/02 01:26:45; author: jfc; state: Exp; lines added/del: 4/20
ANSI cpp changes; removed non-VFS support.
----------------------------
revision 1.1
date: 90/04/02 01:25:19; author: jfc; state: Exp;
Initial revision
=============================================================================
You won't want the change for version 1.3 until ttychars.h is updated. Here
is the diff:
*** /tmp/,RCSt1012002 Wed Jul 11 15:59:22 1990
--- /tmp/,RCSt2012002 Wed Jul 11 15:59:23 1990
***************
*** 1,15 ****
/*
- * 5799-CGZ (C) COPYRIGHT = NONE
- * LICENSED MATERIALS - PROPERTY OF IBM
- */
- /* $Header: /src/sys/athena/sys/RCS/tty.c,v 1.1 90/04/02 01:25:19 jfc Exp $ */
- /* $ACIS:tty.c 9.0$ */
- /* $Source: /src/sys/athena/sys/RCS/tty.c,v $ */
-
- #ifndef lint
- static char *rcsid = "$Header: /src/sys/athena/sys/RCS/tty.c,v 1.1 90/04/02 01:25:19 jfc Exp $";
- #endif
-
- /*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
--- 1,3 ----
***************
*** 18,21 ****
--- 6,12 ----
* @(#)tty.c 7.1 (Berkeley) 6/5/86
*/
+ #ifndef lint
+ static char *rcsid = "$Header: /src/sys/athena/sys/RCS/tty.c,v 1.4 90/04/09 01:07:39 jfc Exp Locker: jfc $";
+ #endif
#include "../machine/reg.h"
***************
*** 24,30 ****
#include "systm.h"
#include "user.h"
- #if !defined(NFS)
- #include "dir.h"
- #endif
#include "ioctl.h"
#include "tty.h"
--- 15,18 ----
***************
*** 31,39 ****
#include "proc.h"
#include "text.h"
- #if defined(NFS)
#include "vnode.h"
- #else
- #include "inode.h"
- #endif
#include "file.h"
#include "conf.h"
--- 19,23 ----
***************
*** 44,48 ****
#ifdef ibm032
#include "../machinecons/screen_conf.h"
! #endif ibm032
#include "vm.h"
--- 28,37 ----
#ifdef ibm032
#include "../machinecons/screen_conf.h"
! #define CONSIOCTL
! #else
! #ifdef CONSIOCTL
! extern struct tty *cons_tp;
! #endif
! #endif
#include "vm.h"
***************
*** 158,162 ****
while ((tp->t_outq.c_cc || tp->t_state&TS_BUSY) &&
! tp->t_state&TS_CARR_ON) {
(*tp->t_oproc)(tp);
tp->t_state |= TS_ASLEEP;
--- 147,151 ----
while ((tp->t_outq.c_cc || tp->t_state&TS_BUSY) &&
! tp->t_state&TS_CARR_ON && tp->t_oproc) {
(*tp->t_oproc)(tp);
tp->t_state |= TS_ASLEEP;
***************
*** 271,277 ****
int s;
register int newflags;
! #ifdef ibm032
register struct tty *save_cons_tp = 0;
! #endif ibm032
/*
--- 260,266 ----
int s;
register int newflags;
! #ifdef CONSIOCTL
register struct tty *save_cons_tp = 0;
! #endif
/*
***************
*** 324,332 ****
if (t != tp->t_line) {
s = spltty();
! #ifdef ibm032
! if (cons_tp == tp) {
save_cons_tp = cons_tp;
! }
! #endif ibm032
(*linesw[tp->t_line].l_close)(tp);
error = (*linesw[t].l_open)(dev, tp);
--- 313,320 ----
if (t != tp->t_line) {
s = spltty();
! #ifdef CONSIOCTL
! if (cons_tp == tp)
save_cons_tp = cons_tp;
! #endif
(*linesw[tp->t_line].l_close)(tp);
error = (*linesw[t].l_open)(dev, tp);
***************
*** 336,343 ****
return (error);
}
! #ifdef ibm032
if (save_cons_tp)
cons_tp = save_cons_tp;
! #endif ibm032
tp->t_line = t;
splx(s);
--- 324,331 ----
return (error);
}
! #ifdef CONSIOCTL
if (save_cons_tp)
cons_tp = save_cons_tp;
! #endif
tp->t_line = t;
splx(s);
***************
*** 527,531 ****
break;
! #ifndef FULL4.3
case TIOCSPGRP:
tp->t_pgrp = *(int *)data;
--- 515,519 ----
break;
! #if defined(ibm032) && !defined(FULL4_3)
case TIOCSPGRP:
tp->t_pgrp = *(int *)data;
***************
*** 588,592 ****
}
! #ifdef ibm032
/* Set current console device to this line */
case TIOCCONS:
--- 576,580 ----
}
! #ifdef CONSIOCTL
/* Set current console device to this line */
case TIOCCONS:
***************
*** 593,597 ****
cons_tp = tp;
break;
! #endif ibm032
default:
--- 581,585 ----
cons_tp = tp;
break;
! #endif
default:
***************
*** 703,710 ****
{
! #ifdef ibm032
if (cons_tp == tp)
cons_tp = (struct tty *)0;
! #endif ibm032
ttyflush(tp, FREAD|FWRITE);
tp->t_pgrp = 0;
--- 691,698 ----
{
! #ifdef CONSIOCTL
if (cons_tp == tp)
cons_tp = (struct tty *)0;
! #endif
ttyflush(tp, FREAD|FWRITE);
tp->t_pgrp = 0;
***************
*** 834,838 ****
#else
ttyecho(c, tp);
! #endif ibm032
}
goto endcase;
--- 822,826 ----
#else
ttyecho(c, tp);
! #endif
}
goto endcase;
***************
*** 936,940 ****
if (tp->t_outq.c_cc < TTHIWAT(tp) &&
tp->t_line == NTTYDISC)
! (void) ttyoutput(CTRL(g), tp);
} else if (putc(c, &tp->t_rawq) >= 0) {
ttwakeup(tp);
--- 924,928 ----
if (tp->t_outq.c_cc < TTHIWAT(tp) &&
tp->t_line == NTTYDISC)
! (void) ttyoutput(CTRL('g'), tp);
} else if (putc(c, &tp->t_rawq) >= 0) {
ttwakeup(tp);
***************
*** 944,948 ****
#else
ttyecho(c, tp);
! #endif ibm032
}
goto endcase;
--- 932,936 ----
#else
ttyecho(c, tp);
! #endif
}
goto endcase;
***************
*** 1019,1023 ****
if (tp->t_rawq.c_cc+tp->t_canq.c_cc >= TTYHOG) {
if (tp->t_line == NTTYDISC)
! (void) ttyoutput(CTRL(g), tp);
goto endcase;
}
--- 1007,1011 ----
if (tp->t_rawq.c_cc+tp->t_canq.c_cc >= TTYHOG) {
if (tp->t_line == NTTYDISC)
! (void) ttyoutput(CTRL('g'), tp);
goto endcase;
}
***************
*** 1185,1190 ****
c = 6;
}
! } else if (ctype == 2) /* vt05 */
c = mstohz(100);
*colp = 0;
break;
--- 1173,1183 ----
c = 6;
}
! } else if (ctype == 2) { /* vt05 */
c = mstohz(100);
+ } else if (ctype == 3) { /* vt100 */
+ int i;
+ for (i = 0;i < 4;i++)
+ (void) putc(0, &tp->t_outq);
+ }
*colp = 0;
break;
***************
*** 1367,1371 ****
}
-
/*
* Check the output queue on tp for space for a kernel message
--- 1360,1363 ----
***************
*** 1920,1924 ****
#else
pcpu = pcpu + (float)p->p_pctcpu;
! #endif ibm032
size += p->p_tsize + p->p_ssize + p->p_dsize;
rss += p->p_rssize;
--- 1912,1916 ----
#else
pcpu = pcpu + (float)p->p_pctcpu;
! #endif
size += p->p_tsize + p->p_ssize + p->p_dsize;
rss += p->p_rssize;