diff options
author | Linus Torvalds <torvalds@osdl.org> | 2005-05-18 18:39:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-19 10:46:36 -0400 |
commit | 49a43876b935c811cfd29d8fe998a6912a1cc5c4 (patch) | |
tree | c7d7a187a2125518e655dfeadffd38156239ffc3 /mm/mmap.c | |
parent | 05d3794aa8bd3b2c9f7920a05003c331cdeb75c5 (diff) |
[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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1244,7 +1244,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | |||
1244 | addr = mm->free_area_cache; | 1244 | addr = mm->free_area_cache; |
1245 | 1245 | ||
1246 | /* make sure it can fit in the remaining address space */ | 1246 | /* make sure it can fit in the remaining address space */ |
1247 | if (addr >= len) { | 1247 | if (addr > len) { |
1248 | vma = find_vma(mm, addr-len); | 1248 | vma = find_vma(mm, addr-len); |
1249 | if (!vma || addr <= vma->vm_start) | 1249 | if (!vma || addr <= vma->vm_start) |
1250 | /* remember the address as a hint for next time */ | 1250 | /* 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, | |||
1266 | 1266 | ||
1267 | /* try just below the current vma->vm_start */ | 1267 | /* try just below the current vma->vm_start */ |
1268 | addr = vma->vm_start-len; | 1268 | addr = vma->vm_start-len; |
1269 | } while (len <= vma->vm_start); | 1269 | } while (len < vma->vm_start); |
1270 | 1270 | ||
1271 | /* | 1271 | /* |
1272 | * A failed mmap() very likely causes application failure, | 1272 | * A failed mmap() very likely causes application failure, |