[LTP] [PATCH 2/2] Add test for fanotify monitoring of tracing filesystem

Petr Vorel pvorel@suse.cz
Tue Feb 24 15:31:42 CET 2026


> Hi!

> On 2/24/26 14:40, Petr Vorel wrote:
> > > +static void setup(void)
> > > +{
> > > +	if (tst_fs_type(MNTPOINT) != TST_TRACEFS_MAGIC) {
> > > +		SAFE_MOUNT("tracefs", MNTPOINT, "tracefs",
> > > +			MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL);

> > I see possible mounting is the reason...

> > > +		unmount_needed = 1;
> > > +	}
> > > +
> > > +	if (access(EVENTS_SYSFILE, F_OK))
> > > +		tst_brk(TCONF, "Kprobe events not supported by kernel");

> > ... why we cannot check /sys/kernel/tracing/kprobe_events presence via
> > .save_restore.

> Well, yes, tracefs may need to be mounted during test setup. But
> .save_restore also assumes that sysfiles contain only one line while
> kprobe_events may hold arbitrarily long kprobe list. Also note that the
> restore function opens the sysfile with O_TRUNC, which might wipe all
> existing kprobes before creating them again. Therefore I've decided to check
> the file availability in setup() and send a targeted kprobe delete command
> instead of saving and restoring the whole sysfile.

Makes sense. Thanks for info.

Kind regards,
Petr


More information about the ltp mailing list