linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Bobrowski <mbobrowski@mbobrowski.org>
To: Jan Kara <jack@suse.cz>
Cc: Amir Goldstein <amir73il@gmail.com>,
	linux-api@vger.kernel.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Steve Grubb <sgrubb@redhat.com>
Subject: Re: [PATCH v7 0/4] fanotify: introduce new event mask FAN_OPEN_EXEC and FAN_OPEN_EXEC_PERM
Date: Mon, 19 Nov 2018 21:27:58 +1100	[thread overview]
Message-ID: <20181119102757.GA8043@lithium.mbobrowski.org> (raw)
In-Reply-To: <20181114120247.GA16849@quack2.suse.cz>

On Wed, Nov 14, 2018 at 01:02:47PM +0100, Jan Kara wrote:
> > > > > LTP tests for this feature are on my 'fanotify-exec' branch here:
> > > > > https://github.com/matthewbobrowski/ltp/commits/fanotify_exec. The files
> > > > > that contains the test cases are provided below:
> > > > >
> > > > > syscalls/fanotify03: test cases have been updated to cover
> > > > >                      FAN_OPEN_EXEC_PERM events
> > > > > syscalls/fanotify12: newly introduced LTP test file to cover
> > > > >                      FAN_OPEN_EXEC events
> > > >
> > > > I have been wondering for a while why the testcases passed when ignore mask
> > > > hasn't been properly treated in fanotify_group_event_mask() but then I
> > > > realized that the generic code will not even call to fanotify if ignore
> > > > masks result in clearing the event.
> > >
> > > So does that means we have missing test coverage?
> > >
> > 
> > This is covered by test case #3 of Matthew's proposed LTP test.
> > https://github.com/matthewbobrowski/ltp/commit/9e350fe15a5423d896ed0e8e147edc15bee13b42#diff-2bb8ddff24b3a031be0f64354262e587R76
> 
> This testcase does not catch the bug we had in fanotify_group_event_mask()
> because the masking by mark->mask already hides the fact that we failed to
> apply the ignore mask.
> 
> What does catch this kind of bug (tested) is a testcase (admittedly
> somewhat silly) like this:
> 
> {
>         "inode mark, FAN_OPEN | FAN_OPEN_EXEC events, ignore FAN_OPEN_EXEC",
>         INIT_FANOTIFY_MARK_TYPE(INODE),
>         FAN_OPEN | FAN_OPEN_EXEC,
>         FAN_OPEN_EXEC,
>         2,
>         {FAN_OPEN, FAN_OPEN}
> },

I've incorporated this^ test as part of my test cases. All tests, this one
included, are passing on kernel built on your 'fsnotify' branch. You can find
the updated test case file here:

https://github.com/matthewbobrowski/ltp/commit/d1d57d5bda8db49a26624c7737c2db88ea90f9db

> A real variant of this would be FAN_OPEN | FAN_OPEN_EXEC on mount, ignore
> FAN_OPEN on inode. Then we should just get one FAN_OPEN_EXEC but with the bug
> we'd get FAN_OPEN | FAN_OPEN_EXEC.
> 
> But creating such test would be slightly more involved. But probably it is
> worth it. Matthew?

Yeah, this shouldn't be too difficult to add at all, but as Amir pointed out,
I'd probably be in favour of putting this into a different test case i.e. one
which deals with mounts/filesystem mark types.
 
> Also I have noticed that fanotify12 test has a bug that it reports:
> 
> fanotify12.c:220: FAIL: Received event: mask=1020, pid=5142 (expected 5142), fd=5
> 
> i.e., it reports expected pid instead of expected mask when mask does not
> match. Can you please fix it Matthew?

Sure, a fix for this has also been applied here:

https://github.com/matthewbobrowski/ltp/commit/d1d57d5bda8db49a26624c7737c2db88ea90f9db

-- 
Matthew Bobrowski

      parent reply	other threads:[~2018-11-19 20:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-08  3:04 [PATCH v7 0/4] fanotify: introduce new event mask FAN_OPEN_EXEC and FAN_OPEN_EXEC_PERM Matthew Bobrowski
2018-11-08  3:05 ` [PATCH v7 1/4] fanotify: return only user requested event types in event mask Matthew Bobrowski
2018-11-13 17:38   ` Jan Kara
2018-11-13 17:53     ` Amir Goldstein
2018-11-13 23:54       ` Matthew Bobrowski
2018-11-14 12:04         ` Jan Kara
2018-11-08  3:07 ` [PATCH v7 2/4] fanotify: introduce new event mask FAN_OPEN_EXEC Matthew Bobrowski
2018-11-08 18:22   ` Andy Lutomirski
2018-11-09  5:41     ` Matthew Bobrowski
2018-11-09  6:04       ` Andy Lutomirski
2018-11-09  7:27         ` Matthew Bobrowski
2018-11-12 16:14         ` Jan Kara
2018-11-12 16:37           ` Andy Lutomirski
2018-11-13 11:45             ` Matthew Bobrowski
2018-11-13 17:35               ` Jan Kara
2018-11-13 23:26                 ` Matthew Bobrowski
2018-11-08  3:10 ` [PATCH v7 3/4] fsnotify: refactor fsnotify_parent()/fsnotify() paired calls when event is on path Matthew Bobrowski
2018-11-08  3:12 ` [PATCH v7 4/4] fanotify: introduce new event mask FAN_OPEN_EXEC_PERM Matthew Bobrowski
2018-11-13 17:53 ` [PATCH v7 0/4] fanotify: introduce new event mask FAN_OPEN_EXEC and FAN_OPEN_EXEC_PERM Jan Kara
2018-11-13 18:01   ` Amir Goldstein
2018-11-14  3:43     ` Amir Goldstein
2018-11-14 12:02       ` Jan Kara
2018-11-14 15:54         ` Amir Goldstein
2018-11-19 10:27         ` 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=20181119102757.GA8043@lithium.mbobrowski.org \
    --to=mbobrowski@mbobrowski.org \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sgrubb@redhat.com \
    /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).