|
|
513694 |
From 0ad216b458445251e6f98d74382faf3606569731 Mon Sep 17 00:00:00 2001
|
|
|
513694 |
From: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
|
513694 |
Date: Tue, 15 Feb 2022 08:18:15 -0600
|
|
|
513694 |
Subject: [PATCH] x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ
|
|
|
513694 |
#29127]
|
|
|
513694 |
|
|
|
513694 |
Re-cherry-pick commit c627209832 for strcmp-avx2.S change which was
|
|
|
513694 |
omitted in intial cherry pick because at the time this bug was not
|
|
|
513694 |
present on release branch.
|
|
|
513694 |
|
|
|
513694 |
Fixes BZ #29127.
|
|
|
513694 |
|
|
|
513694 |
In the overflow fallback strncmp-avx2-rtm and wcsncmp-avx2-rtm would
|
|
|
513694 |
call strcmp-avx2 and wcscmp-avx2 respectively. This would have
|
|
|
513694 |
not checks around vzeroupper and would trigger spurious
|
|
|
513694 |
aborts. This commit fixes that.
|
|
|
513694 |
|
|
|
513694 |
test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass on
|
|
|
513694 |
AVX2 machines with and without RTM.
|
|
|
513694 |
|
|
|
513694 |
Co-authored-by: H.J. Lu <hjl.tools@gmail.com>
|
|
|
513694 |
(cherry picked from commit c6272098323153db373f2986c67786ea8c85f1cf)
|
|
|
513694 |
---
|
|
|
513694 |
sysdeps/x86_64/multiarch/strcmp-avx2.S | 8 ++------
|
|
|
513694 |
1 file changed, 2 insertions(+), 6 deletions(-)
|
|
|
513694 |
|
|
|
513694 |
diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
|
513694 |
index 28cc98b6..e267c6cb 100644
|
|
|
513694 |
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
|
513694 |
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
|
513694 |
@@ -345,10 +345,10 @@ L(one_or_less):
|
|
|
513694 |
movq %LOCALE_REG, %rdx
|
|
|
513694 |
# endif
|
|
|
513694 |
jb L(ret_zero)
|
|
|
513694 |
-# ifdef USE_AS_WCSCMP
|
|
|
513694 |
/* 'nbe' covers the case where length is negative (large
|
|
|
513694 |
unsigned). */
|
|
|
513694 |
- jnbe __wcscmp_avx2
|
|
|
513694 |
+ jnbe OVERFLOW_STRCMP
|
|
|
513694 |
+# ifdef USE_AS_WCSCMP
|
|
|
513694 |
movl (%rdi), %edx
|
|
|
513694 |
xorl %eax, %eax
|
|
|
513694 |
cmpl (%rsi), %edx
|
|
|
513694 |
@@ -357,10 +357,6 @@ L(one_or_less):
|
|
|
513694 |
negl %eax
|
|
|
513694 |
orl $1, %eax
|
|
|
513694 |
# else
|
|
|
513694 |
- /* 'nbe' covers the case where length is negative (large
|
|
|
513694 |
- unsigned). */
|
|
|
513694 |
-
|
|
|
513694 |
- jnbe __strcmp_avx2
|
|
|
513694 |
movzbl (%rdi), %eax
|
|
|
513694 |
movzbl (%rsi), %ecx
|
|
|
513694 |
TOLOWER_gpr (%rax, %eax)
|
|
|
513694 |
--
|
|
|
513694 |
GitLab
|
|
|
513694 |
|