about summary refs log tree commit diff
path: root/sysdeps/x86_64/multiarch/strcmp-avx2.S
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2022-02-15 08:18:15 -0600
committerNoah Goldstein <goldstein.w.n@gmail.com>2022-02-17 15:43:05 -0600
commitc6272098323153db373f2986c67786ea8c85f1cf (patch)
treef0285e4cd04dfd97b6faaf4601034b7d37560bef /sysdeps/x86_64/multiarch/strcmp-avx2.S
parentaa5a720056d37cf24924c138a3dbe6dace98e97c (diff)
downloadglibc-c6272098323153db373f2986c67786ea8c85f1cf.tar.gz
glibc-c6272098323153db373f2986c67786ea8c85f1cf.tar.xz
glibc-c6272098323153db373f2986c67786ea8c85f1cf.zip
x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ #28896]
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>
Diffstat (limited to 'sysdeps/x86_64/multiarch/strcmp-avx2.S')
-rw-r--r--sysdeps/x86_64/multiarch/strcmp-avx2.S8
1 files changed, 2 insertions, 6 deletions
diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
index 07a5a2c889..52ff5ad724 100644
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
@@ -193,10 +193,10 @@ L(ret_zero):
 	.p2align 4,, 5
 L(one_or_less):
 	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
@@ -205,10 +205,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
 	subl	%ecx, %eax