Subject: port-pmax/2823: pmax misses initialization for SYSVSEM and SYSVMSG
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@aarhus1.uni-c.dk>
List: netbsd-bugs
Date: 10/09/1996 16:03:15
>Number:         2823
>Category:       port-pmax
>Synopsis:       pmax misses initialization for SYSVSEM and SYSVMSG
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct  9 06:35:00 1996
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
UNI-C
>Release:        1.2
>Environment:
	
System: NetBSD aarhus1.uni-c.dk 1.2 NetBSD 1.2 (AARHUS1) #15: Wed Oct 9 15:42:02 MET DST 1996 erik@aarhus1.uni-c.dk:/usr/src/sys/arch/pmax/compile/AARHUS1 pmax


>Description:
A kernel built with options SYSVSEM or SYSVMSG fails during boot with
panics caused by memory references outside of the valid range, probably
because uninitialized pointers are followed.
>How-To-Repeat:
>Fix:
The following fix to pmax/pmax/machdep.c was stolen from identical code
in machdep.c for i386 and mac68k.

If all ports use code like this, it might be cleaned up and moved to a
port-independent place, but here I just duplicate the code.

*** machdep.c.orig	Wed Oct  9 15:36:24 1996
--- machdep.c	Wed Oct  9 15:40:47 1996
***************
*** 66,71 ****
--- 66,77 ----
  #include <sys/sysctl.h>
  #include <sys/mount.h>
  #include <sys/syscallargs.h>
+ #ifdef SYSVMSG
+ #include <sys/msg.h>
+ #endif
+ #ifdef SYSVSEM
+ #include <sys/sem.h>
+ #endif
  #ifdef SYSVSHM
  #include <sys/shm.h>
  #endif
***************
*** 718,723 ****
--- 724,741 ----
  	valloc(swapmap, struct map, nswapmap = maxproc * 2);
  #ifdef SYSVSHM
  	valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
+ #endif
+ #ifdef SYSVSEM
+ 	valloc(sema, struct semid_ds, seminfo.semmni);
+ 	valloc(sem, struct sem, seminfo.semmns);
+ 	/* This is pretty disgusting! */
+ 	valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
+ #endif
+ #ifdef SYSVMSG
+ 	valloc(msgpool, char, msginfo.msgmax);
+ 	valloc(msgmaps, struct msgmap, msginfo.msgseg);
+ 	valloc(msghdrs, struct msg, msginfo.msgtql);
+ 	valloc(msqids, struct msqid_ds, msginfo.msgmni);
  #endif
  
  	/*

>Audit-Trail:
>Unformatted: