lkml.org 
[lkml]   [2007]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: + mm-search_binary_handler-mem-limit-fix.patch added to -mm tree
On Mon, 29 Jan 2007 14:59:58 +0100
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

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

hm, thanks for testing - I'll drop it.

I don't really understand what's wrong with it though. Maybe it's settng
USER_DS on kernel threads?

-
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: 2007-01-29 18:41    [W:0.052 / U:1.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site