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 3e21e38d7e37..e22d63bdc8ff 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> |
| @@ -614,3 +615,16 @@ static int __init idle_setup(char *str) | |||
| 614 | } | 615 | } |
| 615 | early_param("idle", idle_setup); | 616 | early_param("idle", idle_setup); |
| 616 | 617 | ||
| 618 | unsigned long arch_align_stack(unsigned long sp) | ||
| 619 | { | ||
| 620 | if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) | ||
| 621 | sp -= get_random_int() % 8192; | ||
| 622 | return sp & ~0xf; | ||
| 623 | } | ||
| 624 | |||
| 625 | unsigned long arch_randomize_brk(struct mm_struct *mm) | ||
| 626 | { | ||
| 627 | unsigned long range_end = mm->brk + 0x02000000; | ||
| 628 | return randomize_range(mm->brk, range_end, 0) ? : mm->brk; | ||
| 629 | } | ||
| 630 | |||
