Re: [RFC][PATCH] binfmt: turn MAX_ARG_PAGES into a sysctl tunable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2006-06-16 at 20:40 +0000, Pavel Machek wrote:
> Hi!
> 
> > From: Peter Zijlstra <[email protected]>
> > 
> > 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 <[email protected]>
> 
> ....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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux