Skip to content

Commit

Permalink
brk: check the lower bound properly
Browse files Browse the repository at this point in the history
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 <jkosina@suse.cz>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Jiri Kosina authored and Ingo Molnar committed Feb 6, 2008
1 parent 2d684cd commit 4cc6028
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down

0 comments on commit 4cc6028

Please sign in to comment.