exec()ing busy texts

utzoo!decvax!harpo!eagle!mhuxt!mhuxa!mhb5b!princeto!poo utzoo!decvax!harpo!eagle!mhuxt!mhuxa!mhb5b!princeto!poo
Thu Mar 31 23:35:16 AEST 1983


There is an old bug in the kernel, which some say had been fixed, but I
believe is still around (in 4.1bsd).  Try the following:
	see (or cat) /bin/who
As soon as this begins to print, hit the TSTP button (ususally ^Z).
Now try to run /bin/who.
Yup, the text file (which the "see" has open for reading) cannot be
executed.  Now try it on the file /bin/login.
Pretty nasty, eh?  In all likelihood, the above test would perform as stated,
with fairly serious implications.

If you feel up to it, inserting the following line into sys/sys1.c of the
kernel should fix the bug.  (Hopefully, this will get to Berkeley before
their next bug fix release).
301a
		    if (fp->f_count > 0) /* Check only if fp is allocated. --princeton!poo */

The line goes right before an "if" statement looking something like:
			if (fp->f_inode == ip && (fp->f_flag&FWRITE)) {
Which should check first to see that the file structure fp is allocated
(ie, has positive count).
I knew it, you're going to suggest this fix to your local guru now...
		--mhb5b!princeton!poo



More information about the Comp.bugs.4bsd.ucb-fixes mailing list