All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	"ltp@lists.linux.it" <ltp@lists.linux.it>,
	Edvard Conrad <edvard@tuta.io>
Subject: Re: [LTP] [PATCH v3][STAGING] syscalls/fanotify26: Add test for nested permission events
Date: Fri, 30 Oct 2026 12:02:33 +0100	[thread overview]
Message-ID: <20261030110233.GA66190@pevik> (raw)
In-Reply-To: <CAOQ4uxitKA16-3Ka7YrL-ktf4mCa6Ljh9Lb3Fu6R+SATeSWo2g@mail.gmail.com>

Hi Edvard, Amir,

> > The kernel creates the file descriptor it reports with a permission
> > event by an open that must not generate further events. When the
> > reported path is on a stacked filesystem, that open opens the real file
> > on the backing filesystem, and since commit ebe559609d78 ("fs: get rid
> > of __FMODE_NONOTIFY kludge") the backing file no longer inherits
> > FMODE_NONOTIFY. A listener that also watches the backing filesystem is
> > then sent a second permission event from inside its own read(2), which
> > only the listener itself can answer, so a single reader never returns.

> > Verify that a listener returns from read(2) and answers an open
> > permission event for a file on an overlayfs mount. The first test case
> > marks the overlay only and passes on any kernel, the second one also
> > marks the backing filesystem, which is the shape an anti-malware
> > scanner uses on an overlayfs root.

> > The second case fails on a kernel without the pending fix "fs: let
> > backing files inherit FMODE_NONOTIFY from the user file", so the test
> > is added to runtest/staging for now.

> > Link: https://lore.kernel.org/all/P58Wrer--F-9@tuta.io/

> > Signed-off-by: Edvard Conrad <edvard@tuta.io>
> > ---
> > v2: https://lore.kernel.org/ltp/P50G-yE--F-9@tuta.io/

> > v3:
> > - Scale both process-state waits through tst_multiply_timeout(). The
> >   library scales all of its own deadlines, so on a KASAN or lockdep
> >   kernel a healthy but unscheduled listener was reported as blocked.
> > - Report TFAIL, not TBROK, for an unexpected event mask, and check the
> >   event's pid, following fanotify03.c. Answer the event either way, or
> >   the opener stays parked in the kernel.

+1.  I first thought wrong mask would be kind of fatal (i.e. to be fixed also in
fanotify03.c), but double checking it looks to be a normal error when test can
continue.

LGTM, I'll merge it in few hours.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

> > - Probe FAN_CLASS_CONTENT + FAN_MARK_FILESYSTEM + FAN_OPEN_PERM with
> >   REQUIRE_FANOTIFY_EVENTS_SUPPORTED_ON_FS(), the combination run()
> >   actually uses. The two previous probes checked neither class nor mask.
> > - Use SAFE_READ_ALL rather than a literal 1, matching SAFE_WRITE_ALL.
> > - Drop the explicit SAFE_WAITPID() for the opener. tst_reap_children()
> >   runs after every iteration and checks the exit status this discarded.
> > - Drop three unused includes.

> > Amir's Reviewed-by from v2 is not carried over: the failure reporting
> > and the support probe changed since, so it needs a fresh look.

> Still looks good

> Reviewed-by: Amir Goldstein <amir73il@gmail.com>


> > Not changed: the [STAGING] keyword stays in the patch subject rather
> > than the commit subject, which is the form ground_rules.rst documents.
> > Answered on the v2 thread.

Sure.

> > Tested on mainline v7.3-16259-g6b4b543fa18 with and without the pending
> > fix: both cases pass with it, and the second fails without it.

FYI Once we get kernel fix in Linus' tree we add it into "linux-git" tag and
move test into runtest/syscalls. Please send then a follow up patch (or Cc me
with info it got merged and I can do it).

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-10-30 11:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 21:21 [LTP] [PATCH v3][STAGING] syscalls/fanotify26: Add test for nested permission events Edvard Conrad via ltp
2026-10-30  0:27 ` [LTP] " linuxtestproject.agent
2026-10-30  9:22 ` [LTP] [PATCH v3][STAGING] " Amir Goldstein
2026-10-30 11:02   ` Petr Vorel [this message]
2026-10-30 16:38 ` Petr Vorel

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=20261030110233.GA66190@pevik \
    --to=pvorel@suse.cz \
    --cc=amir73il@gmail.com \
    --cc=edvard@tuta.io \
    --cc=jack@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.