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]
Message-ID: <CAGS_qxoeKishaVvHk-HCvstWJrZ8gXRrQipGd-sz=ONrPjteZw@mail.gmail.com>
Date:   Fri, 13 Jan 2023 17:38:17 -0800
From:   Daniel Latypov <dlatypov@...gle.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Guenter Roeck <linux@...ck-us.net>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        David Gow <davidgow@...gle.com>,
        Nathan Chancellor <nathan@...nel.org>,
        linux-hardening@...r.kernel.org, Vlastimil Babka <vbabka@...e.cz>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Miguel Ojeda <ojeda@...nel.org>,
        Isabella Basso <isabbasso@...eup.net>,
        Dan Williams <dan.j.williams@...el.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kunit: memcpy: Split slow memcpy tests into MEMCPY_SLOW_KUNIT_TEST

On Fri, Jan 13, 2023 at 4:54 PM Kees Cook <keescook@...omium.org> wrote:
> diff --git a/lib/memcpy_kunit.c b/lib/memcpy_kunit.c
> index 89128551448d..5a545e1b5dbb 100644
> --- a/lib/memcpy_kunit.c
> +++ b/lib/memcpy_kunit.c
> @@ -307,8 +307,12 @@ static void set_random_nonzero(struct kunit *test, u8 *byte)
>         }
>  }
>
> -static void init_large(struct kunit *test)
> +static int init_large(struct kunit *test)
>  {
> +       if (!IS_ENABLED(CONFIG_MEMCPY_SLOW_KUNIT_TEST)) {
> +               kunit_skip(test, "Slow test skipped. Enable with CONFIG_MEMCPY_SLOW_KUNIT_TEST=y");
> +               return -EBUSY;

Note: kunit_skip() here means you don't need explicit returns in the test cases.
kunit_skip() is basically
  kunit_mark_skipped(test, "reason");
  kthread_complete_and_exit(...);

So the diff in this file could be reduced down to just these 2 lines
  if (!IS_ENABLED(...))
      kunit_skip(test, "...")

But I can see the appeal of being more explicit about the control flow.
In that case, you could switch kunit_mark_skipped(), which just sets
the status and doesn't affect control flow at all.

Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ