From: Jiri Kosina Date: Wed, 6 Feb 2008 21:39:44 +0000 (+0100) Subject: brk: check the lower bound properly X-Git-Tag: MMI-PSA29.97-13-9~36999^2~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4cc6028d4040f95cdb590a87db478b42b8be0508;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git brk: check the lower bound properly There is a check in sys_brk(), that tries to make sure that we do not underflow the area that is dedicated to brk heap. The check is however wrong, as it assumes that brk area starts immediately after the end of the code (+bss), which is wrong for example in environments with randomized brk start. The proper way is to check whether the address is not below the start_brk address. Signed-off-by: Jiri Kosina Signed-off-by: Ingo Molnar --- diff --git a/mm/mmap.c b/mm/mmap.c index bb4c963cc534..ad6e4eaf34f8 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -245,7 +245,7 @@ asmlinkage unsigned long sys_brk(unsigned long brk) down_write(&mm->mmap_sem); - if (brk < mm->end_code) + if (brk < mm->start_brk) goto out; /*