diff options
author | Anton Blanchard <anton@samba.org> | 2009-02-21 20:50:06 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-02-22 23:53:21 -0500 |
commit | 002b0ec73dd8b784004e5a013ad9f2fa6274af5a (patch) | |
tree | 8d614f85805a4884fcf485f292eb158c7aceb0af /arch/powerpc/mm | |
parent | a5adc91a4b44b5d1706b9d906cc14fe4f312afe9 (diff) |
powerpc: Increase stack gap on 64bit binaries
On 64bit there is a possibility our stack and mmap randomisation will put
the two close enough such that we can't expand our stack to match the ulimit
specified.
To avoid this, start the upper mmap address at 1GB + 128MB below the top of our
address space, so in the worst case we end up with the same ~128MB hole as in
32bit. This works because we randomise the stack over a 1GB range.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/mmap.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c index 75dc7faaf917..0d957a4c70fe 100644 --- a/arch/powerpc/mm/mmap.c +++ b/arch/powerpc/mm/mmap.c | |||
@@ -30,9 +30,16 @@ | |||
30 | /* | 30 | /* |
31 | * Top of mmap area (just below the process stack). | 31 | * Top of mmap area (just below the process stack). |
32 | * | 32 | * |
33 | * Leave an at least ~128 MB hole. | 33 | * Leave at least a ~128 MB hole on 32bit applications. |
34 | * | ||
35 | * On 64bit applications we randomise the stack by 1GB so we need to | ||
36 | * space our mmap start address by a further 1GB, otherwise there is a | ||
37 | * chance the mmap area will end up closer to the stack than our ulimit | ||
38 | * requires. | ||
34 | */ | 39 | */ |
35 | #define MIN_GAP (128*1024*1024) | 40 | #define MIN_GAP32 (128*1024*1024) |
41 | #define MIN_GAP64 ((128 + 1024)*1024*1024UL) | ||
42 | #define MIN_GAP ((is_32bit_task()) ? MIN_GAP32 : MIN_GAP64) | ||
36 | #define MAX_GAP (TASK_SIZE/6*5) | 43 | #define MAX_GAP (TASK_SIZE/6*5) |
37 | 44 | ||
38 | static inline int mmap_is_legacy(void) | 45 | static inline int mmap_is_legacy(void) |