Re: [PATCH v2 2/2] fsnotify: consistent behavior for parent not watching children

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 23, 2022 at 7:09 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Jun 21, 2022 at 06:04:33AM +0300, Amir Goldstein wrote:
> > On Mon, Jun 20, 2022 at 11:34 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > On Mon, Jun 20, 2022 at 05:16:16PM +0300, Amir Goldstein wrote:
> > > > On Wed, May 11, 2022 at 10:02 PM Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> > > > >
> > > > > The logic for handling events on child in groups that have a mark on
> > > > > the parent inode, but without FS_EVENT_ON_CHILD flag in the mask is
> > > > > duplicated in several places and inconsistent.
> > > > >
> > > > > Move the logic into the preparation of mark type iterator, so that the
> > > > > parent mark type will be excluded from all mark type iterations in that
> > > > > case.
> > > > >
> > > > > This results in several subtle changes of behavior, hopefully all
> > > > > desired changes of behavior, for example:
> > > > >
> > > > > - Group A has a mount mark with FS_MODIFY in mask
> > > > > - Group A has a mark with ignore mask that does not survive FS_MODIFY
> > > > >   and does not watch children on directory D.
> > > > > - Group B has a mark with FS_MODIFY in mask that does watch children
> > > > >   on directory D.
> > > > > - FS_MODIFY event on file D/foo should not clear the ignore mask of
> > > > >   group A, but before this change it does
> > > > >
> > > > > And if group A ignore mask was set to survive FS_MODIFY:
> > > > > - FS_MODIFY event on file D/foo should be reported to group A on account
> > > > >   of the mount mark, but before this change it is wrongly ignored
> > > > >
> > > > > Fixes: 2f02fd3fa13e ("fanotify: fix ignore mask logic for events on child and on dir")
> > > > > Reported-by: Jan Kara <jack@xxxxxxxx>
> > > > > Link: https://lore.kernel.org/linux-fsdevel/20220314113337.j7slrb5srxukztje@xxxxxxxxxx/
> > > > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> > > > > ---
> > > >
> > > > Greg,
> > > >
> > > > FYI, this needs the previous commit to apply to 5.18.y:
> > >
> > > What is "this" here?  What git id?
> >
> > Sorry, this commit:
> >
> > > > e730558adffb fsnotify: consistent behavior for parent not watching children
> >
> > Needs this previous commit:
> >
> > > > 14362a254179 fsnotify: introduce mark type iterator
> >
> > > > They won't apply to earlier versions and this is a fix for a very minor bug
> > > > that existed forever, so no need to bother.
> > >
> > > So what exactly needs to be applied in what order and to what trees?
> > >
> >
> > To apply to 5.18.y.
>
> Now queued up, thanks.
>
> > Don't bother trying to apply either to earlier trees.
>
> So the Fixes: tag lied?  No wonder I was confused :)

No it hasn't lied.

The fix could be backported to an earlier kernel, but it is not trivial
and I don't think it is worth the effort, because the behavior of this
corner case was undefined for the entire lifetime of fanotify.

IOW, if stable scripts send me the message that the patch
does not apply cleanly, I won't be doing anything about it.

Furthermore, I instrumented the LTP regression test for this
bug with:

        if (tc->ignore && tst_kvercmp(5, 19, 0) < 0) {
                tst_res(TCONF, "ignored mask on parent dir has undefined "
                                "behavior on kernel < 5.19");
                return;
        }

So no one is going to be asking for this backport, unless they really
encounter the problem in real world use cases.

Thanks,
Amir.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux