On Mon, May 25, 2020 at 11:44 AM Jan Kara <jack@xxxxxxx> wrote: > > On Sun 24-05-20 10:24:41, Amir Goldstein wrote: > > The comments in fanotify_group_event_mask() say: > > > > "If the event is on dir/child and this mark doesn't care about > > events on dir/child, don't send it!" > > > > Specifically, mount and filesystem marks do not care about events > > on child, but they can still specify an ignore mask for those events. > > For example, a group that has: > > - A mount mark with mask 0 and ignore_mask FAN_OPEN > > - An inode mark on a directory with mask FAN_OPEN | FAN_OPEN_EXEC > > with flag FAN_EVENT_ON_CHILD > > > > A child file open for exec would be reported to group with the FAN_OPEN > > event despite the fact that FAN_OPEN is in ignore mask of mount mark, > > because the mark iteration loop skips over non-inode marks for events > > on child when calculating the ignore mask. > > > > Move ignore mask calculation to the top of the iteration loop block > > before excluding marks for events on dir/child. > > > > Reported-by: Jan Kara <jack@xxxxxxx> > > Link: https://lore.kernel.org/linux-fsdevel/20200521162443.GA26052@xxxxxxxxxxxxxx/ > > Fixes: 55bf882c7f13 "fanotify: fix merging marks masks with FAN_ONDIR" > > Fixes: b469e7e47c8a "fanotify: fix handling of events on child..." > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > > Thanks! I've added the patch to my tree. I don't think this is really > urgent fix so I plan to push it to Linus in the coming merge window. > Agreed. Thanks, Amir.