about summary refs log tree commit diff
path: root/string/test-strcmp.c
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2021-12-03 15:29:25 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-12-03 21:14:11 -0800
commit4df1fa6ddc8925a75f3da644d5da3bb16eb33f02 (patch)
treed21bb734dffee2cff4502c8d9383f31f8960d58e /string/test-strcmp.c
parent23c77f60181eb549f11ec2f913b4270af29eee38 (diff)
downloadglibc-4df1fa6ddc8925a75f3da644d5da3bb16eb33f02.tar.gz
glibc-4df1fa6ddc8925a75f3da644d5da3bb16eb33f02.tar.xz
glibc-4df1fa6ddc8925a75f3da644d5da3bb16eb33f02.zip
x86-64: Use notl in EVEX strcmp [BZ #28646]
Must use notl %edi here as lower bits are for CHAR comparisons
potentially out of range thus can be 0 without indicating mismatch.
This fixes BZ #28646.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'string/test-strcmp.c')
-rw-r--r--string/test-strcmp.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/string/test-strcmp.c b/string/test-strcmp.c
index 77ae73110f..42178a260b 100644
--- a/string/test-strcmp.c
+++ b/string/test-strcmp.c
@@ -23,6 +23,7 @@
 # define TEST_NAME "strcmp"
 #endif
 #include "test-string.h"
+#include <support/test-driver.h>
 
 #ifdef WIDE
 # include <wchar.h>
@@ -390,6 +391,32 @@ check2 (void)
 	}
 }
 
+static void
+check3 (void)
+{
+  size_t size = 0xd000 + 0x4000;
+  CHAR *s1, *s2;
+  CHAR *buffer1 = mmap (NULL, size, PROT_READ | PROT_WRITE,
+			MAP_PRIVATE | MAP_ANON, -1, 0);
+  CHAR *buffer2 = mmap (NULL, size, PROT_READ | PROT_WRITE,
+			MAP_PRIVATE | MAP_ANON, -1, 0);
+  if (buffer1 == MAP_FAILED || buffer1 == MAP_FAILED)
+    error (EXIT_UNSUPPORTED, errno, "mmap failed");
+
+  s1 = (CHAR *) (buffer1 + 0x8f8 / sizeof (CHAR));
+  s2 = (CHAR *) (buffer2 + 0xcff3 / sizeof (CHAR));
+
+  STRCPY(s1, L("/export/redhat/rpms/BUILD/java-1.8.0-openjdk-1.8.0.312.b07-2.fc35.x86_64/openjdk/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java"));
+  STRCPY(s2, L("/export/redhat/rpms/BUILD/java-1.8.0-openjdk-1.8.0.312.b07-2.fc35.x86_64/openjdk/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java"));
+
+  int exp_result = SIMPLE_STRCMP (s1, s2);
+  FOR_EACH_IMPL (impl, 0)
+    check_result (impl, s1, s2, exp_result);
+
+  munmap ((void *) buffer1, size);
+  munmap ((void *) buffer2, size);
+}
+
 int
 test_main (void)
 {
@@ -398,6 +425,7 @@ test_main (void)
   test_init ();
   check();
   check2 ();
+  check3 ();
 
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)