Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946267AbXBCCl2 (ORCPT ); Fri, 2 Feb 2007 21:41:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1946266AbXBCClS (ORCPT ); Fri, 2 Feb 2007 21:41:18 -0500 Received: from 216-99-217-87.dsl.aracnet.com ([216.99.217.87]:53378 "EHLO sous-sol.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946258AbXBCClI (ORCPT ); Fri, 2 Feb 2007 21:41:08 -0500 Message-Id: <20070203024436.187214000@sous-sol.org> References: <20070203023504.435051000@sous-sol.org> User-Agent: quilt/0.45-1 Date: Fri, 02 Feb 2007 18:35:47 -0800 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org, torvalds@linux-foundation.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, akpm@osdl.org, wli@holomorphy.com, agl@us.ibm.com, hugh@veritas.com, david@gibson.dropbear.id.au Subject: [patch 43/59] Dont allow the stack to grow into hugetlb reserved regions Content-Disposition: inline; filename=don-t-allow-the-stack-to-grow-into-hugetlb-reserved-regions.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1745 Lines: 52 -stable review patch. If anyone has any objections, please let us know. ------------------ From: Adam Litke 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 Cc: David Gibson Cc: William Lee Irwin III Cc: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Wright --- mm/mmap.c | 7 +++++++ 1 file changed, 7 insertions(+) --- linux-2.6.19.2.orig/mm/mmap.c +++ linux-2.6.19.2/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. -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/