From: Matt Helsley <matthltc@us.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
viro@ftp.linux.org.uk, haveblue@us.ibm.com
Subject: Re: [RFC][PATCH 1/3] [RFC][PATCH] Fix procfs task exe symlinks
Date: Thu, 01 Nov 2007 12:52:56 -0700 [thread overview]
Message-ID: <1193946776.16995.5.camel@localhost.localdomain> (raw)
In-Reply-To: <20071101122509.f26225bb.akpm@linux-foundation.org>
On Thu, 2007-11-01 at 12:25 -0700, Andrew Morton wrote:
> On Wed, 31 Oct 2007 20:35:09 -0700
> Matt Helsley <matthltc@us.ibm.com> wrote:
>
> > +++ linux-2.6.23/include/linux/sched.h
> > @@ -430,10 +430,13 @@ struct mm_struct {
> > struct completion *core_startup_done, core_done;
> >
> > /* aio bits */
> > rwlock_t ioctx_list_lock;
> > struct kioctx *ioctx_list;
> > +
> > + /* store ref to file /proc/<pid>/exe symlink points to */
> > + struct file *exe_file;
> > };
>
> I guess with a little work this could be made conditional on
> CONFIG_PROC_FS. ie: change get_mm_exe_file() to
Sorry, I thought ifdefs were generally frowned upon in structs. I'll add
them here and make sure everthing still works properly.
> void get_mm_exe_file(struct mm_struct *newmm, struct mm_struct *old_mm);
>
> > @@ -1716,10 +1744,14 @@ static void remove_vma_list(struct mm_st
> >
> > mm->total_vm -= nrpages;
> > if (vma->vm_flags & VM_LOCKED)
> > mm->locked_vm -= nrpages;
> > vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
> > + if (mm->exe_file && (vma->vm_file == mm->exe_file)) {
> > + fput(mm->exe_file);
> > + mm->exe_file = NULL;
> > + }
> > vma = remove_vma(vma);
> > } while (vma);
> > validate_mm(mm);
> > }
>
> hm, fput() while holding mmap_sem. I wonder if that's a problem.
>
> I assume you've runtime tested this with lockdep enabled, but fput() is one
> of those funny things which can call all sorts of things which one least
> expects and where testers hit things which developers don't.
It's being used under the mmap semaphore in remove_vma() so, even if
fput() with mmap_sem held is a bug, I'm not introducing any new bugs :).
Thanks,
-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>
next prev parent reply other threads:[~2007-11-01 19:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-01 3:35 [RFC][PATCH 0/3] Procfs Task exe Symlinks Matt Helsley
2007-11-01 3:35 ` [RFC][PATCH 1/3] [RFC][PATCH] Fix procfs task exe symlinks Matt Helsley
2007-11-01 19:25 ` Andrew Morton
2007-11-01 19:52 ` Matt Helsley [this message]
2007-11-01 3:35 ` [RFC][PATCH 2/3] [RFC][PATCH] Add spinlock in mm to protext exe reference Matt Helsley
2007-11-01 3:35 ` [RFC][PATCH 3/3] [RFC][PATCH] Make /proc/pid/exe symlink changeable 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=1193946776.16995.5.camel@localhost.localdomain \
--to=matthltc@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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