]> git.ipfire.org Git - thirdparty/glibc.git/commit
x86: Fix page cross case in rawmemchr-avx2 [BZ #29234]
authorNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 8 Jun 2022 21:34:59 +0000 (14:34 -0700)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Thu, 9 Jun 2022 00:07:34 +0000 (17:07 -0700)
commit2c9af8421d2b4a7fcce163e7bc81a118d22fd346
tree4091d9f714fb5a2ae8e3bac3e7fe26268bfde82b
parentaa13fd16183949bbc40b010552e2e42003ebee62
x86: Fix page cross case in rawmemchr-avx2 [BZ #29234]

commit 6dcbb7d95dded20153b12d76d2f4e0ef0cda4f35
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Mon Jun 6 21:11:33 2022 -0700

    x86: Shrink code size of memchr-avx2.S

Changed how the page cross case aligned string (rdi) in
rawmemchr. This was incompatible with how
`L(cross_page_continue)` expected the pointer to be aligned and
would cause rawmemchr to read data start started before the
beginning of the string. What it would read was in valid memory
but could count CHAR matches resulting in an incorrect return
value.

This commit fixes that issue by essentially reverting the changes to
the L(page_cross) case as they didn't really matter.

Test cases added and all pass with the new code (and where confirmed
to fail with the old code).
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
string/test-rawmemchr.c
sysdeps/x86_64/multiarch/memchr-avx2.S