diff options
| -rw-r--r-- | arch/arm64/mm/mmap.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c index 8f6bcc3f4..5a07020b8 100644 --- a/arch/arm64/mm/mmap.c +++ b/arch/arm64/mm/mmap.c @@ -33,7 +33,7 @@ * Leave enough space between the mmap area and the stack to honour ulimit in * the face of randomisation. */ -#define MIN_GAP (SZ_128M + ((STACK_RND_MASK << PAGE_SHIFT) + 1)) +#define MIN_GAP (SZ_128M) #define MAX_GAP (STACK_TOP/6*5) static int mmap_is_legacy(void) @@ -65,6 +65,9 @@ static unsigned long mmap_rnd(void) static unsigned long mmap_base(void) { unsigned long gap = rlimit(RLIMIT_STACK); + unsigned long pad = STACK_RND_MASK << PAGE_SHIFT; + if (gap + pad > gap) + gap += pad; if (gap < MIN_GAP) gap = MIN_GAP; |
