public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug string/25933] Off by one error in __strncmp_avx2 when length=VEC_SIZE*4 and strings are at page boundaries can cause a segfault
Date: Sun, 07 Jun 2020 20:43:03 +0000 [thread overview]
Message-ID: <bug-25933-131-CKgFNpbbPy@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-25933-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=25933
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Sunil Pandey from comment #6)
> (In reply to H.J. Lu from comment #5)
> > (In reply to Sunil Pandey from comment #4)
> > > Created attachment 12601 [details]
> > > strncmp_avx2 patch for pr25933
> > >
> > > Tested attached patch on
> > >
> > > https://gitlab.com/x86-glibc/glibc/-/commits/users/hjl/pr25933/master
> >
> > Looks good. Please try this
> >
> > diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S
> > b/sysdeps/x86_64/multiarch/strcmp-avx2.S
> > index 48d03a9f46..dabc3e7590 100644
> > --- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
> > +++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
> > @@ -256,6 +256,11 @@ L(next_3_vectors):
> > vpmovmskb %ymm0, %ecx
> > testl %ecx, %ecx
> > jne L(return_3_vec_size)
> > +# ifdef USE_AS_STRNCMP
> > + /* Check if VEC_SIZE * 4 already exceeded max compare count %r11 */
> > + cmpq $(VEC_SIZE * 4), %r11
> > + jbe L(zero)
> > +# endif
> > L(main_loop_header):
> > leaq (VEC_SIZE * 4)(%rdi), %rdx
> > movl $PAGE_SIZE, %ecx
>
> It fixes the issue on my setup as expected.
>
> $ ./test-strncmp
> simple_strncmp stupid_strncmp __strncmp_avx2
> __strncmp_sse42 __strncmp_ssse3 __strncmp_sse2
> $ echo $?
> 0
>
Did you run "make check"?
--
You are receiving this mail because:
You are on the CC list for the bug.
next prev parent reply other threads:[~2020-06-07 20:43 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-06 23:49 [Bug string/25933] New: " dpmendenhall at gmail dot com
2020-05-07 0:46 ` [Bug string/25933] " hjl.tools at gmail dot com
2020-05-07 2:23 ` dpmendenhall at gmail dot com
2020-05-07 13:07 ` adhemerval.zanella at linaro dot org
2020-05-07 14:26 ` hjl.tools at gmail dot com
2020-05-08 23:03 ` lsg.tools at gmail dot com
2020-05-19 16:52 ` skpgkp2 at gmail dot com
2020-05-19 17:39 ` hjl.tools at gmail dot com
2020-06-07 18:15 ` skpgkp2 at gmail dot com
2020-06-07 18:30 ` hjl.tools at gmail dot com
2020-06-07 20:03 ` skpgkp2 at gmail dot com
2020-06-07 20:43 ` hjl.tools at gmail dot com [this message]
2020-06-07 21:46 ` skpgkp2 at gmail dot com
2020-06-07 21:58 ` hjl.tools at gmail dot com
2020-06-07 22:01 ` hjl.tools at gmail dot com
2020-06-07 23:05 ` hjl.tools at gmail dot com
2020-06-08 1:26 ` hjl.tools at gmail dot com
2020-06-09 2:30 ` hjl.tools at gmail dot com
2020-06-10 8:21 ` skpgkp2 at gmail dot com
2020-06-10 13:11 ` hjl.tools at gmail dot com
2020-06-11 2:03 ` skpgkp2 at gmail dot com
2020-06-11 2:04 ` skpgkp2 at gmail dot com
2020-06-11 2:06 ` skpgkp2 at gmail dot com
2020-06-11 2:08 ` skpgkp2 at gmail dot com
2020-06-11 2:11 ` skpgkp2 at gmail dot com
2020-06-11 16:05 ` hjl.tools at gmail dot com
2020-06-13 11:27 ` hjl.tools at gmail dot com
2020-06-13 11:27 ` hjl.tools at gmail dot com
2020-06-13 11:27 ` hjl.tools at gmail dot com
2020-06-13 11:28 ` hjl.tools at gmail dot com
2020-06-13 11:28 ` hjl.tools at gmail dot com
2020-06-13 11:28 ` hjl.tools at gmail dot com
2020-07-04 16:47 ` cvs-commit at gcc dot gnu.org
2020-07-04 16:52 ` cvs-commit at gcc dot gnu.org
2020-07-04 17:02 ` cvs-commit at gcc dot gnu.org
2020-07-04 17:21 ` cvs-commit at gcc dot gnu.org
2020-07-04 17:22 ` hjl.tools at gmail dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-25933-131-CKgFNpbbPy@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=glibc-bugs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).