[LTP] [PATCH 3/7] Add lsm_get_self_attr02 test

Cyril Hrubis chrubis@suse.cz
Wed Jan 8 14:35:12 CET 2025


Hi!
> > +static void setup(void)
> > +{
> > +	page_size = SAFE_SYSCONF(_SC_PAGESIZE);
> > +
> > +	if (verify_enabled_lsm("selinux"))
> > +		lsm_count++;
> > +
> > +	if (verify_enabled_lsm("apparmor"))
> > +		lsm_count++;
> > +
> > +	if (verify_enabled_lsm("smack"))
> > +		lsm_count++;
> 
> Shouldn't we just look at the /sys/kernel/security/lsm file and if it
> exists and it's not empty there is a lsm on the system and the syscall
> will not fail in that case?

And looking into the documentation these attributes are currently
supported only by these three lsms. So this is correct, however the
pattern is repeated in other tests, so maybe put it into a inline
function into a common header?

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list