summaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2005-05-18 15:39:33 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-19 07:46:36 -0700
commit49a43876b935c811cfd29d8fe998a6912a1cc5c4 (patch)
treec7d7a187a2125518e655dfeadffd38156239ffc3 /mm/mmap.c
parent05d3794aa8bd3b2c9f7920a05003c331cdeb75c5 (diff)
downloadlinux-49a43876b935c811cfd29d8fe998a6912a1cc5c4.tar.gz
linux-49a43876b935c811cfd29d8fe998a6912a1cc5c4.tar.bz2
linux-49a43876b935c811cfd29d8fe998a6912a1cc5c4.zip
[PATCH] prevent NULL mmap in topdown model
Prevent the topdown allocator from allocating mmap areas all the way down to address zero. We still allow a MAP_FIXED mapping of page 0 (needed for various things, ranging from Wine and DOSEMU to people who want to allow speculative loads off a NULL pointer). Tested by Chris Wright. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 01f9793591f6..63df2d698414 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1244,7 +1244,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
addr = mm->free_area_cache;
/* make sure it can fit in the remaining address space */
- if (addr >= len) {
+ if (addr > len) {
vma = find_vma(mm, addr-len);
if (!vma || addr <= vma->vm_start)
/* remember the address as a hint for next time */
@@ -1266,7 +1266,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
/* try just below the current vma->vm_start */
addr = vma->vm_start-len;
- } while (len <= vma->vm_start);
+ } while (len < vma->vm_start);
/*
* A failed mmap() very likely causes application failure,