[LTP] [PATCH] syscalls/fanotify26: Add directory cases for the nested event
Amir Goldstein
amir73il@gmail.com
Tue Nov 3 08:43:14 CET 2026
On Tue, Nov 3, 2026 at 8:24 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Amir, Edvard,
>
> > On Sat, Oct 31, 2026 at 10:13 PM Edvard Conrad <edvard@tuta.io> wrote:
>
> > > A directory on overlayfs reaches its real directory through
> > > ovl_dir_open_realfile() rather than backing_file_open(), so the fix
> > > for regular files, commit c3d355f427ce ("fs: let backing files
> > > inherit FMODE_NONOTIFY from the user file"), does not cover it: a
> > > listener that marks the backing filesystem with FAN_OPEN_PERM |
> > > FAN_ONDIR is still sent a nested permission event from its own
> > > read(2) when the reported path is an overlay directory.
>
> > > Add the directory counterparts of the two existing cases. The
> > > listener's expected event mask stays FAN_OPEN_PERM: FAN_ONDIR is not
> > > reported to a group without FAN_REPORT_FID.
>
> > > The fourth case fails on a kernel without the pending fix "ovl:
> > > inherit FMODE_NONOTIFY when opening directory realfiles".
>
> > > Signed-off-by: Edvard Conrad <edvard@tuta.io>
>
> > Reviewed-by: Amir Goldstein <amir73il@gmail.com>
>
> > > ---
> > > Depends on the pending overlayfs fix, posted by Amir on the kernel
> > > thread:
> > > https://lore.kernel.org/all/CAOQ4uxjm=cGPnug18VuhKqiMvkWwLPNLO_TE3KxO8iLZG+veYQ@mail.gmail.com/
> > > Without it the fourth case fails on current mainline, so this should
> > > wait in the queue until that fix is in Linus' tree; a linux-git tag for
> > > it can then be added. The first three cases pass on v7.4-rc1 material
> > > today.
>
> > > Tested in a VM, each kernel run once and with -i 2:
>
> > > kernel file+backing dir+backing
> > > v6.13 PASS FAIL
> > > 6b4b543fa18 (no fix) FAIL FAIL
> > > + c3d355f427ce (files, in Linus') PASS FAIL
> > > + the pending ovl fix PASS PASS
>
> > > The "overlay mark only" cases pass everywhere. The directory case
> > > fails on v6.13 too: overlayfs never passed the nonotify state on to
> > > the real directory, so it predates the 6.14 change that broke files.
>
> > As far as I can tell its a regression from
> > 130fdbc3d1f99 ("ovl: pass correct flags for opening real directory")
>
> > Thanks for adding this test.
> > I added your Tested-by to the fix patch.
>
> I'm going to merge today. So there will be hash for fixing kernel commit,
> thanks for info.
>
FYI, Edvard found another bug and has written an extra test case to cover it
the expected kernel fix is going to cover the directory test cases in this patch
as well as the extra test case:
https://lore.kernel.org/linux-unionfs/P5Qu3co--N-9@tuta.io/
Up to you if you want to merge now or wait for the extra test case.
Thanks,
Amir.
More information about the ltp
mailing list