diff options
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/elf.h | 2 | ||||
-rw-r--r-- | arch/s390/mm/mmap.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index 354d42616c7e..9dbd3e7a3bc3 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h | |||
@@ -206,6 +206,8 @@ do { \ | |||
206 | current->mm->context.noexec == 0; \ | 206 | current->mm->context.noexec == 0; \ |
207 | }) | 207 | }) |
208 | 208 | ||
209 | #define STACK_RND_MASK 0x7ffUL | ||
210 | |||
209 | #define ARCH_DLINFO \ | 211 | #define ARCH_DLINFO \ |
210 | do { \ | 212 | do { \ |
211 | if (vdso_enabled) \ | 213 | if (vdso_enabled) \ |
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index 869efbaed3ea..5578740ab9c9 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c | |||
@@ -30,6 +30,15 @@ | |||
30 | #include <asm/pgalloc.h> | 30 | #include <asm/pgalloc.h> |
31 | #include <asm/compat.h> | 31 | #include <asm/compat.h> |
32 | 32 | ||
33 | static unsigned long stack_maxrandom_size(void) | ||
34 | { | ||
35 | if (!(current->flags & PF_RANDOMIZE)) | ||
36 | return 0; | ||
37 | if (current->personality & ADDR_NO_RANDOMIZE) | ||
38 | return 0; | ||
39 | return STACK_RND_MASK << PAGE_SHIFT; | ||
40 | } | ||
41 | |||
33 | /* | 42 | /* |
34 | * Top of mmap area (just below the process stack). | 43 | * Top of mmap area (just below the process stack). |
35 | * | 44 | * |
@@ -47,7 +56,7 @@ static inline unsigned long mmap_base(void) | |||
47 | else if (gap > MAX_GAP) | 56 | else if (gap > MAX_GAP) |
48 | gap = MAX_GAP; | 57 | gap = MAX_GAP; |
49 | 58 | ||
50 | return STACK_TOP - (gap & PAGE_MASK); | 59 | return STACK_TOP - stack_maxrandom_size() - (gap & PAGE_MASK); |
51 | } | 60 | } |
52 | 61 | ||
53 | static inline int mmap_is_legacy(void) | 62 | static inline int mmap_is_legacy(void) |