linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fix size check for hugetlbfs
@ 2007-08-08  5:44 Benjamin Herrenschmidt
  2007-08-13 23:26 ` patch powerpc-fix-size-check-for-hugetlbfs.patch queued to -stable tree gregkh
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2007-08-08  5:44 UTC (permalink / raw)
  To: linuxppc-dev list; +Cc: Paul Mackerras, stable

My "slices" address space management code that was added in 2.6.22
implementation of get_unmapped_area() doesn't properly check that the
size is a multiple of the requested page size. This allows userland to
create VMAs that aren't a multiple of the huge page size with hugetlbfs
(since hugetlbfs entirely relies on get_unmapped_area() to do that
checking) which leads to a kernel BUG() when such areas are torn down.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

This should go to 2.6.22.x stable in addition to current 2.6.23-*

Index: linux-work/arch/powerpc/mm/slice.c
===================================================================
--- linux-work.orig/arch/powerpc/mm/slice.c	2007-08-08 15:16:06.000000000 +1000
+++ linux-work/arch/powerpc/mm/slice.c	2007-08-08 15:16:41.000000000 +1000
@@ -405,6 +405,8 @@ unsigned long slice_get_unmapped_area(un
 
 	if (len > mm->task_size)
 		return -ENOMEM;
+	if (len & ((1ul << pshift) - 1))
+		return -EINVAL;
 	if (fixed && (addr & ((1ul << pshift) - 1)))
 		return -EINVAL;
 	if (fixed && addr > (mm->task_size - len))

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-08-16  3:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08  5:44 [PATCH] powerpc: Fix size check for hugetlbfs Benjamin Herrenschmidt
2007-08-13 23:26 ` patch powerpc-fix-size-check-for-hugetlbfs.patch queued to -stable tree gregkh
2007-08-14  6:45   ` David Gibson
2007-08-14  7:48     ` David Gibson
2007-08-16  3:53       ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).