diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-20 12:01:59 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-20 12:01:59 -0700 |
commit | 02d6112cd7d75bf30685ee4b2e9dc0291b4d3133 (patch) | |
tree | b1715624dadae286cac16deb5a634a33f4a46aa6 /arch/mips/kernel/process.c | |
parent | 0b1937ac0ef1541c0ea44e6f81c33d2f59803957 (diff) | |
parent | 941091024ef0f2f7e09eb81201d293ac18833cc8 (diff) |
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
[MIPS] User stack pointer randomisation
[MIPS] Remove unused include/asm-mips/gfx.h
[MIPS] Remove unused include/asm-mips/ds1216.h
[MIPS] Workaround for RM7000 WAIT instruction aka erratum 38
[MIPS] Make support for weakly ordered LL/SC a config option.
[MIPS] Disable UserLocal runtime detection on platforms which never have it.
[MIPS] Disable MT runtime detection on platforms which never support MT.
Diffstat (limited to 'arch/mips/kernel/process.c')
-rw-r--r-- | arch/mips/kernel/process.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 8f4cf27c715..bd05f5a927e 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; +} |