From: Andrea Arcangeli Subject: avoid silent stack overflow over the heap Patch-mainline: no References: SUSE44807 x Signed-off-by: Andrea Arcangeli Automatically created from "patches.suse/silent-stack-overflow" by xen-port-patches.py Index: head-2008-10-13/arch/x86/mm/fault-xen.c =================================================================== --- head-2008-10-13.orig/arch/x86/mm/fault-xen.c 2008-10-13 15:28:47.000000000 +0200 +++ head-2008-10-13/arch/x86/mm/fault-xen.c 2008-10-13 15:32:57.000000000 +0200 @@ -598,7 +598,7 @@ void __kprobes do_page_fault(struct pt_r { struct task_struct *tsk; struct mm_struct *mm; - struct vm_area_struct *vma; + struct vm_area_struct *vma, *prev_vma; unsigned long address; int write, si_code; int fault; @@ -748,7 +748,13 @@ again: if (address + 65536 + 32 * sizeof(unsigned long) < regs->sp) goto bad_area; } - if (expand_stack(vma, address)) + /* + * find_vma_prev is just a bit slower, because it cannot + * use the mmap_cache, so we run it only in the growsdown + * slow path and we leave find_vma in the fast path. + */ + find_vma_prev(current->mm, address, &prev_vma); + if (expand_stack(vma, address, prev_vma)) goto bad_area; /* * Ok, we have a good vm_area for this memory access, so