linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ollie Wild <aaw@google.com>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	linux-kernel@vger.kernel.org,
	parisc-linux@lists.parisc-linux.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Ingo Molnar <mingo@elte.hu>, Andi Kleen <ak@suse.de>
Subject: Re: [patch 0/3] no MAX_ARG_PAGES -v2
Date: Thu, 14 Jun 2007 10:38:39 +0200	[thread overview]
Message-ID: <1181810319.7348.345.camel@twins> (raw)
In-Reply-To: <65dd6fd50706132323i9c760f4m6e23687914d0c46e@mail.gmail.com>

On Wed, 2007-06-13 at 23:23 -0700, Ollie Wild wrote:
> On 6/13/07, Luck, Tony <tony.luck@intel.com> wrote:
> > Above 5Mbytes, I started seeing problems.  The line/word/char
> > counts from "wc" started being "0 0 0".  Not sure if this is
> > a problem in "wc" dealing with a single line >5MBytes, or some
> > other problem (possibly I was exceeding the per-process stack
> > limit which is only 8MB on that machine).
> 
> Interesting.  If you're exceeding your stack ulimit, you should be
> seeing either an "argument list too long" message or getting a
> SIGSEGV.  Have you tried bypassing wc and piping the output straight
> to a file?

I think it sends SIGKILL on failure paths.

I've been thinking of moving this large stack alloc in
create_elf_tables() before the point of no return.

something like this, it should do the largest part of the alloc
beforehand. Just have to see if all binfmts need this much, and if not,
what the ramifications are of overgrowing the stack (perhaps we need to
shrink it again to wherever bprm->p ends up?)


Index: linux-2.6-2/fs/exec.c
===================================================================
--- linux-2.6-2.orig/fs/exec.c	2007-06-14 10:29:22.000000000 +0200
+++ linux-2.6-2/fs/exec.c	2007-06-14 10:28:45.000000000 +0200
@@ -272,6 +272,17 @@ static bool valid_arg_len(struct linux_b
 	return len <= MAX_ARG_STRLEN;
 }
 
+static int expand_arg_vma(struct linux_binprm *bprm)
+{
+	long size = (bprm->argc + bprm->envc + 2) * sizeof(void *);
+
+#ifdef CONFIG_STACK_GROWSUP
+#error I broke it
+#else
+	return expand_stack(bprm->vma, bprm->p - size);
+#endif
+}
+
 #else
 
 static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
@@ -326,6 +337,11 @@ static bool valid_arg_len(struct linux_b
 	return len <= bprm->p;
 }
 
+static int expand_arg_vma(struct linux_binprm *bprm)
+{
+	return 0;
+}
+
 #endif /* CONFIG_MMU */
 
 /*
@@ -1385,6 +1401,10 @@ int do_execve(char * filename,
 		goto out;
 	bprm->argv_len = env_p - bprm->p;
 
+	retval = expand_arg_vma(bprm);
+	if (retval < 0)
+		goto out;
+
 	retval = search_binary_handler(bprm,regs);
 	if (retval >= 0) {
 		/* execve success */



  reply	other threads:[~2007-06-14  8:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-13 10:03 [patch 0/3] no MAX_ARG_PAGES -v2 Peter Zijlstra
2007-06-13 10:03 ` [patch 1/3] arch: personality independent stack top Peter Zijlstra
2007-06-13 10:03 ` [patch 2/3] audit: rework execve audit Peter Zijlstra
2007-06-26 22:55   ` Andrew Morton
2007-07-03 15:00     ` Peter Zijlstra
2007-06-13 10:03 ` [patch 3/3] mm: variable length argument support Peter Zijlstra
2007-08-07 19:03   ` Olaf Hering
2007-08-07 19:20     ` Andrew Morton
2007-08-07 19:26       ` Peter Zijlstra
2007-08-07 20:10       ` Olaf Hering
2007-08-22  8:48   ` Dan Aloni
2007-08-22  8:54     ` Peter Zijlstra
2007-08-22  9:05       ` Andrew Morton
     [not found]     ` <20070822090251.GA7038@mail.ustc.edu.cn>
2007-08-22  9:02       ` Fengguang Wu
2007-06-13 23:36 ` [patch 0/3] no MAX_ARG_PAGES -v2 Luck, Tony
2007-06-14  6:23   ` Ollie Wild
2007-06-14  8:38     ` Peter Zijlstra [this message]
2007-06-14 18:22       ` Luck, Tony
2007-06-14 18:32         ` Peter Zijlstra
2007-06-14 20:58       ` Ollie Wild
2007-06-14 21:18         ` Peter Zijlstra
2007-06-15  9:24         ` Peter Zijlstra
2007-06-15 18:07           ` Ollie Wild
2007-06-15 18:49             ` Luck, Tony
2007-06-17 18:32 ` Pavel Machek
2007-06-17 19:07   ` Ingo Molnar

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=1181810319.7348.345.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=aaw@google.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=parisc-linux@lists.parisc-linux.org \
    --cc=tony.luck@intel.com \
    /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).