diff options
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index ca989158e847..2b9a8d0fb474 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/pm.h> | 9 | #include <linux/pm.h> |
10 | #include <linux/clockchips.h> | 10 | #include <linux/clockchips.h> |
11 | #include <linux/random.h> | ||
11 | #include <trace/power.h> | 12 | #include <trace/power.h> |
12 | #include <asm/system.h> | 13 | #include <asm/system.h> |
13 | #include <asm/apic.h> | 14 | #include <asm/apic.h> |
@@ -613,3 +614,16 @@ static int __init idle_setup(char *str) | |||
613 | } | 614 | } |
614 | early_param("idle", idle_setup); | 615 | early_param("idle", idle_setup); |
615 | 616 | ||
617 | unsigned long arch_align_stack(unsigned long sp) | ||
618 | { | ||
619 | if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) | ||
620 | sp -= get_random_int() % 8192; | ||
621 | return sp & ~0xf; | ||
622 | } | ||
623 | |||
624 | unsigned long arch_randomize_brk(struct mm_struct *mm) | ||
625 | { | ||
626 | unsigned long range_end = mm->brk + 0x02000000; | ||
627 | return randomize_range(mm->brk, range_end, 0) ? : mm->brk; | ||
628 | } | ||
629 | |||