diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-03-04 06:33:28 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-03-06 03:34:03 -0500 |
commit | cd479eccd2e057116d504852814402a1e68ead80 (patch) | |
tree | 4907bc92b607d86fe8b86a21657d85d7186b3f7d | |
parent | 3717f613f48df0222311f974cf8a06c8a6c97bae (diff) |
s390: limit brk randomization to 32MB
For a 64-bit process the randomization of the program break is quite
large with 1GB. That is as big as the randomization of the anonymous
mapping base, for a test case started with '/lib/ld64.so.1 <exec>'
it can happen that the heap is placed after the stack. To avoid
this limit the program break randomization to 32MB for 64-bit and
keep 8MB for 31-bit.
Reported-by: Stefan Liebler <stli@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/elf.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index 7d22a474a040..f74639a05f0f 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h | |||
@@ -252,11 +252,14 @@ do { \ | |||
252 | 252 | ||
253 | /* | 253 | /* |
254 | * Cache aliasing on the latest machines calls for a mapping granularity | 254 | * Cache aliasing on the latest machines calls for a mapping granularity |
255 | * of 512KB. For 64-bit processes use a 512KB alignment and a randomization | 255 | * of 512KB for the anonymous mapping base. For 64-bit processes use a |
256 | * of up to 1GB. For 31-bit processes the virtual address space is limited, | 256 | * 512KB alignment and a randomization of up to 1GB. For 31-bit processes |
257 | * use no alignment and limit the randomization to 8MB. | 257 | * the virtual address space is limited, use no alignment and limit the |
258 | * randomization to 8MB. | ||
259 | * For the additional randomization of the program break use 32MB for | ||
260 | * 64-bit and 8MB for 31-bit. | ||
258 | */ | 261 | */ |
259 | #define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ffffUL) | 262 | #define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x1fffUL) |
260 | #define MMAP_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ff80UL) | 263 | #define MMAP_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ff80UL) |
261 | #define MMAP_ALIGN_MASK (is_compat_task() ? 0 : 0x7fUL) | 264 | #define MMAP_ALIGN_MASK (is_compat_task() ? 0 : 0x7fUL) |
262 | #define STACK_RND_MASK MMAP_RND_MASK | 265 | #define STACK_RND_MASK MMAP_RND_MASK |