[LTP] [PATCH v2] lsm: fix overset attr test

Cyril Hrubis chrubis@suse.cz
Fri Jun 6 11:09:39 CEST 2025


Hi!
> LSM(s) usually handle their own internal errors in a different way,
> so the right way to check if they return error, is to verify that the
> common return value is -1. This is the max we can do, since errno might
> vary according to the LSM implementation.

Is there a small set of errnos that would make sense for each failure?

We have TST_EXP_FAIL_ARR() for filesystem tests for the case where there
are a few different possible error outcomes, maybe the same approach
would work here as well.

> At the same time, overset attr test is _not_ checking if attr is
> overset, but rather checking if attr is out-of-bounds, considering OR
> operator as a valid way to generate an invalid value with
> LSM_ATTR_CURRENT. This is not correct, since any OR operation using
> LSM_ATTR_CURRENT will generate a valid value for the LSM(s) code. So we
> remove this test that doesn't make much sense at the moment and replace
> it with an "invalid attr test" instead.

That part looks good to me.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list