LKML Archive on
help / color / mirror / Atom feed
From: Matt Helsley <>
To: Oleg Nesterov <>
Subject: Re: + fix-procfs-task-exe-symlink.patch added to -mm tree
Date: Wed, 30 Jan 2008 15:32:48 -0800	[thread overview]
Message-ID: <1201735968.4028.11.camel@localhost.localdomain> (raw)
In-Reply-To: <>

On Wed, 2008-01-30 at 14:06 +0300, Oleg Nesterov wrote:


> Err, I was double wrong. It _is_ trivial to set ->exe_file before exec_mmap(),
> 	flush_old_exec:
> + 		get_file(bprm->file);
> + 		set_mm_exe_file(bprm->mm, bprm->file);
> 		retval = exec_mmap(bprm->mm);
> 		if (retval)
> 			goto mmap_failed;
> 		bprm->mm = NULL;		/* We're using it now */
> If exec_mmap() fails, the caller (do_execve) has to mmput(bprm->mm)
> anyway, and this imply set_mm_exe_file(NULL). This way set_mm_exe_file()
> doesn't need any locking.
> Not that this is relly important, but still.

I've got the patch written and will be testing this shortly.

> However. I didn't notice this patch plays with #ifdef CONFIG_PROC_FS.

There are portions in there to deal with the presence or lack of proc
fs. In include/linux/mm_types.h for example. Also, I placed some of the
functions in fs/proc/base.c and avoided the need for #ifdefs in the .c

> Without CONFIG_PROC_FS we seem to leak bprm->file, I'd suggest to move
> get_file(bprm->file) into set_mm_exe_file().

Good catch. Also I noticed that I was still setting the exe_file field
in fork.c regardles of CONFIG_PROC_FS.

So based on your feedback I'm working on 3 patches:
1 - fix the two CONFIG_PROC_FS issues
	a) breaks compilation when CONFIG_PROC_FS is not defined
	b) struct file leak when CONFIG_PROC_FS is not defined
2 - reuse mmap semaphore
3 - move the mm initialization bits in the exec path to close the window
where userspace could see a "NULL" exe_file.

I will post each after it passes testing.

Thanks again!

	-Matt Helsley

      reply	other threads:[~2008-01-30 23:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
     [not found] ` <>
     [not found]   ` <1201565920.10206.149.camel@localhost.localdomain>
2008-01-29 11:36     ` Oleg Nesterov
2008-01-30  1:23       ` Matt Helsley
2008-01-30 11:06         ` Oleg Nesterov
2008-01-30 23:32           ` Matt Helsley [this message]

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1201735968.4028.11.camel@localhost.localdomain \ \ \ \ \ \ \ \ \
    --subject='Re: + fix-procfs-task-exe-symlink.patch added to -mm tree' \

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