lkml.org 
[lkml]   [1998]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectImportant - MM panic in 2.1.109 (and more)
1. I sent a similar report some time ago.. the panic still happens.
The problem is when unmapping the last part (but not all) of
a segment acquired by shmget + shmat. Ref count goes down to 0
and then the segment is reused!!
2. User canot see his own Shared Memory Segments using "ipcs".
(the user can remove them. They are only visible by root).

Itai
--
Itai Nahshon nahshon@actcom.co.il
Also nahshon@vnet.ibm.com#include <sys/types.h>
#include <fcntl.h>
#include <sys/ipc.h>
#include <sys/shm.h>

main() {
int shmid;
char *addr;

shmid = shmget(12342, 1024*1024, IPC_CREAT|0777);
if(shmid < 0) {
perror("shmget");
exit(0);
}

printf("shmid = %d\n", shmid);

addr = shmat(shmid, NULL, 0);

strcpy(addr, "Hello world! test1");

if (shmctl(shmid, IPC_RMID, NULL) < 0) {
perror("shmctl IPC_RMID");
exit(0);
}

strcpy(addr, "Hello world! test2");

/* Remove just the last 4K of the segment.
This will trigger the panic. */
if(munmap(addr+1024*1020, 1024*4) < 0) {
perror("munmap");
exit(0);
}

strcpy(addr, "Hello world! test3");

sleep(100);
}
\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.108 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site