Commit 9c6d7e92 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent 289b0e41
......@@ -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 */
#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 */
......@@ -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) : \
......
......@@ -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)
......
......@@ -656,6 +656,9 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
if (shmflg & SHM_RND)
addr &= ~(SHMLBA-1); /* round down */
else
#ifndef __ARCH_FORCE_SHMLBA
if (addr & ~PAGE_MASK)
#endif
return -EINVAL;
}
flags = MAP_SHARED | MAP_FIXED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment