summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2006-11-14 02:03:38 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-11-14 09:09:27 -0800
commitcb07c9a1864a8eac9f3123e428100d5b2a16e65a (patch)
treefadc568154bbe3c1466081b718e9638438c82c46
parent68589bc353037f233fe510ad9ff432338c95db66 (diff)
downloadtalos-op-linux-cb07c9a1864a8eac9f3123e428100d5b2a16e65a.tar.gz
talos-op-linux-cb07c9a1864a8eac9f3123e428100d5b2a16e65a.zip
[PATCH] hugetlb: check for brk() entering a hugepage region
Unlike mmap(), the codepath for brk() creates a vma without first checking that it doesn't touch a region exclusively reserved for hugepages. On powerpc, this can allow it to create a normal page vma in a hugepage region, causing oopses and other badness. Add a test to prevent this. With this patch, brk() will simply fail if it attempts to move the break into a hugepage reserved region. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Cc: Adam Litke <agl@us.ibm.com> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/mmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index bdace87d7c01..2526463c99a7 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1880,6 +1880,10 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
if ((addr + len) > TASK_SIZE || (addr + len) < addr)
return -EINVAL;
+ error = is_hugepage_only_range(current->mm, addr, len);
+ if (error)
+ return error;
+
flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
error = arch_mmap_check(addr, len, flags);
OpenPOWER on IntegriCloud