All of lore.kernel.org
 help / color / mirror / Atom feed
* Shared memory shmat/dt not working well in 2.5.x
@ 2002-10-01  9:52 Zlatko Calusic
  2002-10-01 13:07 ` Alessandro Suardi
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Zlatko Calusic @ 2002-10-01  9:52 UTC (permalink / raw)
  To: akpm, hugh; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1594 bytes --]

Hi, Andrew, Hugh & others.

Still having problems with Oracle on 2.5.x (it can't even be started),
I devoted some time trying to pinpoint where the problem is. Reading
many traces of Oracle, and rebooting a dozen times, I finally found
that the culprit is weird behaviour of shmat/shmdt functions in 2.5,
when combined with mprotect() calls. I wrote a simple test app
(attached) and I'm also appending output of it below (running on
2.4.19 & 2.5.39 kernels, see the difference).

Hopefully, somebody will know how to help resolve that issue, so I can
finally benchmark Oracle on 2.4 vs Oracle on 2.5. ;)

Best regards,


{2.4.19} % shm-bug
First shmat & protects done: 50000000
50000000-51000000 rw-s 00000000 00:04 327974932  /SYSV01478e7f (deleted)
51000000-51001000 r--s 01000000 00:04 327974932  /SYSV01478e7f (deleted)
51001000-51081000 rw-s 01001000 00:04 327974932  /SYSV01478e7f (deleted)
51081000-51082000 r--s 01081000 00:04 327974932  /SYSV01478e7f (deleted)
51082000-51083000 rw-s 01082000 00:04 327974932  /SYSV01478e7f (deleted)
Second shmat done: 50000000
50000000-51083000 rw-s 00000000 00:04 327974932  /SYSV01478e7f (deleted)

{2.5.39} % shm-bug
First shmat & protects done: 50000000
50000000-51000000 rw-s 00000000 00:06 2457614    /SYSV01478e7f (deleted)
51000000-51001000 r--s 00000000 00:06 2457614    /SYSV01478e7f (deleted)
51001000-51081000 rw-s 00001000 00:06 2457614    /SYSV01478e7f (deleted)
51081000-51082000 r--s 00001000 00:06 2457614    /SYSV01478e7f (deleted)
51082000-51083000 rw-s 00002000 00:06 2457614    /SYSV01478e7f (deleted)
shmat 2: Invalid argument


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: shm-bug.c --]
[-- Type: text/x-csrc, Size: 1190 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/mman.h>

#define SIZE 17313792

void xperror(char *error_string)
{
	perror(error_string);
	exit(EXIT_FAILURE);
}

int main(int argc, char **argv)
{
	int shmid, *addr;
	char buffer[64];

	if ((shmid = shmget(21466751, SIZE, IPC_CREAT | IPC_EXCL | 0640)) < 0)
		xperror("shmget");
	addr = (int *) shmat(shmid, (char *) 0x50000000, 0);
	if (addr == (int *) -1)
		xperror("shmat 1");
	if (mprotect((char *) 0x51000000, 4096, PROT_READ) < 0)
		xperror("mprotect 1");
	if (mprotect((char *) 0x51081000, 4096, PROT_READ) < 0)
		xperror("mprotect 2");
	printf("First shmat & protects done: %08lx\n", (unsigned long) addr);
	sprintf(buffer, "cat /proc/%d/maps | grep /SYSV", getpid());
	system(buffer);
	if (shmdt(addr) < 0)
		xperror("shmdt 1");
	addr = (int *) shmat(shmid, (char *) 0x50000000, 0);
	if (addr == (int *) -1) {
		perror("shmat 2");
		shmctl(shmid, IPC_RMID, NULL);
		exit(EXIT_FAILURE);
	}
	printf("Second shmat done: %08lx\n", (unsigned long) addr);
	system(buffer);
	if (shmdt(addr) < 0)
		xperror("shmdt 2");
	shmctl(shmid, IPC_RMID, NULL);
	exit(EXIT_SUCCESS);
}

[-- Attachment #3: Type: text/plain, Size: 12 bytes --]


-- 
Zlatko

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2002-10-08 15:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-01  9:52 Shared memory shmat/dt not working well in 2.5.x Zlatko Calusic
2002-10-01 13:07 ` Alessandro Suardi
2002-10-01 13:09 ` [PATCH] " Hugh Dickins
2002-10-01 13:28   ` Alessandro Suardi
2002-10-01 13:46     ` Zlatko Calusic
2002-10-01 14:51       ` Alessandro Suardi
2002-10-01 14:59         ` Zlatko Calusic
2002-10-02 18:45         ` Zlatko Calusic
2002-10-08 11:22           ` Zlatko Calusic
2002-10-08 11:38             ` Duncan Sands
2002-10-08 15:10               ` Zlatko Calusic
2002-10-08 15:25                 ` Duncan Sands
2002-10-01 13:37   ` Zlatko Calusic
2002-10-01 15:32 ` [PATCH] Oracle startup split_vma fix Hugh Dickins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.