Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86627
b: refs/heads/master
c: a64e715
h: refs/heads/master
i:
  86625: 51954f2
  86623: 18b8436
v: v3
  • Loading branch information
Linus Torvalds committed Mar 3, 2008
1 parent 7bf4638 commit e50645e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a345b4ba2086bacc63884e5d72268415a97bcbff
refs/heads/master: a64e715fc74b1a7dcc5944f848acc38b2c4d4ee2
10 changes: 9 additions & 1 deletion trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,15 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
return NULL;

if (write) {
struct rlimit *rlim = current->signal->rlim;
unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start;
struct rlimit *rlim;

/*
* We've historically supported up to 32 pages (ARG_MAX)
* of argument strings even with small stacks
*/
if (size <= ARG_MAX)
return page;

/*
* Limit to 1/4-th the stack size for the argv+env strings.
Expand All @@ -183,6 +190,7 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
* - the program will have a reasonable amount of stack left
* to work from.
*/
rlim = current->signal->rlim;
if (size > rlim[RLIMIT_STACK].rlim_cur / 4) {
put_page(page);
return NULL;
Expand Down

0 comments on commit e50645e

Please sign in to comment.