[LTP] [PATCH 3/4] fanotify24: Add test for FAN_PRE_ACCESS and FAN_DENY_ERRNO
Amir Goldstein
amir73il@gmail.com
Mon Feb 10 18:06:23 CET 2025
On Mon, Feb 10, 2025 at 4:43 PM Jan Kara <jack@suse.cz> wrote:
>
> On Mon 10-02-25 16:13:15, Amir Goldstein wrote:
> > Fork the test fanotify24 from test fanotify03, replacing the
> > permission event FAN_ACCESS_PERM with the new pre-content event
> > FAN_PRE_ACCESS.
> >
> > The test is changed to use class FAN_CLASS_PRE_CONTENT, which is
> > required for FAN_PRE_ACCESS and this class also enabled the response
> > with cutomer error code FAN_DENY_ERRNO.
> >
> > Unlike FAN_ACCESS_PERM, FAN_PRE_ACCESS is also created on write()
> > system call. The test case expected results are adjusted to
> > respond with the default error (EPERM) to open() and write() and
> > to respond with custom errors (EIO, EBUSY) to read() and execve().
> >
> > Not all fs support pre-content events, so run on all filesystems
> > to excercise FAN_PRE_ACCESS on all supported filesystems.
> >
> > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>
> Looks good to me. I was just wondering whether some bits like
> generate_events(), mark setup, child setup, main test loop could not be
> factored out into a helper functions used by both old and new tests?
Yes, I agree that forking the tests is bad and that we need much
more common helpers.
IIUC, LTP developers are going to try to come up with some proposals
for refactoring helpers to split some large fanotify tests [1][2].
My opinion is that factoring out helpers that are useful only for
fanotify03,fanotify24 is suboptimal and we need to see if we can
create much more generic helpers that could be shared by more tests.
BTW, if you look closer, you will see that generate_events() is quite
different between fanotify03 and fanotify24, although it is true that
fanotify24 has a more generalized version that follows the expected
events more closely.
I did start with extending fanotify03 before I forked it and before the
fork generate_events() was even more hard to follow because of
the difference in expected events for write() between permission
and pre-content events.
Thanks,
Amir.
[1] https://lore.kernel.org/ltp/71d4414b-802f-4019-8527-e8886e2d1aeb@suse.cz/
[2] https://lore.kernel.org/ltp/20250131164217.GA1135694@pevik/
More information about the ltp
mailing list