summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-03-16 15:10:45 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-03-16 15:10:45 -0800
commit9c6d7e9227b83c85b268369af828d01d5b69cfec (patch)
tree3c0ac0d96ea7badfb9d1bf03d5f9ce7655dd9134
parent289b0e41fbcde9706029d39934c3f259d08eeeef (diff)
[PATCH] SHMLBA compat task alignment fix
From: Arun Sharma <arun.sharma@intel.com> The current Linux implementation of shmat() insists on SHMLBA alignment even when shmflg & SHM_RND == 0. This is not consistent with the man pages and the single UNIX spec, which require only a page-aligned address. However, some architectures require a SHMLBA alignment for correctness in all cases. Such architectures use __ARCH_FORCE_SHMLBA.
-rw-r--r--include/asm-mips/shmparam.h2
-rw-r--r--include/asm-parisc/shmparam.h2
-rw-r--r--include/asm-sparc/shmparam.h2
-rw-r--r--include/asm-sparc64/shmparam.h1
-rw-r--r--ipc/shm.c5
5 files changed, 11 insertions, 1 deletions
diff --git a/include/asm-mips/shmparam.h b/include/asm-mips/shmparam.h
index 305a08b6b645..09290720751c 100644
--- a/include/asm-mips/shmparam.h
+++ b/include/asm-mips/shmparam.h
@@ -6,6 +6,8 @@
#ifndef _ASM_SHMPARAM_H
#define _ASM_SHMPARAM_H
+#define __ARCH_FORCE_SHMLBA 1
+
#define SHMLBA 0x40000 /* attach addr a multiple of this */
#endif /* _ASM_SHMPARAM_H */
diff --git a/include/asm-parisc/shmparam.h b/include/asm-parisc/shmparam.h
index 98a56edda4de..628ddc22faa8 100644
--- a/include/asm-parisc/shmparam.h
+++ b/include/asm-parisc/shmparam.h
@@ -1,6 +1,8 @@
#ifndef _ASMPARISC_SHMPARAM_H
#define _ASMPARISC_SHMPARAM_H
+#define __ARCH_FORCE_SHMLBA 1
+
#define SHMLBA 0x00400000 /* attach addr needs to be 4 Mb aligned */
#endif /* _ASMPARISC_SHMPARAM_H */
diff --git a/include/asm-sparc/shmparam.h b/include/asm-sparc/shmparam.h
index 69ba79a8f45a..bb93a6f74a38 100644
--- a/include/asm-sparc/shmparam.h
+++ b/include/asm-sparc/shmparam.h
@@ -2,6 +2,8 @@
#ifndef _ASMSPARC_SHMPARAM_H
#define _ASMSPARC_SHMPARAM_H
+#define __ARCH_FORCE_SHMLBA 1
+
extern int vac_cache_size;
#define SHMLBA (vac_cache_size ? vac_cache_size : \
(sparc_cpu_model == sun4c ? (64 * 1024) : \
diff --git a/include/asm-sparc64/shmparam.h b/include/asm-sparc64/shmparam.h
index 97c667e7c0e4..8c66fded8a32 100644
--- a/include/asm-sparc64/shmparam.h
+++ b/include/asm-sparc64/shmparam.h
@@ -4,6 +4,7 @@
#include <asm/spitfire.h>
+#define __ARCH_FORCE_SHMLBA 1
/* attach addr a multiple of this */
#define SHMLBA ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE)
diff --git a/ipc/shm.c b/ipc/shm.c
index d7d932d6dea5..9721b42ec9d8 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -656,7 +656,10 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
if (shmflg & SHM_RND)
addr &= ~(SHMLBA-1); /* round down */
else
- return -EINVAL;
+#ifndef __ARCH_FORCE_SHMLBA
+ if (addr & ~PAGE_MASK)
+#endif
+ return -EINVAL;
}
flags = MAP_SHARED | MAP_FIXED;
} else {