diff options
author | Amit Pundir <amit.pundir@linaro.org> | 2017-08-01 10:52:52 +0530 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2017-08-01 11:26:49 +0530 |
commit | b43282fc74615c71e3a58fa92a4fe62f5374acd6 (patch) | |
tree | 54c3e0f148beedd088ddb8e40268cf1c07b3bc08 /fs/exec.c | |
parent | f83fb557207250de93aa8882df19acfc7fe7ace7 (diff) | |
parent | 37f3f1536a86154b0c1cc2586fa6c513e79a440e (diff) |
Merge branch 'linux-linaro-lsk-v3.18' into linux-linaro-lsk-v3.18-androidlsk-v3.18-17.08-android
Conflicts:
arch/arm64/kernel/setup.c
AOSP Change-Id: I98624593273ae4c90ae299f063d26f35a39a0a31
(upstream commit 12d11817eaaf "arm64: Move /proc/cpuinfo handling code")
moved /proc/cpuinfo handling code from
arch/arm64/kernel/{setup.c to cpuinfo.c}.
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/exec.c b/fs/exec.c index dae3c2761a83..a552a192d0e3 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -199,8 +199,7 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, if (write) { unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; - unsigned long ptr_size; - struct rlimit *rlim; + unsigned long ptr_size, limit; /* * Since the stack will hold pointers to the strings, we @@ -229,14 +228,16 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, return page; /* - * Limit to 1/4-th the stack size for the argv+env strings. + * Limit to 1/4 of the max stack size or 3/4 of _STK_LIM + * (whichever is smaller) for the argv+env strings. * This ensures that: * - the remaining binfmt code will not run out of stack space, * - the program will have a reasonable amount of stack left * to work from. */ - rlim = current->signal->rlim; - if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4) + limit = _STK_LIM / 4 * 3; + limit = min(limit, rlimit(RLIMIT_STACK) / 4); + if (size > limit) goto fail; } |