diff options
author | Anton Blanchard <anton@samba.org> | 2009-02-21 20:50:02 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-02-22 23:53:07 -0500 |
commit | 2dadb987e09995b2910c419cdfe2307e66537649 (patch) | |
tree | 963530a0ee6a54f6067e6d267f5861094426e1be /arch | |
parent | 9f14c42d7582bf33bbe1e133d897a6942ceae08e (diff) |
powerpc: More stack randomisation for 64bit binaries
At the moment we randomise the stack by 8MB on 32bit and 64bit tasks. Since we
have a lot more address space to play with on 64bit, lets do what x86 does and
increase that randomisation to 1GB:
before:
# for i in seq `1 10` ; do sleep 1 & cat /proc/${!}/maps | grep stack; done
fffffebc000-fffffed1000 rw-p ffffffeb000 00:00 0 [stack]
ffffff5a000-ffffff6f000 rw-p ffffffeb000 00:00 0 [stack]
fffffdb2000-fffffdc7000 rw-p ffffffeb000 00:00 0 [stack]
fffffd3e000-fffffd53000 rw-p ffffffeb000 00:00 0 [stack]
fffffad9000-fffffaee000 rw-p ffffffeb000 00:00 0 [stack]
after:
# for i in seq `1 10` ; do sleep 1 & cat /proc/${!}/maps | grep stack; done
ffff5c27000-ffff5c3c000 rw-p ffffffeb000 00:00 0 [stack]
fffebe5e000-fffebe73000 rw-p ffffffeb000 00:00 0 [stack]
fffcb298000-fffcb2ad000 rw-p ffffffeb000 00:00 0 [stack]
fffc719d000-fffc71b2000 rw-p ffffffeb000 00:00 0 [stack]
fffe01af000-fffe01c4000 rw-p ffffffeb000 00:00 0 [stack]
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/elf.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index c125da793b07..3f94d8880e6c 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h | |||
@@ -271,6 +271,11 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, | |||
271 | int uses_interp); | 271 | int uses_interp); |
272 | #define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b); | 272 | #define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b); |
273 | 273 | ||
274 | /* 1GB for 64bit, 8MB for 32bit */ | ||
275 | #define STACK_RND_MASK (is_32bit_task() ? \ | ||
276 | (0x7ff >> (PAGE_SHIFT - 12)) : \ | ||
277 | (0x3ffff >> (PAGE_SHIFT - 12))) | ||
278 | |||
274 | #endif /* __KERNEL__ */ | 279 | #endif /* __KERNEL__ */ |
275 | 280 | ||
276 | /* | 281 | /* |