linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matt Helsley <matthltc@us.ibm.com>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Andrew Morton <akpm@osdl.org>, Chris Wright <chrisw@sous-sol.org>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	"Hallyn, Serge" <serue@us.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] Simplify /proc/<pid|self>/exe symlink code
Date: Mon, 16 Jul 2007 12:31:14 -0700	[thread overview]
Message-ID: <1184614274.4877.49.camel@localhost.localdomain> (raw)
In-Reply-To: <20070713020710.GA21668@ftp.linux.org.uk>

On Fri, 2007-07-13 at 03:07 +0100, Al Viro wrote:
> On Thu, Jul 12, 2007 at 07:00:12PM -0700, Matt Helsley wrote:
> > This patch avoids holding the mmap semaphore while walking VMAs in response to
> > programs which read or follow the /proc/<pid|self>/exe symlink. This also allows
> > us to merge mmu and nommu proc_exe_link() functions. The costs are holding the
> > task lock, a separate reference to the executable file stored in the task
> > struct, and increased code in fork, exec, and exit paths.
> 
> I don't think it's a food idea.  Consider a program that deliberately
> creates an executable anon memory, copies the binary there, jumps there
> and unmaps the original.   In the current tree you'll get nothing
> pinning the binary; with your patch it will remained busy.

	Yes, it will prevent the filesystem with the executable file from being
unmounted. Do you have an example where the original filesystem urgently
needs to be unmounted while this unusual executable is running? Or is
umount -l sufficient here?

> It's not a common situation, of course, but there are legitimate uses
> for such technics...

	Yes, I'm aware of at least one example where this technique has
legitimate uses: libhugetlbfs. I'm interested in testing others you may
be able to recommend as well.

	Furthermore, in your example the VMA walk would make /proc/self/exe a
symlink to the file that backs the next executable VMA: libc, libdl,
etc. That seems rather odd to me. In contrast, with my
patch /proc/self/exe would always be a symlink to the original
executable.

Cheers,
	-Matt Helsley

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-07-16 19:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-13  2:00 Matt Helsley
2007-07-13  2:07 ` Al Viro
2007-07-16 19:31   ` Matt Helsley [this message]
2007-07-13  2:21 ` Andrew Morton
2007-07-13 19:54   ` Matt Helsley

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=1184614274.4877.49.camel@localhost.localdomain \
    --to=matthltc@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=chrisw@sous-sol.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterz@infradead.org \
    --cc=serue@us.ibm.com \
    --cc=viro@ftp.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox