[LTP] [PATCH v4 4/7] Add lsm_get_self_attr03 test

Andrea Cervesato andrea.cervesato@suse.com
Mon Jun 2 18:35:56 CEST 2025


On 6/2/25 16:38, Cyril Hrubis wrote:
> Hi!
>>> 				next_ctx(next)
>>>
>>> Otherwise we will fail the check below.
>> Right.
> Feel free to add my Reviewed-by: with that fixed.
Ok
>
>>>> +	for (uint32_t i = 1; i < count; i++) {
>>>> +		TST_EXP_EXPR(strcmp(attr, (char *)next->ctx) != 0,
>>>> +			"Attribute and next LSM context must be different");
>>>> +
>>>> +		next = next_ctx(next);
>>>> +	}
>>> Have you actually tried this on a machine with more than one LSM active?
>> Fixed, also I think I we to check if "/sys/kernel/security/lsm" exists.
>> I guess it doesn't exist if no LSM are present.
> We do call verify_supported_attr_current(); in the setup, that should be
> enough. What I was asking for was if you ever tested this code on a
> mach9ine where the count > 1 so that the loop actually triggered.
>
I modify verify_supported_attr_current() in order to check if 
/sys/kernel/security/lsm exists.
And yes, I tested the code on a VM with 7 LSM(s).

Gonna send the next patch and then merge.

Thanks,
Andrea



More information about the ltp mailing list