Re: HEADSUP: New pts code triggers panics on amd64 systems.

From: Giorgos Keramidas <keramida_at_ceid.upatras.gr>
Date: Wed, 8 Feb 2006 14:19:09 +0200
On 2006-02-08 13:06, Giorgos Keramidas <keramida_at_ceid.upatras.gr> wrote:
> On 2006-02-08 12:56, Giorgos Keramidas <keramida_at_ceid.upatras.gr> wrote:
> >On 2006-02-07 13:26, Robert Watson <rwatson_at_FreeBSD.org> wrote:
> >> Does the instability occur if kern.pts.enable=0, or only when
> >> kern.pts.enable=1?
> >
> > Both.  I rebuilt a kernel & userland from today's HEAD, and installed it
> > on a clean partition.  Both a GENERIC kernel and my own FLAME kernel
> > config (attached) were tested with kern.pts.enable=0 and kern.pts.enable=1.
>
> Attachment forgotten... naturally :)

I updated to HEAD and then reverted the tty_pts changes from src/sys
only, using the attached patch, but the problems of syscons are still
there :-/

%%%
Index: conf/files
===================================================================
--- conf/files	(revision 10)
+++ conf/files	(revision 11)
_at__at_ -1347,7 +1347,6 _at__at_
 kern/tty_conf.c			standard
 kern/tty_cons.c			standard
 kern/tty_pty.c			optional pty
-kern/tty_pts.c			optional pty
 kern/tty_subr.c			standard
 kern/tty_tty.c			standard
 kern/uipc_accf.c		optional inet
Index: kern/tty_pty.c
===================================================================
--- kern/tty_pty.c	(revision 10)
+++ kern/tty_pty.c	(revision 11)
_at__at_ -30,7 +30,7 _at__at_
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/tty_pty.c,v 1.145 2006/02/02 20:35:45 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/tty_pty.c,v 1.141 2006/01/10 09:19:09 phk Exp $");
 
 /*
  * Pseudo-teletype Driver
_at__at_ -107,7 +107,6 _at__at_
 	u_char	pt_ucntl;
 	struct tty *pt_tty;
 	struct cdev *devs, *devc;
-	int	pt_devs_open, pt_devc_open;
 	struct	prison *pt_prison;
 };
 
_at__at_ -133,6 +132,7 _at__at_
 static struct cdev *
 ptyinit(struct cdev *devc, struct thread *td)
 {
+	struct cdev *devs;
 	struct ptsc *pt;
 	int n;
 
_at__at_ -143,47 +143,19 _at__at_
 
 	devc->si_flags &= ~SI_CHEAPCLONE;
 
-	/*
-	 * Initially do not create a slave endpoint.
-	 */
 	pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO);
+	pt->devs = devs = make_dev_cred(&pts_cdevsw, n, td->td_ucred,
+	    UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32);
 	pt->devc = devc;
 
 	pt->pt_tty = ttyalloc();
 	pt->pt_tty->t_sc = pt;
-	devc->si_drv1 = pt;
-	devc->si_tty = pt->pt_tty;
+	devs->si_drv1 = devc->si_drv1 = pt;
+	devs->si_tty = devc->si_tty = pt->pt_tty;
+	pt->pt_tty->t_dev = devs;
 	return (devc);
 }
 
-static void
-pty_create_slave(struct ucred *cred, struct ptsc *pt, int n)
-{
-
-	pt->devs = make_dev_cred(&pts_cdevsw, n, cred, UID_ROOT, GID_WHEEL,
-	    0666, "tty%c%r", names[n / 32], n % 32);
-	pt->devs->si_drv1 = pt;
-	pt->devs->si_tty = pt->pt_tty;
-	pt->pt_tty->t_dev = pt->devs;
-}
-
-static void
-pty_destroy_slave(struct ptsc *pt)
-{
-
-	pt->pt_tty->t_dev = NULL;
-	destroy_dev(pt->devs);
-	pt->devs = NULL;
-}
-
-static void
-pty_maybe_destroy_slave(struct ptsc *pt)
-{
-
-	if (0 && pt->pt_devc_open == 0 && pt->pt_devs_open == 0)
-		pty_destroy_slave(pt);
-}
-
 /*ARGSUSED*/
 static	int
 ptsopen(struct cdev *dev, int flag, int devtype, struct thread *td)
_at__at_ -200,7 +172,7 _at__at_
 		ttyinitmode(tp, 1, 0);
 	} else if (tp->t_state & TS_XCLUDE && suser(td))
 		return (EBUSY);
-	else if (pt->pt_prison != td->td_ucred->cr_prison && suser(td))
+	else if (pt->pt_prison != td->td_ucred->cr_prison)
 		return (EBUSY);
 	if (tp->t_oproc)			/* Ctrlr still around. */
 		(void)ttyld_modem(tp, 1);
_at__at_ -213,32 +185,20 _at__at_
 			return (error);
 	}
 	error = ttyld_open(tp, dev);
-	if (error == 0) {
+	if (error == 0)
 		ptcwakeup(tp, FREAD|FWRITE);
-		pt->pt_devs_open = 1;
-	} else
-		pty_maybe_destroy_slave(pt);
 	return (error);
 }
 
 static	int
 ptsclose(struct cdev *dev, int flag, int mode, struct thread *td)
 {
-	struct ptsc *pti;
 	struct tty *tp;
 	int err;
 
 	tp = dev->si_tty;
-	pti = dev->si_drv1;
-
-	KASSERT(dev == pti->devs, ("ptsclose: dev != pti->devs"));
-
 	err = ttyld_close(tp, flag);
 	(void) tty_close(tp);
-
-	pti->pt_devs_open = 0;
-	pty_maybe_destroy_slave(pti);
-
 	return (err);
 }
 
_at__at_ -326,18 +286,12 _at__at_
 	pt->pt_flags = 0;
 	pt->pt_send = 0;
 	pt->pt_ucntl = 0;
-
-	if (!pt->devs)
-		pty_create_slave(td->td_ucred, pt, minor(dev));
-	pt->pt_devc_open = 1;
-
 	return (0);
 }
 
 static	int
 ptcclose(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
-	struct ptsc *pti = dev->si_drv1;
 	struct tty *tp;
 
 	tp = dev->si_tty;
_at__at_ -358,8 +312,6 _at__at_
 	}
 
 	tp->t_oproc = 0;		/* mark closed */
-	pti->pt_devc_open = 0;
-	pty_maybe_destroy_slave(pti);
 	return (0);
 }
 
%%%
Received on Wed Feb 08 2006 - 11:50:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:52 UTC