kern/99758: chown/chmod pty slave side in kernel

Atsuo Ohki ohki at
Thu Jul 6 08:50:22 UTC 2006

The following reply was made to PR kern/99758; it has been noted by GNATS.

From: Atsuo Ohki <ohki at>
To: Robert Watson <rwatson at>
Cc: freebsd-gnats-submit at, freebsd-bugs at
Subject: Re: kern/99758: chown/chmod pty slave side in kernel
Date: Thu, 06 Jul 2006 17:42:20 +0900

 Robert Watson writes:
 > ...
 > The tty_pts implementation in 7-CURRENT does the same, except more so, by 
 > forcing revocation of the pty on last close.  Unfortunately, this triggers 
 > bugs in devfs.  Your help in getting the 7.x pts implementation up and runnin
 > g 
 > would be much appreciated.  Take a look at src/sys/kern/tty_pts.c.
  Thank you for interested in my patch.
  I don't have a machine to run 7-current now,
  so just read `src/sys/kern/tty_pts.c'.
  Is make_dev()/destroy_dev() problem specific to pts implementaition?
  What happens when destroy_devl() of src/sys/kern/kern_conf.c is modified as
 --- kern_conf.c	Thu Jul  6 17:11:27 2006
 +++ kern_conf.c	Thu Jul  6 17:38:51 2006
 @@ -682,6 +682,10 @@
  	dev->si_flags &= ~SI_ALIAS;
 +	if (dev->si_refcount == 0 && dev->si_priv->cdp_inuse > 0) {
 +		/* devfs_populate_loop() will free this cdev structure */
 +		dev->si_refcount++;
 +	}
  	if (dev->si_refcount > 0) {
  		LIST_INSERT_HEAD(&dead_cdevsw.d_devs, dev, si_list);
  	} else {
  I suspect the situation that the cdev structure is freed
  while it is referred to by devfs.

More information about the freebsd-bugs mailing list