public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.34/master] x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ #29127]
@ 2022-05-25 23:08 Sunil Pandey
  0 siblings, 0 replies; only message in thread
From: Sunil Pandey @ 2022-05-25 23:08 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=83ae8287c1c3009459ff29241b647ff61363b22c

commit 83ae8287c1c3009459ff29241b647ff61363b22c
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Tue Feb 15 08:18:15 2022 -0600

    x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ #29127]
    
    Re-cherry-pick commit c627209832 for strcmp-avx2.S change which was
    omitted in intial cherry pick because at the time this bug was not
    present on release branch.
    
    Fixes BZ #29127.
    
    In the overflow fallback strncmp-avx2-rtm and wcsncmp-avx2-rtm would
    call strcmp-avx2 and wcscmp-avx2 respectively. This would have
    not checks around vzeroupper and would trigger spurious
    aborts. This commit fixes that.
    
    test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass on
    AVX2 machines with and without RTM.
    
    Co-authored-by: H.J. Lu <hjl.tools@gmail.com>
    (cherry picked from commit c6272098323153db373f2986c67786ea8c85f1cf)

Diff:
---
 sysdeps/x86_64/multiarch/strcmp-avx2.S | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
index aa91f6e48a..a9806daadb 100644
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
@@ -345,10 +345,10 @@ L(one_or_less):
 	movq	%LOCALE_REG, %rdx
 #  endif
 	jb	L(ret_zero)
-#  ifdef USE_AS_WCSCMP
 	/* 'nbe' covers the case where length is negative (large
 	   unsigned).  */
-	jnbe	__wcscmp_avx2
+	jnbe	OVERFLOW_STRCMP
+#  ifdef USE_AS_WCSCMP
 	movl	(%rdi), %edx
 	xorl	%eax, %eax
 	cmpl	(%rsi), %edx
@@ -357,10 +357,6 @@ L(one_or_less):
 	negl	%eax
 	orl	$1, %eax
 #  else
-	/* 'nbe' covers the case where length is negative (large
-	   unsigned).  */
-
-	jnbe	__strcmp_avx2
 	movzbl	(%rdi), %eax
 	movzbl	(%rsi), %ecx
 	TOLOWER_gpr (%rax, %eax)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-25 23:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 23:08 [glibc/release/2.34/master] x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ #29127] Sunil Pandey

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).