Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=941091024ef0f2f7e09eb81201d293ac18833cc8 Commit: 941091024ef0f2f7e09eb81201d293ac18833cc8 Parent: c55757b261038d17c729068fcdaef646a665385f Author: Franck Bui-Huu <[EMAIL PROTECTED]> AuthorDate: Thu Jul 19 14:04:21 2007 +0200 Committer: Ralf Baechle <[EMAIL PROTECTED]> CommitDate: Fri Jul 20 18:57:40 2007 +0100
[MIPS] User stack pointer randomisation Signed-off-by: Franck Bui-Huu <[EMAIL PROTECTED]> Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]> --- arch/mips/kernel/process.c | 14 ++++++++++++++ include/asm-mips/system.h | 2 +- 2 files changed, 15 insertions(+), 1 deletions(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 8f4cf27..bd05f5a 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -25,7 +25,9 @@ #include <linux/init.h> #include <linux/completion.h> #include <linux/kallsyms.h> +#include <linux/random.h> +#include <asm/asm.h> #include <asm/bootinfo.h> #include <asm/cpu.h> #include <asm/dsp.h> @@ -460,3 +462,15 @@ unsigned long get_wchan(struct task_struct *task) out: return pc; } + +/* + * Don't forget that the stack pointer must be aligned on a 8 bytes + * boundary for 32-bits ABI and 16 bytes for 64-bits ABI. + */ +unsigned long arch_align_stack(unsigned long sp) +{ + if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) + sp -= get_random_int() & ~PAGE_MASK; + + return sp & ALMASK; +} diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h index eba2e3d..8d0b1cd 100644 --- a/include/asm-mips/system.h +++ b/include/asm-mips/system.h @@ -470,6 +470,6 @@ extern int stop_a_enabled; */ #define __ARCH_WANT_UNLOCKED_CTXSW -#define arch_align_stack(x) (x) +extern unsigned long arch_align_stack(unsigned long sp); #endif /* _ASM_SYSTEM_H */ - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html