lkml.org 
[lkml]   [2006]   [Jun]   [17]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH] binfmt: turn MAX_ARG_PAGES into a sysctl tunable
FromPeter Zijlstra <>
DateSat, 17 Jun 2006 08:41:31 +0200
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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-17 08:44    [from the cache]
©2003-2008