Commit e77414e0 authored by Al Viro's avatar Al Viro

fix broken aliasing checks for MAP_FIXED on sparc32, mips, arm and sh

We want addr - (pgoff << PAGE_SHIFT) consistently coloured...
Acked-by: default avatarPaul Mundt <lethal@linux-sh.org>
Acked-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent bb52d669
...@@ -54,7 +54,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -54,7 +54,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
* We enforce the MAP_FIXED case. * We enforce the MAP_FIXED case.
*/ */
if (flags & MAP_FIXED) { if (flags & MAP_FIXED) {
if (aliasing && flags & MAP_SHARED && addr & (SHMLBA - 1)) if (aliasing && flags & MAP_SHARED &&
(addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1))
return -EINVAL; return -EINVAL;
return addr; return addr;
} }
......
...@@ -93,7 +93,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -93,7 +93,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
* We do not accept a shared mapping if it would violate * We do not accept a shared mapping if it would violate
* cache aliasing constraints. * cache aliasing constraints.
*/ */
if ((flags & MAP_SHARED) && (addr & shm_align_mask)) if ((flags & MAP_SHARED) &&
((addr - (pgoff << PAGE_SHIFT)) & shm_align_mask))
return -EINVAL; return -EINVAL;
return addr; return addr;
} }
......
...@@ -54,7 +54,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -54,7 +54,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
/* We do not accept a shared mapping if it would violate /* We do not accept a shared mapping if it would violate
* cache aliasing constraints. * cache aliasing constraints.
*/ */
if ((flags & MAP_SHARED) && (addr & shm_align_mask)) if ((flags & MAP_SHARED) &&
((addr - (pgoff << PAGE_SHIFT)) & shm_align_mask))
return -EINVAL; return -EINVAL;
return addr; return addr;
} }
......
...@@ -45,7 +45,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi ...@@ -45,7 +45,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
/* We do not accept a shared mapping if it would violate /* We do not accept a shared mapping if it would violate
* cache aliasing constraints. * cache aliasing constraints.
*/ */
if ((flags & MAP_SHARED) && (addr & (SHMLBA - 1))) if ((flags & MAP_SHARED) &&
((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)))
return -EINVAL; return -EINVAL;
return addr; return addr;
} }
......
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