[net.unix-wizards] /dev screwed up

TXR@USC-ECL@sri-unix (08/07/82)

From:   Tim Rentsch <txr@ECLA>
Date: 19 Jul 1982 1737-PDT
We have experienced a problem with /dev getting screwed up a
couple times now.  One time the symptom was that /dev/tty was an
ordinary file, with logins not working (login reads the password
from /dev/tty, which being an ordinary file simply returns
whatever garbage is in the file).  Another time /dev was really
messed up, we had to rebuild Unix from the distribution tape to
get back on the air again.  Has anyone else been having these
problems, or (better yet) tell me how to solve them?

Tim Rentsch

news@sri-unix (08/19/82)

From: greep at RAND-UNIX
Remailed-date: 18 Aug 1982 1920-PDT
Remailed-from: the tty of Geoffrey S. Goodfellow  <Geoff5 at SRI-CSL>
Remailed-to: Unix-Wizards@SRI-CSL: ;
Via:  Sri-Csl; 18 Aug 82 21:49-PDT

Date: Sunday,  8 Aug 1982 00:39-PDT
Make sure /dev is write-protected.  Otherwise a common problem is
a program that asks the user for some file name to output to and
then deletes the file (say because it encountered an error which
would make the data useless, or because it is supposed to be
a temporary file).  If the user enters /dev/tty and /dev is writable,
that will do it.  The next user who tries writing to /dev/tty will
cause an ordinary file to be created.  The same goes for /dev/null,
/dev/mt*, etc.

Of course if you have users who do things like this while running
as super user, there's no hope.

cak@Purdue@sri-unix (08/19/82)

From: Chris Kent <cak at Purdue>
Date: 8 Aug 1982 16:14:44-EST
We saw this many times -- what we found (under 4.1bsd) was that a letter
got scribbled into /dev. It's from biff -- courtesy of the bugs in the
multiplexor. We fudged around the problem by moving /dev/mail to /tmp/mail;
it's much less traumatic to lose /tmp.

I have heard a rumour that Rob Pike (or someone associated with the Blit
terminal) has fixed the bugs in the 4.1 multiplexor, but can't release
it. That's really too bad -- even though it's going away with 4.2, it
causes a lot of problems for a lot of people right now. 

chris

rlb@Purdue@sri-unix (08/31/82)

From: Bob Brown <rlb at Purdue>
Date: 25 Aug 1982 23:58:02-EST
4.1BSD USERS ONLY!

All you sites out there that have suffered losing /dev, please disregard
Mike O'Dell's last letter.  Don't think that just turning off comsat is
going to save your file system from the inode reference-count error in
the multiplexor.  

Mike, a good reason to fix the multiplexor is because comsat is not the
only program that uses it.  Another is Gosling's emacs and others include
various windowing packages under investigation at several sites.
Mike Accetta and James Gosling at CMU have fixed two known problems with
the multiplexor and one of them caused the /dev screwup.

So, save your /dev if you can.  Mike Accetta is willing to send out
the changed mx2.c or you can get it here.  Do it - it slips in with
no trouble at all.

For you multiplexor hacks out there, try running this program
10 times:

	#include <stdio.h>
	#include <sys/mx.h>
	#define P(s) printf("s returns %d\n",s)
	char *mpxfile = "mpxfile";
	main()
	{
	        int i;
	        P(unlink(mpxfile));
	        P(mpx(mpxfile,0666));
	        if ( fork()==0 ) {
	                for ( i=0 ; i<20 ; i++ )
	                        close(i);
	                P(open(mpxfile,2));
	                exit(1);
	        }
	        sleep(2);
	        kill(getpid(),9);
	}

It tends to gobble up group[] table entries - never to be returned.
Type "echo groups,10/X | adb /vmunix /dev/kmem" after each run and
watch the table entries just go away (it also eats inode table entries).

About comsat:  I just changed it so if you say "biff b", you get a
polite little "beep" at your terminal when you get a new letter.  If
you tend to sit inside emacs all day or slide over to your desk to
do some "real" work for extended periods, the "set mail=(1" solution
just isn't adequate.  Changed biff.c and comsat.c are available for
the asking, too.

Bob Brown (rlb)
Purdue-CS (317)494-6530

PS Mike O'Dell, you forgot to FLAME OFF, you still OK?