From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7852) id 5B0E1383E6A3; Wed, 25 May 2022 23:11:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B0E1383E6A3 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Sunil Pandey To: glibc-cvs@sourceware.org Subject: [glibc/release/2.33/master] x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ #29127] X-Act-Checkin: glibc X-Git-Author: Noah Goldstein X-Git-Refname: refs/heads/release/2.33/master X-Git-Oldrev: 7da0b8522b0498898f2b0d0b49f70869056e1e43 X-Git-Newrev: 69f16619e7119e26d70c00ac8b8750ed350147a3 Message-Id: <20220525231136.5B0E1383E6A3@sourceware.org> Date: Wed, 25 May 2022 23:11:36 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2022 23:11:36 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=69f16619e7119e26d70c00ac8b8750ed350147a3 commit 69f16619e7119e26d70c00ac8b8750ed350147a3 Author: Noah Goldstein 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 (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)