linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Helsley <matthltc@us.ibm.com>
To: Andreas Gruenbacher <agruen@suse.de>
Cc: Matthew Helsley <matt.helsley@gmail.com>,
	Eric Paris <eparis@redhat.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	viro@zeniv.linux.org.uk, hch@infradead.org,
	containers@lists.linux-foundation.org, matthltc@us.ibm.com,
	Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
	Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH 2/4] fanotify: Add pids to events
Date: Fri, 15 Jan 2010 13:21:46 -0800	[thread overview]
Message-ID: <20100115212146.GA3714@count0.beaverton.ibm.com> (raw)
In-Reply-To: <201001151612.10032.agruen@suse.de>

On Fri, Jan 15, 2010 at 04:12:09PM +0100, Andreas Gruenbacher wrote:
> On Friday 15 January 2010 05:41:10 Matthew Helsley wrote:
> > Eric, you never replied to my point about pid namespaces
> > (http://lkml.org/lkml/2009/7/1/2). I'm still concerned that it's a
> > problem for this patch. I've cc'd some pid namespace folks, listed the
> > problems, and some alternative solutions (where I could think of any)
> > below:
> > 
> > 1. Since fanotify doesn't hold a reference to the struct pid then the
> > pid can become stale before the event is acted upon.
> >     solution a: Just ignoring this problem, like other interfaces
> > often do, is probably ok.
> >     ... ?
> >     solution z: Seems to require taking a reference to the pid and
> > giving userspace a way to drop the reference after it's done using
> > this value to refer to the process (yuck).
> 
> struct fsnotify_event->tgid does hold a reference to the appropriate struct 
> pid.  The reference is released when that struct fsnotify_event is freed.

OK.

> 
> > 2. If the event recipient does a clone and enters a new pidns the pid
> > number will be incorrect without any indication.
> 
> No, if a process has a pid within the listener's namespace the listener will 
> see this pid; otherwise, the resulting pid value is 0.

So the pid reference is resolved at read(), correct? If so then that's fine.
(Otherwise I'd think the values could still become stale).

> > 3. If the listening process is not in the same or an ancestor pid
> > namespace of the triggering process then there is no correct pid
> > corresponding to the event.
> 
> Indeed, if the listener is not in the same or an ancestor pid namespace, the 
> pid in the event will end up as 0.  The event still indicates that something 
> has happened to a file the listener is interested in though, it's just unclear 
> who triggered the event.  I don't see a problem with that though -- do you?

Nope. Overall, looks good to me. Thanks!

Cheers,
	-Matt Helsley

  reply	other threads:[~2010-01-15 22:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02 14:14 [PATCH 1/4] fanotify: create_fd cleanup Eric Paris
2009-12-02 14:14 ` [PATCH 2/4] fanotify: Add pids to events Eric Paris
2010-01-15  4:41   ` Matthew Helsley
     [not found]     ` <6a12d2f31001142041j7f917b07l1e1a728790175321-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-15 15:12       ` Andreas Gruenbacher
2010-01-15 21:21         ` Matt Helsley [this message]
2010-01-16 22:53           ` Andreas Gruenbacher
2010-01-17  3:44             ` Matt Helsley
2009-12-02 14:15 ` [PATCH 3/4] fsnotify: split generic and inode specific mark code Eric Paris
2009-12-02 14:15 ` [PATCH 4/4] fsnotify: clear marks to 0 in fsnotify_init_mark Eric Paris

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=20100115212146.GA3714@count0.beaverton.ibm.com \
    --to=matthltc@us.ibm.com \
    --cc=agruen@suse.de \
    --cc=containers@lists.linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.helsley@gmail.com \
    --cc=oleg@redhat.com \
    --cc=sukadev@linux.vnet.ibm.com \
    --cc=viro@zeniv.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;
as well as URLs for NNTP newsgroup(s).