From: "Carlos O'Donell" <carlos@codesourcery.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Kerrisk <michael.kerrisk@googlemail.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>, aaw <aaw@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-kernel <linux-kernel@vger.kernel.org>,
drepper@redhat.com, mtk.manpages@gmail.com,
Geoff Clare <gwc@opengroup.org>
Subject: Re: [RFC/PATCH] RLIMIT_ARG_MAX
Date: Sat, 01 Mar 2008 09:21:13 -0500 [thread overview]
Message-ID: <47C96659.80306@codesourcery.com> (raw)
In-Reply-To: <alpine.LFD.1.00.0802291350550.17889@woody.linux-foundation.org>
Linus Torvalds wrote:
> On Fri, 29 Feb 2008, Linus Torvalds wrote:
>> I do agree that we should at least make the "MAX(stacksize/4, 128k)"
>> change for backwards compatibility.
>
> How about something like this?
This is perfect. As the original submitter of the bug my primary
interest is in having the regression fixed.
> The alternative is to just remove that size check entirely, and depend on
> get_user_pages() doing the stack limit check (among all the *other* checks
> it does when it does the acct_stack_growth() thing).
>
> I'd almost prefer that simpler approach, but I don't have any really
> strong preferences. Anybody?
>
> Linus
>
> ---
> fs/exec.c | 10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/fs/exec.c b/fs/exec.c
> index a44b142..e91f9cb 100644
> --- a/fs/exec.c
> +++ b/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 of argument
> + * strings even with small stacks
> + */
> + if (size <= 32*PAGE_SIZE)
> + return page;
Could you use ARG_MAX as defined in include/linux/limits.h?
>
> /*
> * 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;
Cheers,
Carlos.
--
Carlos O'Donell
CodeSourcery
carlos@codesourcery.com
(650) 331-3385 x716
next prev parent reply other threads:[~2008-03-01 14:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-27 13:37 [RFC/PATCH] RLIMIT_ARG_MAX Peter Zijlstra
2008-02-29 16:05 ` Linus Torvalds
2008-02-29 16:58 ` Michael Kerrisk
2008-02-29 17:12 ` Linus Torvalds
2008-02-29 17:18 ` Peter Zijlstra
2008-02-29 17:29 ` Linus Torvalds
2008-02-29 17:42 ` Peter Zijlstra
2008-02-29 18:12 ` Linus Torvalds
2008-02-29 19:01 ` Ollie Wild
2008-02-29 19:09 ` Jakub Jelinek
2008-02-29 19:50 ` Linus Torvalds
2008-02-29 20:03 ` Ollie Wild
2008-03-04 20:07 ` Pavel Machek
2008-02-29 17:14 ` Peter Zijlstra
2008-02-29 17:35 ` Linus Torvalds
2008-02-29 17:55 ` Peter Zijlstra
2008-02-29 18:14 ` Linus Torvalds
2008-02-29 18:18 ` Michael Kerrisk
2008-02-29 18:39 ` Linus Torvalds
2008-02-29 19:49 ` Michael Kerrisk
2008-02-29 20:07 ` Linus Torvalds
2008-02-29 20:43 ` Michael Kerrisk
2008-02-29 21:34 ` Linus Torvalds
2008-02-29 21:57 ` Linus Torvalds
2008-03-01 14:21 ` Carlos O'Donell [this message]
2008-03-01 8:42 ` Geoff Clare
2008-02-29 18:40 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47C96659.80306@codesourcery.com \
--to=carlos@codesourcery.com \
--cc=a.p.zijlstra@chello.nl \
--cc=aaw@google.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=drepper@redhat.com \
--cc=gwc@opengroup.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.kerrisk@googlemail.com \
--cc=mtk.manpages@gmail.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).