From 97324de9f155264ee287d908bbb75102ac4001c5 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 3 Mar 2008 10:35:38 -0800 Subject: [PATCH] --- yaml --- r: 86655 b: refs/heads/master c: 5ce6386b900c83aa31d0490335df421a8d544381 h: refs/heads/master i: 86653: 564bfc94241ddee300f1005af12ff3cdce0e7904 86651: d32e59405d1656467461d3dba32c3335d3357a61 86647: cc3240925c65d841020e9b757d51236814c22c2a 86639: 5d1770e5b43e037abf5783018157e2df9c251021 86623: 18b8436cd799bcd496ad498a86837d4c6538189e 86591: e5e1964187822f64bb1b0ce61c11d15b2dfce086 86527: 88ffd7fa6dae04f7aa7eab83a467f77b3865c589 v: v3 --- [refs] | 2 +- trunk/fs/exec.c | 10 +++++++++- trunk/include/asm-x86/pgtable_32.h | 4 +--- trunk/include/asm-x86/pgtable_64.h | 6 ++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 0a0c3ad8cd1f..cfbd2bc22e86 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3cecdda3f169f22f324f78fd544beee68e3cc6a4 +refs/heads/master: 5ce6386b900c83aa31d0490335df421a8d544381 diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index a44b142fb460..54a0a557b678 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -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. @@ -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; diff --git a/trunk/include/asm-x86/pgtable_32.h b/trunk/include/asm-x86/pgtable_32.h index b478efa971e0..a842c7222b1e 100644 --- a/trunk/include/asm-x86/pgtable_32.h +++ b/trunk/include/asm-x86/pgtable_32.h @@ -91,9 +91,7 @@ extern unsigned long pg0[]; /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */ #define pmd_none(x) (!(unsigned long)pmd_val(x)) #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) -#define pmd_bad(x) ((pmd_val(x) \ - & ~(PAGE_MASK | _PAGE_USER | _PAGE_PSE | _PAGE_NX)) \ - != _KERNPG_TABLE) +#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) diff --git a/trunk/include/asm-x86/pgtable_64.h b/trunk/include/asm-x86/pgtable_64.h index 0a9258333cbd..0a0b77bc736a 100644 --- a/trunk/include/asm-x86/pgtable_64.h +++ b/trunk/include/asm-x86/pgtable_64.h @@ -153,14 +153,12 @@ static inline unsigned long pgd_bad(pgd_t pgd) static inline unsigned long pud_bad(pud_t pud) { - return pud_val(pud) & - ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER | _PAGE_PSE | _PAGE_NX); + return pud_val(pud) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); } static inline unsigned long pmd_bad(pmd_t pmd) { - return pmd_val(pmd) & - ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER | _PAGE_PSE | _PAGE_NX); + return pmd_val(pmd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); } #define pte_none(x) (!pte_val(x))