Subject: Wierd SYSV SHM behavior
To: None <tech-kern@NetBSD.ORG>
From: Sujal Patel <smpatel@wam.umd.edu>
List: tech-kern
Date: 04/19/1995 20:30:35
I've noticed a wierd behavior with NetBSD's SYSV shared memory 
implementation.  It seems that SHM segments that are created world 
writable/readable (666), can only be accessed by the user that created the 
segment.

For example:

Run by UID 100:
     shmid = shmget(shmemKey, sizeof(struct memory), IPC_CREAT | 0666);
     sharedMemory = (struct memory *) shmat(shmid, (char *) 0, 0);

Run by UID 101:
     if ((shmid = shmget (key, sizeof (struct memory), 666 )) < 0) {
         perror("shmget");
         exit(1);
     }



At this point, UID 101 will get "shmget: Operation not permitted".  The 
second code segment does succeed if it is run by UID 101.  Both FreeBSD 
and SunOS will allow any user to access a segment created world 
readable/writeable.

Was this an implementation decision in NetBSD to disallow multiple users 
accessing one shared memory segment, a bug, or am I just completely missing 
something?

Thanks


Sujal