Subject: Inode flags,Network device probe,MSCP dump, netbind bugs (#216) Index: sys/ufs_alloc,pdp/net_xxx.s,pdpuba/ra.c,conf/netbind.c 2.11BSD Description: 1) The inode flags (i_flags) word was not being cleared when an inode was reused (to create a new file). 2) The routine used by the networking code to probe for the existence of a networking interface would use a 'byte' rather than a 'word' reference. 3) ra_error() was called from the MSCP crashdump routine with the wrong number of arguments. 4) The program which resolves symbols between the kernel and network images truncated undefined symbols to 8 characters. Repeat-By: 1) Set the 'nodump' flag on a file. Remove that file. Create a new file on the same filesystem. Note that the new file still has the 'nodump' flag set. 2) Observation. This was seen in the process of trying to get an Interlan ethernet card working on a 11/44. 3) Have a crash with the dump device being a MSCP device. Not the strange looking numbers reported when the crashdump finishes. 4) Have an undefined symbol longer than 8 characters when linking a new unix+netnix set. The symbol name will be truncated. Fix: The following files are updated by the enclosed patch: /usr/src/sys/sys/ufs_alloc.c /usr/src/sys/pdp/net_xxx.s /usr/src/sys/pdpuba/ra.c /usr/src/sys/conf/netbind.c /VERSION 1) The inode flags word was not being cleared in ufs_alloc.c when an inode was reused on the filesystem. This was accidentally overlooked when the 'chflags()' syscall was added recently. Also, 14 bytes of D space were saved by using a common string for the 'out of inode' error messages. Every byte counts. 2) This may or may not be the problem with using an Interlan ethercard on a 11/44 (there is another fatal flaw in the if_il.c driver - I am waiting to release the new driver until it is known to work or the problem is shown to not be in the driver). Making a byte ('tstb') reference to a word address can cause problems with some devices. In any event the code in net_xxx.s is wrong, and if 'badaddr()' were ever called with an odd length parameter the networking code would crash. 3) The MSCP crashdump routine radump() calls 'ra_error()' with an extra argument. This was spotted after forcing a crash to make sure the crashdump/autoboot logic was still working correctly. 4) I made a typographical error when making a change and had a undefined symbol. 'netbind' truncated it to 8 characters even though the 8 character limit was rescinded a year ago. There was a lingering "%.8s" in netbind.c To apply this patch: 1) Save the following to a file (/tmp/foo) 2) patch -p0 < /tmp/foo 3) Recompile your kernel (it is not stricly necessary to do a 'make clean' first in this case but it would not hurt anything). Install the new kernel and reboot. 4) (optional). You may wish to recompile the GENERIC kernel at this time. cd /sys/GENERIC make clean make mv unix /genunix This is a handy file to keep around. If /unix or /netnix become corrupted or accidentally deleted you can still reboot the system using 'genunix'. As always, previous updates and patches are available via anonymous FTP to "ftp.iipo.gtegsc.com" in the directory /pub/2.11BSD. =============cut here=============== *** /usr/src/sys/sys/ufs_alloc.c.old Sun Apr 8 03:12:13 1990 --- /usr/src/sys/sys/ufs_alloc.c Wed Jan 11 20:07:49 1995 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ufs_alloc.c 1.1 (2.10BSD Berkeley) 12/1/86 */ #include "param.h" --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ufs_alloc.c 1.2 (2.11BSD GTE) 1/11/94 */ #include "param.h" *************** *** 103,109 **** * SHOULD RATHER SEND A SIGNAL AND SUSPEND THE PROCESS IN A * STATE FROM WHICH THE SYSTEM CALL WILL RESTART */ ! uprintf("\n%s: write failed, file system is full\n", fs->fs_fsmnt); { register int i; --- 103,109 ---- * SHOULD RATHER SEND A SIGNAL AND SUSPEND THE PROCESS IN A * STATE FROM WHICH THE SYSTEM CALL WILL RESTART */ ! uprintf("\n%s: write failed, file system full\n", fs->fs_fsmnt); { register int i; *************** *** 136,141 **** --- 136,142 ---- ino_t inobas; int first; struct inode *ifind(); + char *emsg = "no inodes free"; fs = pip->i_fs; while (fs->fs_ilock) *************** *** 157,162 **** --- 158,164 ---- return(NULL); if (ip->i_mode == 0) { bzero((caddr_t)ip->i_addr,sizeof(ip->i_addr)); + ip->i_flags = 0; fs->fs_fmod = 1; fs->fs_tinode--; return(ip); *************** *** 217,224 **** wakeup((caddr_t)&fs->fs_ilock); if (fs->fs_ninode > 0) goto loop; ! fserr(fs, "out of inodes"); ! uprintf("\n%s: create/symlink failed, no inodes free\n", fs->fs_fsmnt); u.u_error = ENOSPC; return(NULL); } --- 219,226 ---- wakeup((caddr_t)&fs->fs_ilock); if (fs->fs_ninode > 0) goto loop; ! fserr(fs, emsg); ! uprintf("\n%s: create/symlink failed, %s\n", fs->fs_fsmnt, emsg); u.u_error = ENOSPC; return(NULL); } *** /usr/src/sys/pdp/net_xxx.s.old Thu Oct 15 21:22:28 1992 --- /usr/src/sys/pdp/net_xxx.s Thu Jan 12 20:32:37 1995 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)net_xxx.s 1.2 (2.11BSD GTE) 10/15/92 */ #include "DEFS.h" --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)net_xxx.s 1.3 (2.11BSD GTE) 1/12/95 */ #include "DEFS.h" *************** *** 46,53 **** * * See if accessing addr with a len type instruction causes a memory fault. * Len is length os access (1=byte, 2=short, 4=long). Returns 0 if the ! * address is OK, -1 on error. if the address is odd, and make sure that ! * the address is valid. */ ENTRY(badaddr) mov PS,-(sp) / save current PS and set previous --- 46,53 ---- * * See if accessing addr with a len type instruction causes a memory fault. * Len is length os access (1=byte, 2=short, 4=long). Returns 0 if the ! * address is OK, -1 on error. If either the address or length is odd use ! * a byte test rather than a word test. */ ENTRY(badaddr) mov PS,-(sp) / save current PS and set previous *************** *** 55,62 **** mfpd *$nofault / save current nofault and set up mov $4f,-(sp) / our own trap mtpd *$nofault ! cmp 10(sp),$1 / len == 1?? ! beq 1f tstb *6(sp) / yes, just do a tstb on the address br 2f 1: --- 55,64 ---- mfpd *$nofault / save current nofault and set up mov $4f,-(sp) / our own trap mtpd *$nofault ! mov 10(sp),r0 / if the low bit of either the length ! bis 6(sp),r0 / or address is ! asr r0 / on then use a tstb ! bcc 1f / br if word test to be used tstb *6(sp) / yes, just do a tstb on the address br 2f 1: *** /usr/src/sys/pdpuba/ra.c.old Sat Jan 2 23:09:46 1993 --- /usr/src/sys/pdpuba/ra.c Wed Jan 11 20:58:31 1995 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ra.c 2.4 (2.11BSD GTE) 1/2/93 */ /*********************************************************************** --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)ra.c 2.5 (2.11BSD GTE) 1/11/95 */ /*********************************************************************** *************** *** 14,19 **** --- 14,22 ---- /* * ra.c - MSCP Driver + * Date: Jan 11, 1995 + * Remove extra parameter to ra_error() call in radump(). + * * Date: Dec 1992, Jan 1993 * Add the partition size routine. Remove unibus map ifdefs, the run time * check for 'ubmap' is sufficient and does the right thing. *************** *** 1343,1349 **** sc->sc_com->ra_ca.ca_cmdint = 0; if (rmp->m_opcode != (op | M_O_END) || (rmp->m_status & M_S_MASK) != M_S_SUCC) { ! ra_error(unit, rmp); return(0); } return(rmp); --- 1346,1352 ---- sc->sc_com->ra_ca.ca_cmdint = 0; if (rmp->m_opcode != (op | M_O_END) || (rmp->m_status & M_S_MASK) != M_S_SUCC) { ! ra_error(rmp); return(0); } return(rmp); *** /usr/src/sys/conf/netbind.c.old Sun Jan 9 13:49:20 1994 --- /usr/src/sys/conf/netbind.c Fri Jan 6 22:00:16 1995 *************** *** 1,6 **** --- 1,7 ---- /* * netbind * + * 1/6/95 -- remove 8 character limit on undefined symbol printf. sms. * 1/8/94 -- revised for new object file format. sms. * * Resolve undefined inter-address-space references. *************** *** 282,288 **** qsort(symtab, symfree - symtab, sizeof(struct symbol), scmp); for (sp = symtab; sp < symfree; sp++) if ((sp->s_type & N_TYPE) == N_UNDF) ! printf("%.8s\n", sp->s_name); } scmp(s1, s2) --- 283,289 ---- qsort(symtab, symfree - symtab, sizeof(struct symbol), scmp); for (sp = symtab; sp < symfree; sp++) if ((sp->s_type & N_TYPE) == N_UNDF) ! printf("%s\n", sp->s_name); } scmp(s1, s2) *** /VERSION.old Thu Jan 5 20:09:47 1995 --- /VERSION Thu Jan 12 20:33:02 1995 *************** *** 1,4 **** ! Current Patch Level: 215 2.11 BSD ============ --- 1,4 ---- ! Current Patch Level: 216 2.11 BSD ============