LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: dmonakhov@openvz.org, Andrew Morton <akpm@osdl.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: + mm-search_binary_handler-mem-limit-fix.patch added to -mm tree
Date: Mon, 29 Jan 2007 14:59:58 +0100	[thread overview]
Message-ID: <20070129135958.GB9941@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <20070129113328.GA9941@osiris.boeblingen.de.ibm.com>

On Mon, Jan 29, 2007 at 12:33:28PM +0100, Heiko Carstens wrote:
> On Wed, Jan 24, 2007 at 01:09:18AM -0800, akpm@osdl.org wrote:
> >      mm-search_binary_handler-mem-limit-fix.patch
> > From: Dmitriy Monakhov <dmonakhov@openvz.org>
> > 
> > The function changes mem limit to USER_DS before possible modprobe, but
> > never restored it again.
> > 
> > Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>
> > Signed-off-by: Andrew Morton <akpm@osdl.org>
> >  fs/exec.c |   10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff -puN fs/exec.c~mm-search_binary_handler-mem-limit-fix fs/exec.c
> > --- a/fs/exec.c~mm-search_binary_handler-mem-limit-fix
> > +++ a/fs/exec.c
> > @@ -1018,6 +1018,7 @@ int search_binary_handler(struct linux_b
> >  {
> >  	int try,retval;
> >  	struct linux_binfmt *fmt;
> > +	mm_segment_t oldfs;
> >  #ifdef __alpha__
> >  	/* handle /sbin/loader.. */
> >  	{
> > @@ -1059,11 +1060,12 @@ int search_binary_handler(struct linux_b
> > 
> >  	/* kernel module loader fixup */
> >  	/* so we don't try to load run modprobe in kernel space. */
> > +	oldfs = get_fs();
> >  	set_fs(USER_DS);
> > 
> >  	retval = audit_bprm(bprm);
> >  	if (retval)
> > -		return retval;
> > +		goto out;
> > 
> >  	retval = -ENOENT;
> >  	for (try=0; try<2; try++) {
> > @@ -1084,7 +1086,7 @@ int search_binary_handler(struct linux_b
> >  				bprm->file = NULL;
> >  				current->did_exec = 1;
> >  				proc_exec_connector(current);
> > -				return retval;
> > +				goto out;
> >  			}
> >  			read_lock(&binfmt_lock);
> >  			put_binfmt(fmt);
> > @@ -1092,7 +1094,7 @@ int search_binary_handler(struct linux_b
> >  				break;
> >  			if (!bprm->file) {
> >  				read_unlock(&binfmt_lock);
> > -				return retval;
> > +				goto out;
> >  			}
> >  		}
> >  		read_unlock(&binfmt_lock);
> > @@ -1110,6 +1112,8 @@ int search_binary_handler(struct linux_b
> >  #endif
> >  		}
> >  	}
> > +out:
> > +	set_fs(oldfs);
> >  	return retval;
> >  }

This is broken. This is the only place in kernel that sets fs to USER_DS
for a new process. With this patch we could as well get rid of USER_DS and
all the address space checkings.
Besides that it breaks architectures with distinct physical address spaces.

  reply	other threads:[~2007-01-29 14:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200701240909.l0O99IwK013495@shell0.pdx.osdl.net>
2007-01-29 11:33 ` Heiko Carstens
2007-01-29 13:59   ` Heiko Carstens [this message]
2007-01-29 17:37     ` Andrew Morton
2007-01-29 18:18       ` Martin Schwidefsky
2007-01-30  5:40         ` Dmitriy Monakhov
2007-01-30 12:23           ` Martin Schwidefsky

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=20070129135958.GB9941@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dmonakhov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --subject='Re: + mm-search_binary_handler-mem-limit-fix.patch added to -mm tree' \
    /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

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).