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] [day] [month] [year] [list]
Date:   Thu, 23 Feb 2023 13:43:41 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Palmer Dabbelt <palmer@...osinc.com>
Cc:     andy@...nel.org, linux-kernel@...r.kernel.org, heiko@...ech.de
Subject: Re: [PATCH] lib/test_string.c: Add strncmp() tests

On Thu, Feb 23, 2023 at 12:10 AM Palmer Dabbelt <palmer@...osinc.com> wrote:
>
> The RISC-V strncmp() fails on some inputs, see the linked thread for
> more details.  It turns out there were no strncmp() calls in the self
> tests, this adds one.  It currently fails on RISC-V systems with Zbb
> enabled with
>
>     [    0.683479] String selftest failure 7.00001001

...

> This reports a checkpatch error for the __initconst, but I think it's
> spurious as I've just pattern matched the above test.

Does moving outside of function help?

...

> +               unsigned long count;
> +               unsigned long max_off;
> +               size_t retval;
> +       } tests[] __initconst = {
> +               { "/dev/vda", "/dev/",    5, 4, 0 },
> +               { "/dev/vda", "/dev/vdb", 5, 4, 0 },

In the current state the max_off is redundant.

> +               for (off = 0; off <= s->max_off; ++off) {

Why pre-increment?

...

> +                       if (res == 0 && s->retval != 0)
> +                               return 0x1000 + 0x100*off + 0x10*i + 0x0;
> +                       if (res > 0 && s->retval <= 0)
> +                               return 0x1000 + 0x100*off + 0x10*i + 0x1;
> +                       if (res < 0 && s->retval >= 0)
> +                               return 0x1000 + 0x100*off + 0x10*i + 0x2;

But you don't have cases for +1 -1 results (positive, negative), why
not add them?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ