diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-02-12 14:17:52 +0100 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-02-19 10:36:32 +0100 |
commit | 4ba2815d3bf38d6a959d2d11b08cf862550dcfcc (patch) | |
tree | 4677a713c51bc3429ab7292a73c2d49cb382015a /arch | |
parent | f4dce5c9364fffc8947008b17a7e16ea9009950d (diff) | |
download | linux-4ba2815d3bf38d6a959d2d11b08cf862550dcfcc.tar.bz2 |
s390/mm: align 64-bit PIE binaries to 4GB
The base address (STACK_TOP / 3 * 2) for a 64-bit program is two thirds
into the 4GB segment at 0x2aa00000000. The randomization added on z13
can eat another 1GB of the remaining 1.33GB to the next 4GB boundary.
In the worst case 300MB are left for the executable + bss which may
cross into the next 4GB segment. This is bad for branch prediction,
therefore align the base address to 4GB to give the program more room
before it crosses the 4GB boundary.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/mm/mmap.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index d008f638b2cd..179a2c20b01f 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c @@ -183,7 +183,10 @@ unsigned long randomize_et_dyn(void) { unsigned long base; - base = (STACK_TOP / 3 * 2) & (~mmap_align_mask << PAGE_SHIFT); + base = STACK_TOP / 3 * 2; + if (!is_32bit_task()) + /* Align to 4GB */ + base &= ~((1UL << 32) - 1); return base + mmap_rnd(); } |