bug in /etc/dmesg (4.2 BSD, VAX 11/750)

RSanders at usgs2-multics.arpa RSanders at usgs2-multics.arpa
Fri Feb 14 05:02:34 AEST 1986


Date: Wed Feb 12 22:48:04 PST 1986
To: 4BSD-BUGS at BERKELY.ARPA
From: RSanders at DENVER.ARPA
Subject: bug in /etc/dmesg (4.2 BSD, VAX 11/750)
Index: /usr/src/etc/dmesg.c   4.2 (Berkeley) 83/01/02

Description:
  If the kernal msgbuf area gets to be exactly 4088 bytes long
(i.e. the declared length of the buffer), dmesg marches off into
oblivion, eventually core dumping.  In the process, /usr/adm/messages
grew about 500 Kb in 8 hours.

Repeat-By:
  Hah!  This is the first time I've seen this happen in 1 year
of running 4.2 BSD, with plenty of kernal errors being reported.
You might be able to repeat the problem by judicious banging on
tape drives.  That's how I got it to stop, before installing fix.

Fix:
  This fix is untested.  Looks like same problem could happen if
/usr/adm/msgbuf gets to be exactly 4088 bytes, so that fix is thrown in
too.  There's got to be a better fix.

*** /usr/src/etc/dmesg.c      Wed Feb 12 22:41:47 1986
--- /usr/src/etc/dmesg.c.old  Sun Jan  2 14:56:43 1983
***************
*** 67,73
                              printf("...\n");
                              break;
                    }
!                   if (mp >= &msgbuf.msg_bufc[MSG_BSIZE])
                              mp = msgbuf.msg_bufc;
                    if (omp >= &omesg.msg_bufc[MSG_BSIZE])
                              omp = omesg.msg_bufc;

--- 67,73 -----
                              printf("...\n");
                              break;
                    }
!                   if (mp == &msgbuf.msg_bufc[MSG_BSIZE])
                              mp = msgbuf.msg_bufc;
                    if (omp == &omesg.msg_bufc[MSG_BSIZE])
                              omp = omesg.msg_bufc;
***************
*** 69,75
                    }
                    if (mp >= &msgbuf.msg_bufc[MSG_BSIZE])
                              mp = msgbuf.msg_bufc;
!                   if (omp >= &omesg.msg_bufc[MSG_BSIZE])
                              omp = omesg.msg_bufc;
          } while (mp != mstart);
          if (samef && omesg.msg_bufx == msgbuf.msg_bufx)

--- 69,75 -----
                    }
                    if (mp == &msgbuf.msg_bufc[MSG_BSIZE])
                              mp = msgbuf.msg_bufc;
!                   if (omp == &omesg.msg_bufc[MSG_BSIZE])
                              omp = omesg.msg_bufc;
          } while (mp != mstart);
          if (samef && omesg.msg_bufx == msgbuf.msg_bufx)



More information about the Comp.unix.wizards mailing list