linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Bobrowski <mbobrowski@mbobrowski.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: FAN_OPEN_EXEC event and ignore mask
Date: Wed, 7 Nov 2018 09:23:12 +1100	[thread overview]
Message-ID: <20181106222310.GA31364@lithium.mbobrowski.org> (raw)
In-Reply-To: <CAOQ4uxiMOVHARL_sW7Dr5He2=j7VxMmVrJ6BiUFMHjFn4kLgAA@mail.gmail.com>

On Tue, Nov 06, 2018 at 11:15:11PM +0200, Amir Goldstein wrote:
> > >
> > > IDGI. What is the problem with:
> > >
> > >        if (mask & MAY_OPEN) {
> > >                 fsnotify_mask = FS_OPEN_PERM;
> > >                 if (file->f_flags & __FMODE_EXEC) {
> > >                        ret = fsnotify_path(inode, path, FS_OPEN_EXEC_PERM);
> > >                        if (ret) return ret;
> > >                 }
> > >        } else if (mask & MAY_READ) {
> > >                 fsnotify_mask = FS_ACCESS_PERM;
> > >        }
> > >
> > >        return fsnotify_path(inode, path, FS_OPEN_EXEC_PERM);
> > >
> > > You can consolidate all 5 calls to fsnotify_parent();fsnotify() of the same
> > > pattern to fsnotify_path().
> >
> > There is nothing wrong with this and what this does in fact simplifies
> > the call site for fsnotify_parent()/fsnotify(), which is very nice and
> > clean in my opinion.
> >
> > What I'm referring to though is different. All I'm saying is that if I was
> > a user and I wanted to capture each time a file was opened regardless
> > whether it was for execution, for read, for write, I'd expect to capture
> > these events by just registering for FAN_OPEN_PERM and it would be
> > sufficient. After applying these updates, for a user to capture *all* open
> > related events, they're going to have to now supply both FAN_OPEN_PERM and
> > FAN_OPEN_EXEC_PERM. I just don't want to be in a position where we've
> > completely changed the expectation of FAN_OPEN_PERM, as I can imagine this
> > would really frustrate people.
> >
> > Maybe I'm over thinking it and it's OK?
> >
> 
> I don't know if you are overthinking but I still don't understand the concern.
> 
> Before the change:
> - Listen on FAN_OPEN_PERM
> - open file for read
> - open file for write
> - execve()
> User gets 3 FAN_OPEN_PERM permission events
> 
> After the change this is still the behavior with or without requesting
> FAN_OPEN_EXEC_PERM.
> 
> It's quite obvious that before the change user cannot request
> FAN_OPEN_EXEC_PERM and after the change requesting
> FAN_OPEN_EXEC_PERM with or without FAN_OPEN_PERM,
> will result in getting the new event once.
> 
> The only case where user won't get 3 FAN_OPEN_PERM events
> is when user denies the FAN_OPEN_EXEC_PERM event.
> What is your concern?

OK, my apologies. It was the way I implemented it that was causing me to get
confused as the results weren't aligning with what you so rightfully outlined
above.

Sorry about that Amir.

-- 
Matthew Bobrowski

      reply	other threads:[~2018-11-07  7:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1540635951.git.mbobrowski@mbobrowski.org>
     [not found] ` <6ffb239329a462a82f078b9a1e5e06255888b620.1540635951.git.mbobrowski@mbobrowski.org>
     [not found]   ` <CAOQ4uxhts4FX9YBRPOqUjh+vfgfnUT5wxfcPDbNV8itWXjw7uA@mail.gmail.com>
     [not found]     ` <20181028060133.GA8066@development.internal.lab>
     [not found]       ` <CAOQ4uxjyneJDZfjbRDiasA_YF6gj8_Nxoyh8MYZGYkjXFyfbtA@mail.gmail.com>
     [not found]         ` <20181028222358.GA3769@workstation>
     [not found]           ` <20181029134620.GF5988@quack2.suse.cz>
     [not found]             ` <CAOQ4uxg+6MOWLz6pP=S1P-XowF58BA7NvfYqdxTbusaE19QuyQ@mail.gmail.com>
     [not found]               ` <20181030002744.GA4214@workstation>
2018-10-30  9:17                 ` FAN_OPEN_EXEC event and ignore mask Amir Goldstein
2018-10-31 10:39                   ` Matthew Bobrowski
2018-11-01 14:45                     ` Amir Goldstein
2018-11-02 11:36                       ` Matthew Bobrowski
2018-11-02 12:26                         ` Amir Goldstein
2018-11-02 12:50                       ` Jan Kara
2018-11-02 13:43                         ` Amir Goldstein
2018-11-05  8:40                           ` Jan Kara
2018-11-03  0:34                         ` Matthew Bobrowski
2018-11-05  8:41                           ` Jan Kara
2018-11-05  9:06                             ` Matthew Bobrowski
2018-11-05 12:27                               ` Amir Goldstein
2018-11-05 12:37                                 ` Matthew Bobrowski
2018-11-06 13:08                             ` Matthew Bobrowski
2018-11-06 13:45                               ` Amir Goldstein
2018-11-06 13:47                                 ` Amir Goldstein
2018-11-06 20:40                                 ` Matthew Bobrowski
2018-11-06 21:15                                   ` Amir Goldstein
2018-11-06 22:23                                     ` Matthew Bobrowski [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:
  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=20181106222310.GA31364@lithium.mbobrowski.org \
    --to=mbobrowski@mbobrowski.org \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).