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

Li Wang liwang@redhat.com
Sat Mar 9 09:11:19 CET 2024


On Fri, Mar 8, 2024 at 4:47 PM Petr Vorel <pvorel@suse.cz> wrote:

> 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.
>

Hmm, it is not very necessary at this moment.
Maybe in the future, it could be an extended direction.



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

Thanks a lot for testing/reviewing, the reset comments look good to me.

V2 is coming.


-- 
Regards,
Li Wang


More information about the ltp mailing list