r6036 - in glibc-package/trunk/debian: . patches patches/sparc
Author: aurel32
Date: 2014-05-04 20:27:42 +0000 (Sun, 04 May 2014)
New Revision: 6036
Added:
glibc-package/trunk/debian/patches/sparc/cvs-strcmp.diff
Modified:
glibc-package/trunk/debian/changelog
glibc-package/trunk/debian/patches/series
Log:
patches/sparc/cvs-strcmp.diff: patch from upstream to fix a corner case
in the sparc specific strcmp() implementation. Closes: #746310.
Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog 2014-05-04 20:24:59 UTC (rev 6035)
+++ glibc-package/trunk/debian/changelog 2014-05-04 20:27:42 UTC (rev 6036)
@@ -9,6 +9,8 @@
[ Aurelien Jarno ]
* patches/any/cvs-make-4.0.diff: patch from upstream to allow GNU Make
4.0 and greater. Closes: #747013.
+ * patches/sparc/cvs-strcmp.diff: patch from upstream to fix a corner case
+ in the sparc specific strcmp() implementation. Closes: #746310.
-- Adam Conrad <adconrad@0c3.net> Sun, 27 Apr 2014 23:15:13 -0600
Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series 2014-05-04 20:24:59 UTC (rev 6035)
+++ glibc-package/trunk/debian/patches/series 2014-05-04 20:27:42 UTC (rev 6036)
@@ -197,6 +197,7 @@
sparc/local-fork.diff
sparc/local-sparcv9-target.diff
sparc/submitted-timing.diff
+sparc/cvs-strcmp.diff
all/local-alias-UTF-8.diff
all/local-alias-et_EE.diff
Added: glibc-package/trunk/debian/patches/sparc/cvs-strcmp.diff
===================================================================
--- glibc-package/trunk/debian/patches/sparc/cvs-strcmp.diff (rev 0)
+++ glibc-package/trunk/debian/patches/sparc/cvs-strcmp.diff 2014-05-04 20:27:42 UTC (rev 6036)
@@ -0,0 +1,89 @@
+2014-05-01 David S. Miller <davem@davemloft.net>
+
+ [BZ #16885]
+ * sysdeps/sparc/sparc64/strcmp.S: Fix end comparison handling when
+ multiple zero bytes exist at the end of a string.
+ Reported by Aurelien Jarno <aurelien@aurel32.net>
+
+ * string/test-strcmp.c (check): Add explicit test for situations where
+ there are multiple zero bytes after the first.
+
+diff --git a/string/test-strcmp.c b/string/test-strcmp.c
+--- a/string/test-strcmp.c
++++ b/string/test-strcmp.c
+@@ -329,6 +329,34 @@ check (void)
+ FOR_EACH_IMPL (impl, 0)
+ check_result (impl, s1 + i1, s2 + i2, exp_result);
+ }
++
++ /* Test cases where there are multiple zero bytes after the first. */
++
++ for (size_t i = 0; i < 16 + 1; i++)
++ {
++ s1[i] = 0x00;
++ s2[i] = 0x00;
++ }
++
++ for (size_t i = 0; i < 16; i++)
++ {
++ int exp_result;
++
++ for (int val = 0x01; val < 0x100; val++)
++ {
++ for (size_t j = 0; j < i; j++)
++ {
++ s1[j] = val;
++ s2[j] = val;
++ }
++
++ s2[i] = val;
++
++ exp_result = SIMPLE_STRCMP (s1, s2);
++ FOR_EACH_IMPL (impl, 0)
++ check_result (impl, s1, s2, exp_result);
++ }
++ }
+ }
+
+
+diff --git a/sysdeps/sparc/sparc64/strcmp.S b/sysdeps/sparc/sparc64/strcmp.S
+--- a/sysdeps/sparc/sparc64/strcmp.S
++++ b/sysdeps/sparc/sparc64/strcmp.S
+@@ -121,6 +121,37 @@ ENTRY(strcmp)
+ movleu %xcc, -1, %o0
+ srlx rTMP1, 7, rTMP1
+
++ /* In order not to be influenced by bytes after the zero byte, we
++ * have to retain only the highest bit in the mask for the comparison
++ * with rSTRXOR to work properly.
++ */
++ mov 0, rTMP2
++ andcc rTMP1, 0x0100, %g0
++
++ movne %xcc, 8, rTMP2
++ sllx rTMP1, 63 - 16, %o1
++
++ movrlz %o1, 16, rTMP2
++ sllx rTMP1, 63 - 24, %o1
++
++ movrlz %o1, 24, rTMP2
++ sllx rTMP1, 63 - 32, %o1
++
++ movrlz %o1, 32, rTMP2
++ sllx rTMP1, 63 - 40, %o1
++
++ movrlz %o1, 40, rTMP2
++ sllx rTMP1, 63 - 48, %o1
++
++ movrlz %o1, 48, rTMP2
++ sllx rTMP1, 63 - 56, %o1
++
++ movrlz %o1, 56, rTMP2
++
++ srlx rTMP1, rTMP2, rTMP1
++
++ sllx rTMP1, rTMP2, rTMP1
++
+ cmp rTMP1, rSTRXOR
+ retl
+ movgu %xcc, 0, %o0
Reply to: