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

Martin Doucha mdoucha@suse.cz
Tue Feb 24 15:06:16 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.


-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list