[PATCH] x86: Don't randomize stack unless current->personality permits it
From: Frank van Maarseveen
Date: Tue Jul 11 2006 - 11:20:24 EST
Do not randomize stack location unless current->personality permits it.
Signed-off-by: Frank van Maarseveen <frankvm@xxxxxxxxxxx>
---
The problem seems also present in
arch/um/kernel/process_kern.c
arch/x86_64/kernel/process.c
arch/i386/kernel/process.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
diff -rup a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c 2006-06-23 16:08:13.000000000 +0200
+++ b/arch/i386/kernel/process.c 2006-07-11 14:39:20.000000000 +0200
@@ -38,6 +38,7 @@
#include <linux/kallsyms.h>
#include <linux/ptrace.h>
#include <linux/random.h>
+#include <linux/personality.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
@@ -898,7 +899,7 @@ asmlinkage int sys_get_thread_area(struc
unsigned long arch_align_stack(unsigned long sp)
{
- if (randomize_va_space)
+ if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
sp -= get_random_int() % 8192;
return sp & ~0xf;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/