lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 18 May 2021 13:52:02 -0700
From:   Brendan Higgins <brendanhiggins@...gle.com>
To:     David Gow <davidgow@...gle.com>
Cc:     Shuah Khan <shuah@...nel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        KUnit Development <kunit-dev@...glegroups.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Jonathan Corbet <corbet@....net>,
        "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
        Stephen Boyd <sboyd@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Frank Rowand <frowand.list@...il.com>,
        Daniel Latypov <dlatypov@...gle.com>
Subject: Re: [PATCH v1 1/4] kunit: Add 'kunit_shutdown' option

On Sat, May 15, 2021 at 12:58 AM David Gow <davidgow@...gle.com> wrote:
>
> On Sat, May 8, 2021 at 5:31 AM Brendan Higgins
> <brendanhiggins@...gle.com> wrote:
> >
> > From: David Gow <davidgow@...gle.com>
> >
> > Add a new kernel command-line option, 'kunit_shutdown', which allows the
> > user to specify that the kernel poweroff, halt, or reboot after
> > completing all KUnit tests; this is very handy for running KUnit tests
> > on UML or a VM so that the UML/VM process exits cleanly immediately
> > after running all tests without needing a special initramfs.
> >
> > Signed-off-by: David Gow <davidgow@...gle.com>
> > Signed-off-by: Brendan Higgins <brendanhiggins@...gle.com>
> > Reviewed-by: Stephen Boyd <sboyd@...nel.org>
> > Tested-By: Daniel Latypov <dlatypov@...gle.com>
> > ---
>
> Obviously I'm okay with this change, but I did find a minor whitespace
> nitpick below.
>
> >  lib/kunit/executor.c                | 20 ++++++++++++++++++++
> >  tools/testing/kunit/kunit_kernel.py |  2 +-
> >  tools/testing/kunit/kunit_parser.py |  2 +-
> >  3 files changed, 22 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
> > index 15832ed446685..7db619624437c 100644
> > --- a/lib/kunit/executor.c
> > +++ b/lib/kunit/executor.c
> > @@ -1,5 +1,6 @@
> >  // SPDX-License-Identifier: GPL-2.0
> >
> > +#include <linux/reboot.h>
> >  #include <kunit/test.h>
> >  #include <linux/glob.h>
> >  #include <linux/moduleparam.h>
> > @@ -18,6 +19,9 @@ module_param(filter_glob, charp, 0);
> >  MODULE_PARM_DESC(filter_glob,
> >                 "Filter which KUnit test suites run at boot-time, e.g. list*");
> >
> > +static char *kunit_shutdown;
> > +core_param(kunit_shutdown, kunit_shutdown, charp, 0644);
> > +
> >  static struct kunit_suite * const *
> >  kunit_filter_subsuite(struct kunit_suite * const * const subsuite)
> >  {
> > @@ -82,6 +86,20 @@ static struct suite_set kunit_filter_suites(void)
> >         return filtered;
> >  }
> >
> > +static void kunit_handle_shutdown(void)
> > +{
> > +       if (!kunit_shutdown)
> > +               return;
> > +
> > +       if (!strcmp(kunit_shutdown, "poweroff"))
> > +               kernel_power_off();
> > +       else if (!strcmp(kunit_shutdown, "halt"))
> > +               kernel_halt();
> > +       else if (!strcmp(kunit_shutdown, "reboot"))
> > +               kernel_restart(NULL);
> > +
> > +}
> > +
> >  static void kunit_print_tap_header(struct suite_set *suite_set)
> >  {
> >         struct kunit_suite * const * const *suites, * const *subsuite;
> > @@ -112,6 +130,8 @@ int kunit_run_all_tests(void)
> >                 kfree(suite_set.start);
> >         }
> >
> > +       kunit_handle_shutdown();
> > +
> >         return 0;
> >  }
> >
> > diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
> > index 89a7d4024e878..e22ade9d91ad5 100644
> > --- a/tools/testing/kunit/kunit_kernel.py
> > +++ b/tools/testing/kunit/kunit_kernel.py
> > @@ -208,7 +208,7 @@ class LinuxSourceTree(object):
> >         def run_kernel(self, args=None, build_dir='', filter_glob='', timeout=None) -> Iterator[str]:
> >                 if not args:
> >                         args = []
> > -               args.extend(['mem=1G', 'console=tty'])
> > +               args.extend(['mem=1G', 'console=tty','kunit_shutdown=halt'])
> Nit: space here between 'console=tty', and 'kunit_shutdown=halt'.

Whoops, I probably introduced it after addressing a rebase conflict.

Thanks, will fix.

> >                 if filter_glob:
> >                         args.append('kunit.filter_glob='+filter_glob)
> >                 self._ops.linux_bin(args, timeout, build_dir)
> > diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kunit_parser.py
> > index e8bcc139702e2..8d8d4d70b39dd 100644
> > --- a/tools/testing/kunit/kunit_parser.py
> > +++ b/tools/testing/kunit/kunit_parser.py
> > @@ -49,7 +49,7 @@ class TestStatus(Enum):
> >
> >  kunit_start_re = re.compile(r'TAP version [0-9]+$')
> >  kunit_end_re = re.compile('(List of all partitions:|'
> > -                         'Kernel panic - not syncing: VFS:)')
> > +                         'Kernel panic - not syncing: VFS:|reboot: System halted)')
> >
> >  def isolate_kunit_output(kernel_output) -> Iterator[str]:
> >         started = False
> > --
> > 2.31.1.607.g51e8a6a459-goog
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ