public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Po-Hsu Lin <po-hsu.lin@canonical.com>
Cc: rbm@suse.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] device-drivers: *module: Use helpers for module signature enforcement
Date: Tue, 31 Dec 2024 12:50:40 +0100	[thread overview]
Message-ID: <20241231115040.GD36475@pevik> (raw)
In-Reply-To: <20241231043457.270557-1-po-hsu.lin@canonical.com>

Hi Po-Hsu Lin,

> > +++ b/testcases/kernel/device-drivers/acpi/ltp_acpi.c
> > @@ -22,7 +22,6 @@
> >  #include <stdlib.h>

> >  #include "test.h"
> > -#include "tst_kconfig.h"
> >  #include "old_module.h"
> >  #include "safe_macros.h"

> > @@ -129,20 +128,12 @@ static void test_run(void)
> >  int main(int argc, char *argv[])
> >  {
> >  	int acpi_disabled;
> > -	struct tst_kcmdline_var params = TST_KCMDLINE_INIT("module.sig_enforce");
> > -	struct tst_kconfig_var kconfig = TST_KCONFIG_INIT("CONFIG_MODULE_SIG_FORCE");

> >  	tst_parse_opts(argc, argv, NULL, NULL);
> > -
> >  	tst_require_root();
> > -
> > -	tst_kcmdline_parse(&params, 1);
> > -	tst_kconfig_read(&kconfig, 1);
> > -	if (params.found || kconfig.choice == 'y')
> > -		tst_brkm(TCONF, tst_exit, "module signature is enforced, skip test");
> > -
> >  	tst_sig(FORK, DEF_HANDLER, cleanup);

> > +	tst_check_module_signature_enforced();

> One question, should we put this tst_check_module_signature_enforced()
> before or after tst_sig()? Asking because it's different in tpci.c

I suppose either way is ok, because we don't call the cleanup function anyway.
Best would be to convert the test to the new LTP API.
But I'll move it in tpci.c below tst_sig().

...
> > +++ b/testcases/kernel/syscalls/finit_module/finit_module01.c
> > @@ -17,7 +17,6 @@
> >  #include <errno.h>
> >  #include "lapi/init_module.h"
> >  #include "tst_module.h"
> > -#include "tst_kconfig.h"

> >  #define MODULE_NAME	"finit_module.ko"

> > @@ -27,14 +26,7 @@ static char *mod_path;

> >  static void setup(void)
> >  {
> > -	struct tst_kcmdline_var params = TST_KCMDLINE_INIT("module.sig_enforce");
> > -	struct tst_kconfig_var kconfig = TST_KCONFIG_INIT("CONFIG_MODULE_SIG_FORCE");
> > -
> > -	tst_kcmdline_parse(&params, 1);
> > -	tst_kconfig_read(&kconfig, 1);
> > -	if (params.found || kconfig.choice == 'y')
> > -		sig_enforce = 1;

> This test will expect an EKEYREJECTED error if the module signature is
> enforced. So I think:

> if (tst_module_signature_enforced())
> 	sig_enforce = 1;

> And remove tst_check_module_signature_enforced() below, otherwise the
> test will be skipped.

+1. I have this in other tests, but obviously I omitted this in
finit_module01.c. I'll fix it in v2.

Thanks for your review!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2024-12-31 11:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-27 16:00 [LTP] [PATCH 0/2] module signature enforcement helpers Petr Vorel
2024-12-27 16:00 ` [LTP] [PATCH 1/2] lib: Add helpers for module signature enforcement Petr Vorel
2024-12-27 16:00 ` [LTP] [PATCH 2/2] device-drivers: *module: Use " Petr Vorel
2024-12-31  4:34 ` Po-Hsu Lin
2024-12-31 11:50   ` Petr Vorel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241231115040.GD36475@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=po-hsu.lin@canonical.com \
    --cc=rbm@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox