[PATCH] shmat() and CONFIG_STACK_GROWSUP

Helge Deller <[email protected]>
Newsgroups gmane.linux.ports.hppa
Message-ID <[email protected]>
I think this patch for the shmat() is obviously correct for our stack (which grows up).
Basically we gain a small region of 4 Pages in which shmat() may map memory.

Ok ?
If yes, should I commit or send to linux-kernel mailing list ?

Helge

diff --git a/ipc/shm.c b/ipc/shm.c
index 6d16bb6..f5cc635 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -852,6 +852,7 @@ long do_shmat(int shmid, char __user *sh
 		user_addr = ERR_PTR(-EINVAL);
 		if (find_vma_intersection(current->mm, addr, addr + size))
 			goto invalid;
+#ifndef CONFIG_STACK_GROWSUP
 		/*
 		 * If shm segment goes below stack, make sure there is some
 		 * space left for the stack to grow (at least 4 pages).
@@ -859,6 +860,7 @@ long do_shmat(int shmid, char __user *sh
 		if (addr < current->mm->start_stack &&
 		    addr > current->mm->start_stack - size - PAGE_SIZE * 5)
 			goto invalid;
+#endif
 	}
 		
 	user_addr = (void*) do_mmap (file, addr, size, prot, flags, 0);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.