From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Matthew Bobrowski <repnop@google.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>
Subject: Re: [PATCH] fanotify: refine the validation checks on non-dir inode mask
Date: Wed, 29 Jun 2022 12:09:24 +0200 [thread overview]
Message-ID: <20220629100924.kvr6rbaanudmennh@quack3> (raw)
In-Reply-To: <CAOQ4uxj4EFTrMHfVY=wFt9aAJakNVQA6_Vq-y-b7yvB0tEDsiQ@mail.gmail.com>
On Tue 28-06-22 20:22:28, Amir Goldstein wrote:
> On Tue, Jun 28, 2022 at 12:27 PM Jan Kara <jack@suse.cz> wrote:
> >
> > On Mon 27-06-22 20:47:19, Amir Goldstein wrote:
> > > Commit ceaf69f8eadc ("fanotify: do not allow setting dirent events in
> > > mask of non-dir") added restrictions about setting dirent events in the
> > > mask of a non-dir inode mark, which does not make any sense.
> > >
> > > For backward compatibility, these restictions were added only to new
> > > (v5.17+) APIs.
> > >
> > > It also does not make any sense to set the flags FAN_EVENT_ON_CHILD or
> > > FAN_ONDIR in the mask of a non-dir inode. Add these flags to the
> > > dir-only restriction of the new APIs as well.
> > >
> > > Move the check of the dir-only flags for new APIs into the helper
> > > fanotify_events_supported(), which is only called for FAN_MARK_ADD,
> > > because there is no need to error on an attempt to remove the dir-only
> > > flags from non-dir inode.
> > >
> > > Fixes: ceaf69f8eadc ("fanotify: do not allow setting dirent events in mask of non-dir")
> > > Link: https://lore.kernel.org/linux-fsdevel/20220627113224.kr2725conevh53u4@quack3.lan/
> > > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> >
> > Thanks! I've taken the patch to my tree.
> >
> > Honza
> >
> > > [1] https://github.com/amir73il/ltp/commits/fan_enotdir
> > > [2] https://github.com/amir73il/man-pages/commits/fanotify_target_fid
>
> Mathew and Jan,
>
> Please let me know if I can keep your RVB on the man page patch for
> FAN_REPORT_TARGET_FID linked above.
>
> The only change is an update to the ENOTDIR section which ends up like this:
>
> ENOTDIR
> flags contains FAN_MARK_ONLYDIR, and dirfd and pathname
> do not specify a directory.
>
> ENOTDIR
> mask contains FAN_RENAME, and dirfd and pathname do not
> specify a directory.
>
> ENOTDIR
> flags contains FAN_MARK_IGNORE, or the fanotify group
> was initialized with
> flag FAN_REPORT_TARGET_FID, and mask contains directory
> entry modification
> events (e.g., FAN_CREATE, FAN_DELETE), or directory event flags
> (e.g., FAN_ONDIR, FAN_EVENT_ON_CHILD),
> and dirfd and pathname do not specify a directory.
Looks good to me. Thanks!
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2022-06-29 10:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 17:47 [PATCH] fanotify: refine the validation checks on non-dir inode mask Amir Goldstein
2022-06-28 9:27 ` Jan Kara
2022-06-28 17:22 ` Amir Goldstein
2022-06-29 10:09 ` Jan Kara [this message]
2022-07-02 5:59 ` Matthew Bobrowski
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=20220629100924.kvr6rbaanudmennh@quack3 \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=repnop@google.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