From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] binfmt: turn MAX_ARG_PAGES into a sysctl tunable
Date: Sat, 17 Jun 2006 08:41:31 +0200 [thread overview]
Message-ID: <1150526492.28517.26.camel@lappy> (raw)
In-Reply-To: <20060616204024.GA7097@ucw.cz>
On Fri, 2006-06-16 at 20:40 +0000, Pavel Machek wrote:
> Hi!
>
> > From: Peter Zijlstra <a.p.zijlstra@chello.nl>
> >
> > Some folks find 128KB of env+arg space too little. Solaris provides them with
> > 1MB. Manually changing MAX_ARG_PAGES worked for them so far, however they
> > would like to run the supported vendor kernel.
> >
> > In the interrest of not penalizing everybody with the overhead of just
> > setting it larger, provide a sysctl to change it.
>
> I very muh like that idea.
>
> > Compiles and boots on i386.
> >
> > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
>
> ....but does is also work if you keep changing that value in the tight
> loop while trying to work with the system?
>
Yes, I've added a bprm local copy of max_arg_pages:
> @@ -20,9 +13,10 @@ struct pt_regs;
> > /*
> > * This structure is used to hold the arguments that are used when loading binaries.
> > */
> > -struct linux_binprm{
> > +struct linux_binprm {
> > char buf[BINPRM_BUF_SIZE];
> > - struct page *page[MAX_ARG_PAGES];
> > + struct page **page;
> > + int max_arg_pages;
> > struct mm_struct *mm;
> > unsigned long p; /* current top of mem */
> > int sh_bang;
That is set once from the sysctl variable:
> > @@ -1153,14 +1164,20 @@ int do_execve(char * filename,
> > if (!bprm)
> > goto out_ret;
> >
> > + bprm->max_arg_pages = max_arg_pages;
> > + bprm->page = kzalloc(bprm->max_arg_pages*sizeof(struct page*),
> > + GFP_KERNEL);
> > + if (!bprm->page)
> > + goto out_kfree;
> > +
And is thereafter used and never again changed.
This should be enough to guard against your scenario I recon.
Peter
next prev parent reply other threads:[~2006-06-17 6:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-14 14:58 [RFC][PATCH] binfmt: turn MAX_ARG_PAGES into a sysctl tunable Peter Zijlstra
2006-06-14 15:53 ` Arjan van de Ven
2006-06-14 16:19 ` Randy.Dunlap
2006-06-15 10:20 ` Peter Zijlstra
2006-06-16 20:40 ` Pavel Machek
2006-06-17 6:41 ` Peter Zijlstra [this message]
2006-06-23 9:18 ` Pavel Machek
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=1150526492.28517.26.camel@lappy \
--to=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/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