+ hugetlb-check-for-brk-entering-a-hugepage-region.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     hugetlb: check for brk() entering a hugepage region
has been added to the -mm tree.  Its filename is
     hugetlb-check-for-brk-entering-a-hugepage-region.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: hugetlb: check for brk() entering a hugepage region
From: "'David Gibson'" <david@xxxxxxxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxxxx>
Cc: Adam Litke <agl@xxxxxxxxxx>
Cc: Hugh Dickins <hugh@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 mm/mmap.c |    4 ++++
 1 file changed, 4 insertions(+)

diff -puN mm/mmap.c~hugetlb-check-for-brk-entering-a-hugepage-region mm/mmap.c
--- a/mm/mmap.c~hugetlb-check-for-brk-entering-a-hugepage-region
+++ a/mm/mmap.c
@@ -1880,6 +1880,10 @@ unsigned long do_brk(unsigned long addr,
 	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);
_

Patches currently in -mm which might be from david@xxxxxxxxxxxxxxxxxxxxx are

hugetlb-prepare_hugepage_range-check-offset-too.patch
hugetlb-check-for-brk-entering-a-hugepage-region.patch
git-powerpc.patch
__unmap_hugepage_range-add-comment.patch
shared-page-table-for-hugetlb-page-v4.patch
htlb-forget-rss-with-pt-sharing.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux