diff --git a/fs/exec.c b/fs/exec.c index 481b6e7df6ae..65d3ebc24fd3 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -771,7 +771,8 @@ int setup_arg_pages(struct linux_binprm *bprm, stack_base = calc_max_stack_size(stack_base); /* Add space for stack randomization. */ - stack_base += (STACK_RND_MASK << PAGE_SHIFT); + if (current->flags & PF_RANDOMIZE) + stack_base += (STACK_RND_MASK << PAGE_SHIFT); /* Make sure we didn't let the argument array grow too large. */ if (vma->vm_end - vma->vm_start > stack_base)