x86: Don't randomize stack unless current->personality permits it
PATCH 1/1 x86: Don't randomize stack unless current->personality permits it
Do not randomize stack location unless current->personality permits it.
Signed-off-by Frank van Maarseveen <[email protected]>
---
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(-)
arch/i386/kernel/process.c +2 -1
@@ -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(strucunsigned 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 ; }
Quoted 4 lines · Frank van Maarseveen
Do not randomize stack location unless
current->personalitypermits it.Signed-off-by Frank van Maarseveen <[email protected]>---
hmm I could have sworn this was taken care of already,
Acked-by Arjan van de Ven <[email protected]>
thinking about it... prior to adding randomization, there already was 8K randomization of the stack pointer.. we probably only made the new randomization conditional on the personality..
(and to be honest for performance reasons you really really want that 8K at least on the netburst architectures)