Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Aug 2023 20:37:28 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Robert Clausecker <fuz@FreeBSD.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 3d8ef251aa9d - main - lib/libc/amd64/string/strchrnul.S: fix edge case in scalar code
Message-ID:  <457A2B01-A4B0-4373-BD06-6BEBED922980@freebsd.org>
In-Reply-To: <202308251923.37PJN6EM082298@gitrepo.freebsd.org>
References:  <202308251923.37PJN6EM082298@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 25 Aug 2023, at 20:23, Robert Clausecker <fuz@FreeBSD.org> wrote:
>=20
> The branch main has been updated by fuz:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D3d8ef251aa9dceabd57f7821a0e6749d=
35317db3
>=20
> commit 3d8ef251aa9dceabd57f7821a0e6749d35317db3
> Author:     Robert Clausecker <fuz@FreeBSD.org>
> AuthorDate: 2023-08-25 16:22:22 +0000
> Commit:     Robert Clausecker <fuz@FreeBSD.org>
> CommitDate: 2023-08-25 19:21:54 +0000
>=20
>    lib/libc/amd64/string/strchrnul.S: fix edge case in scalar code
>=20
>    When the buffer is immediately preceeded by the character we
>    are looking for and begins with one higher than that character,
>    and the buffer is misaligned, a match was errorneously detected
>    in the first character.  Fix this by changing the way we prevent
>    matches before the buffer from being detected: instead of
>    removing the corresponding bit from the 0x80..80 mask, set the
>    LSB of bytes before the buffer after xoring with the character we
>    look for.
>=20
>    The bug only affects amd64 with ARCHLEVEL=3Dscalar (cf. simd(7)).
>    The change comes at a 2% performance impact for short strings
>    if ARCHLEVEL is set to scalar.  The default configuration is not
>    affected.

That such bugs are being found in even the *scalar* code is concerning.
How confident are we that all the various implementations have in fact
been adequately tested if this slipped through? We have the 14 release
coming up, and this makes me nervous about whether all this code is
really ready for prime time yet. This seems like the kind of thing that
needs a long time to bake in -CURRENT so that it can be used in anger
and, hopefully, have all the edge cases hit. What have they been tested
against, anyway? Can we borrow test suites from other projects?

Jess




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?457A2B01-A4B0-4373-BD06-6BEBED922980>