4.1BSD exec() bug

Mike.Accetta at cmu-cs-ius Mike.Accetta at cmu-cs-ius
Sun Aug 14 10:43:34 AEST 1983


In 4.1BSD the getxfile() routine in module sys1.c contains a test against
executing a shareable text image which is open for writing.  In our version
of the system (and some others I've seen recently) the test line reads

	if (fp->f_inode == ip && (fp->f_flag&FWRITE)) {

while it should really be something like

	if (fp->f_count && fp->f_inode == ip && (fp->f_flag&FWRITE)) {

so that the file table entry is not considered when not in use.

The symptom of this bug is occasional mysterious and usually
non-repeatable "text file busy" error messages when trying to execute a
program.  These will occur whenever the system makes the check (which is
not necessarily very often given the preceding tests) and the
inode slot of the program was previously used for a file open for
writing and its corresponding entry in the file table has yet to be
reallocated.

This bug appears to have been fixed in versions of 4.1c I've seen.

			- Mike Accetta



More information about the Comp.unix.wizards mailing list