This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch release/2.19/master updated. glibc-2.19-3-geec993c
- From: davem at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 1 May 2014 20:25:12 -0000
- Subject: GNU C Library master sources branch release/2.19/master updated. glibc-2.19-3-geec993c
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, release/2.19/master has been updated
via eec993cb1a38c0b35fa225adb481165fb7491f5b (commit)
from ffe768a90912f9bce43b70a82576b3dc99e3121c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=eec993cb1a38c0b35fa225adb481165fb7491f5b
commit eec993cb1a38c0b35fa225adb481165fb7491f5b
Author: David S. Miller <davem@davemloft.net>
Date: Wed Apr 30 12:57:51 2014 -0700
Fix v9/64-bit strcmp when string ends in multiple zero bytes.
[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/ChangeLog b/ChangeLog
index 8c6db1b..766382d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
2014-02-27 Siddhesh Poyarekar <siddhesh@redhat.com>
[BZ #16623]
diff --git a/string/test-strcmp.c b/string/test-strcmp.c
index b395dc7..fcd059f 100644
--- 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
index 8925396..f32b0fc 100644
--- 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
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 10 ++++++++++
string/test-strcmp.c | 28 ++++++++++++++++++++++++++++
sysdeps/sparc/sparc64/strcmp.S | 31 +++++++++++++++++++++++++++++++
3 files changed, 69 insertions(+), 0 deletions(-)
hooks/post-receive
--
GNU C Library master sources