[LTP] [PATCH 2/3] init_module: To handle kernel module signature enforcement

Petr Vorel pvorel@suse.cz
Fri Mar 8 09:47:51 CET 2024


Hi Li,

> The patch modifies init_module syscall test cases to account
> for kernel module signature enforcement. It adds parsing for
> the 'module.sig_enforce' parameter and adjusts test expectations
> based on whether signature enforcement is enabled, using
> new conditional logic.

> If enforcement is active, tests expect an EKEYREJECTED error;
> otherwise, they proceed as normal.

...
> diff --git a/testcases/kernel/syscalls/delete_module/delete_module01.c b/testcases/kernel/syscalls/delete_module/delete_module01.c
> index 90d8b5289..4c31f81b0 100644
> --- a/testcases/kernel/syscalls/delete_module/delete_module01.c
> +++ b/testcases/kernel/syscalls/delete_module/delete_module01.c
> @@ -14,8 +14,10 @@
>   * Install dummy_del_mod.ko and delete it with delete_module(2).
>   */

> +#include <stdlib.h>
>  #include "tst_test.h"
>  #include "tst_module.h"
> +#include "tst_kconfig.h"
>  #include "lapi/syscalls.h"

>  #define MODULE_NAME	"dummy_del_mod"
> @@ -25,6 +27,12 @@ static int module_loaded;

>  static void do_delete_module(void)
>  {
> +	struct tst_kcmdline_param params = TST_KCMDLINE_INIT("module.sig_enforce");
> +
> +	tst_kcmdline_parse(&params, 1);
> +	if (atoi(params.value) == 1)
> +		tst_brk(TCONF, "module signature is enforced, skip test");
Only 2 tests do tst_brk(TCONF). I was thinking about adding library flag
.skip_in_module_sig_enforce, but probably not worth of it.

The rest LGTM.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list