diff options
Diffstat (limited to 'arch/powerpc/mm/mmap_64.c')
-rw-r--r-- | arch/powerpc/mm/mmap_64.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/arch/powerpc/mm/mmap_64.c b/arch/powerpc/mm/mmap_64.c index 5a783d8e8e8e..67a42ed0d2fc 100644 --- a/arch/powerpc/mm/mmap_64.c +++ b/arch/powerpc/mm/mmap_64.c | |||
@@ -53,14 +53,6 @@ static inline int mmap_is_legacy(void) | |||
53 | return sysctl_legacy_va_layout; | 53 | return sysctl_legacy_va_layout; |
54 | } | 54 | } |
55 | 55 | ||
56 | /* | ||
57 | * Since get_random_int() returns the same value within a 1 jiffy window, | ||
58 | * we will almost always get the same randomisation for the stack and mmap | ||
59 | * region. This will mean the relative distance between stack and mmap will | ||
60 | * be the same. | ||
61 | * | ||
62 | * To avoid this we can shift the randomness by 1 bit. | ||
63 | */ | ||
64 | static unsigned long mmap_rnd(void) | 56 | static unsigned long mmap_rnd(void) |
65 | { | 57 | { |
66 | unsigned long rnd = 0; | 58 | unsigned long rnd = 0; |
@@ -68,11 +60,11 @@ static unsigned long mmap_rnd(void) | |||
68 | if (current->flags & PF_RANDOMIZE) { | 60 | if (current->flags & PF_RANDOMIZE) { |
69 | /* 8MB for 32bit, 1GB for 64bit */ | 61 | /* 8MB for 32bit, 1GB for 64bit */ |
70 | if (is_32bit_task()) | 62 | if (is_32bit_task()) |
71 | rnd = (long)(get_random_int() % (1<<(22-PAGE_SHIFT))); | 63 | rnd = (long)(get_random_int() % (1<<(23-PAGE_SHIFT))); |
72 | else | 64 | else |
73 | rnd = (long)(get_random_int() % (1<<(29-PAGE_SHIFT))); | 65 | rnd = (long)(get_random_int() % (1<<(30-PAGE_SHIFT))); |
74 | } | 66 | } |
75 | return (rnd << PAGE_SHIFT) * 2; | 67 | return rnd << PAGE_SHIFT; |
76 | } | 68 | } |
77 | 69 | ||
78 | static inline unsigned long mmap_base(void) | 70 | static inline unsigned long mmap_base(void) |