This (trivial) patch prevents the topdown allocator from allocating
mmap areas all the way down to address zero. It's not the prettiest
patch, so suggestions for improvement are welcome ;)
Signed-off-by: Rik van Riel <[email protected]>
--- linux-2.6.11/mm/mmap.c.nullptr 2005-05-17 23:07:26.000000000 -0400
+++ linux-2.6.11/mm/mmap.c 2005-05-17 23:18:53.000000000 -0400
@@ -1251,7 +1251,7 @@
addr = mm->free_area_cache;
/* make sure it can fit in the remaining address space */
- if (addr >= len) {
+ if (addr >= (len + mm->brk)) {
vma = find_vma(mm, addr-len);
if (!vma || addr <= vma->vm_start)
/* remember the address as a hint for next time */
@@ -1267,13 +1267,13 @@
* return with success:
*/
vma = find_vma(mm, addr);
- if (!vma || addr+len <= vma->vm_start)
+ if ((!vma || addr+len <= vma->vm_start) && addr > mm->brk)
/* remember the address as a hint for next time */
return (mm->free_area_cache = addr);
/* try just below the current vma->vm_start */
addr = vma->vm_start-len;
- } while (len <= vma->vm_start);
+ } while (len <= vma->vm_start && addr > mm->brk);
/*
* A failed mmap() very likely causes application failure,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]