Преглед на файлове

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 <jkosina@suse.cz>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Jiri Kosina преди 18 години
родител
ревизия
4cc6028d40
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      mm/mmap.c

+ 1 - 1
mm/mmap.c

@@ -245,7 +245,7 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
 
 
 	down_write(&mm->mmap_sem);
 	down_write(&mm->mmap_sem);
 
 
-	if (brk < mm->end_code)
+	if (brk < mm->start_brk)
 		goto out;
 		goto out;
 
 
 	/*
 	/*