All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] binfmt: turn MAX_ARG_PAGES into a sysctl tunable
Date: Fri, 16 Jun 2006 20:40:24 +0000	[thread overview]
Message-ID: <20060616204024.GA7097@ucw.cz> (raw)
In-Reply-To: <1150297122.31522.54.camel@lappy>

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?

> Index: linux-2.6/fs/binfmt_elf.c
> ===================================================================
> --- linux-2.6.orig/fs/binfmt_elf.c	2006-06-14 15:56:40.000000000 +0200
> +++ linux-2.6/fs/binfmt_elf.c	2006-06-14 16:00:36.000000000 +0200
> @@ -255,8 +255,9 @@ create_elf_tables(struct linux_binprm *b
>  	while (argc-- > 0) {
>  		size_t len;
>  		__put_user((elf_addr_t)p, argv++);
> -		len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES);
> -		if (!len || len > PAGE_SIZE*MAX_ARG_PAGES)
> +		len = strnlen_user((void __user *)p,
> +				PAGE_SIZE*bprm->max_arg_pages);
> +		if (!len || len > PAGE_SIZE*bprm->max_arg_pages)
>  			return 0;
>  		p += len;
>  	}
> @@ -266,8 +267,9 @@ create_elf_tables(struct linux_binprm *b
>  	while (envc-- > 0) {
>  		size_t len;
>  		__put_user((elf_addr_t)p, envp++);
> -		len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES);
> -		if (!len || len > PAGE_SIZE*MAX_ARG_PAGES)
> +		len = strnlen_user((void __user *)p,
> +				PAGE_SIZE*bprm->max_arg_pages);
> +		if (!len || len > PAGE_SIZE*bprm->max_arg_pages)
>  			return 0;
>  		p += len;
>  	}
> Index: linux-2.6/fs/binfmt_elf_fdpic.c
> ===================================================================
> --- linux-2.6.orig/fs/binfmt_elf_fdpic.c	2006-06-14 15:56:40.000000000 +0200
> +++ linux-2.6/fs/binfmt_elf_fdpic.c	2006-06-14 16:00:36.000000000 +0200
> @@ -578,14 +578,15 @@ static int create_elf_fdpic_tables(struc
>  #ifdef CONFIG_MMU
>  	current->mm->arg_start = bprm->p;
>  #else
> -	current->mm->arg_start = current->mm->start_stack - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p);
> +	current->mm->arg_start = current->mm->start_stack -
> +		(bprm->max_arg_pages * PAGE_SIZE - bprm->p);
>  #endif
>  
>  	p = (char *) current->mm->arg_start;
>  	for (loop = bprm->argc; loop > 0; loop--) {

What happens if someone changes that sysctl from other cpu at this
point?

>  		__put_user((elf_caddr_t) p, argv++);
> -		len = strnlen_user(p, PAGE_SIZE * MAX_ARG_PAGES);
> -		if (!len || len > PAGE_SIZE * MAX_ARG_PAGES)
> +		len = strnlen_user(p, PAGE_SIZE * bprm->max_arg_pages);
> +		if (!len || len > PAGE_SIZE * bprm->max_arg_pages)
>  			return -EINVAL;
>  		p += len;
>  	}

-- 
Thanks for all the (sleeping) penguins.

  parent reply	other threads:[~2006-06-16 20:40 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 [this message]
2006-06-17  6:41   ` Peter Zijlstra
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=20060616204024.GA7097@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.