The patch titled Don't allow the stack to grow into hugetlb reserved regions has been added to the -mm tree. Its filename is dont-allow-the-stack-to-grow-into-hugetlb-reserved-regions.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Don't allow the stack to grow into hugetlb reserved regions From: Adam Litke <agl@xxxxxxxxxx> When expanding the stack, we don't currently check if the VMA will cross into an area of the address space that is reserved for hugetlb pages. Subsequent faults on the expanded portion of such a VMA will confuse the low-level MMU code, resulting in an OOPS. Check for this. Signed-off-by: Adam Litke <agl@xxxxxxxxxx> Cc: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> Cc: William Lee Irwin III <wli@xxxxxxxxxxxxxx> Cc: Hugh Dickins <hugh@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- mm/mmap.c | 7 +++++++ 1 files changed, 7 insertions(+) diff -puN mm/mmap.c~dont-allow-the-stack-to-grow-into-hugetlb-reserved-regions mm/mmap.c --- a/mm/mmap.c~dont-allow-the-stack-to-grow-into-hugetlb-reserved-regions +++ a/mm/mmap.c @@ -1477,6 +1477,7 @@ static int acct_stack_growth(struct vm_a { struct mm_struct *mm = vma->vm_mm; struct rlimit *rlim = current->signal->rlim; + unsigned long new_start; /* address space limit tests */ if (!may_expand_vm(mm, grow)) @@ -1496,6 +1497,12 @@ static int acct_stack_growth(struct vm_a return -ENOMEM; } + /* Check to ensure the stack will not grow into a hugetlb-only region */ + new_start = (vma->vm_flags & VM_GROWSUP) ? vma->vm_start : + vma->vm_end - size; + if (is_hugepage_only_range(vma->vm_mm, new_start, size)) + return -EFAULT; + /* * Overcommit.. This must be the final test, as it will * update security statistics. _ Patches currently in -mm which might be from agl@xxxxxxxxxx are dont-allow-the-stack-to-grow-into-hugetlb-reserved-regions.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