]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
parisc: Consider stack randomization for mmap base only when necessary
authorAlexandre Ghiti <alex@ghiti.fr>
Thu, 4 Apr 2019 06:26:22 +0000 (02:26 -0400)
committerHelge Deller <deller@gmx.de>
Fri, 3 May 2019 21:47:38 +0000 (23:47 +0200)
Do not offset mmap base address because of stack randomization if
current task does not want randomization.

Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/kernel/sys_parisc.c

index 376ea0d1b2759d2657741f8f8683f77e61a71b2d..4407ac4c1d84396aa17fe7eba988844c7e790114 100644 (file)
@@ -86,7 +86,8 @@ static unsigned long mmap_upper_limit(struct rlimit *rlim_stack)
                stack_base = STACK_SIZE_MAX;
 
        /* Add space for stack randomization. */
-       stack_base += (STACK_RND_MASK << PAGE_SHIFT);
+       if (current->flags & PF_RANDOMIZE)
+               stack_base += (STACK_RND_MASK << PAGE_SHIFT);
 
        return PAGE_ALIGN(STACK_TOP - stack_base);
 }