Return to BSD News archive
Newsgroups: comp.bugs.2bsd Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.mel.aone.net.au!grumpy.fl.net.au!news.webspan.net!newsfeeds.sol.net!feed1.news.erols.com!insync!uunet!in1.uu.net!165.254.2.52!news.new-york.net!wlbr!moe.2bsd.com!sms From: sms@moe.2bsd.com (Steven M. Schultz) Subject: ptys being left unclosed (#365) Organization: 2BSD, Simi Valley CA USA Message-ID: <E59ssI.GBu@moe.2bsd.com> Date: Sat, 8 Feb 1997 06:02:42 GMT Lines: 108 Xref: euryale.cc.adfa.oz.au comp.bugs.2bsd:735 Subject: ptys being left unclosed (#365) Index: sys/vfs_vnops.c 2.11BSD Description: ptys were being left stranded (unclosed). Repeat-By: rlogin to a 2.11 system at rev 364. Repeat. Notice that the pty allocated is always one higher. Eventually the system will run out and rlogind will not work. Fix: Sigh. I should take a day or two off and learn how to port code. In vn_closefile() failing to clear the f_data field of the file structure before calling 'closei' would cause the call to the driver close routine to be skipped. During the scan for aliases (multiple inodes can refer to the same special block or character device) the close routine of a device driver is not called if there are existing references outstanding. If the f_data field of the file structure being closed is not 0 then a premature return would be done. The fix is small but, alas, will require a rebuild of the kernel. With luck you will be able to do #363, 364 and 365 all at the same time and only rebuild the kernel once. Cut where indicated saving to a file (/tmp/365) and then: patch -p0 < /tmp/365 cd /sys/GENERIC make mv unix /genunix cd /sys/YOUR_KERNEL make make install reboot As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. ------------------------cut here---------------------- *** /sys/sys/vfs_vnops.c.old Fri Feb 7 12:28:04 1997 --- /sys/sys/vfs_vnops.c Fri Feb 7 21:33:27 1997 *************** *** 35,41 **** * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ! * @(#)vfs_vnops.c 8.14.2 (2.11BSD) 1997/2/7 */ #include <sys/param.h> --- 35,41 ---- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ! * @(#)vfs_vnops.c 8.14.3 (2.11BSD) 1997/2/7 */ #include <sys/param.h> *************** *** 209,218 **** vn_closefile(fp) register struct file *fp; { - register int error; register struct inode *ip = (struct inode *)fp->f_data; ! error = closei(ip, fp->f_flag); irele(ip); ! return(error); } --- 209,222 ---- vn_closefile(fp) register struct file *fp; { register struct inode *ip = (struct inode *)fp->f_data; ! /* ! * Need to clear the inode pointer in the file structure so that the ! * inode is not seen during the scan for aliases of character or block ! * devices in closei(). ! */ ! fp->f_data = (caddr_t)0; /* XXX */ irele(ip); ! return(closei(ip, fp->f_flag)); } *** /VERSION.old Thu Feb 6 22:43:10 1997 --- /VERSION Fri Feb 7 21:31:20 1997 *************** *** 1,4 **** ! Current Patch Level: 364 Date: February 6, 1997 2.11 BSD --- 1,4 ---- ! Current Patch Level: 365 Date: February 6, 1997 2.11 BSD