summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2014-09-29 20:32:49 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2014-09-29 20:32:49 +0000
commit1345ccde0d2da6b8d5ca6d549ce82337858a2818 (patch)
tree4955812737e3c859251eb4cc47fa1f2c1e88bff2
parent55a5cb2de9b38158b3fdb92791a91897585e113e (diff)
downloadeglibc2-eglibc-2_18.tar.gz
Merge changes between r25237 and r25890 from /fsf/glibc-2_18-branch.eglibc-2_18
git-svn-id: svn://svn.eglibc.org/branches/eglibc-2_18@25891 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog39
-rw-r--r--libc/NEWS5
-rw-r--r--libc/nptl/Makefile2
-rw-r--r--libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S4
-rw-r--r--libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S4
-rw-r--r--libc/nptl/tst-spin4.c109
-rw-r--r--libc/string/test-strcmp.c28
-rw-r--r--libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S1
-rw-r--r--libc/sysdeps/sparc/sparc64/strcmp.S31
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h27
11 files changed, 245 insertions, 7 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 41f5d2eb8..9c95cc05b 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,42 @@
+2014-06-03 Guo Yixuan <culu.gyx@gmail.com>
+
+ [BZ #16882]
+ * nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
+ (pthread_spin_lock): Branch out of spin loop to proper location.
+ * nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
+ (pthread_spin_lock): Likewise.
+
+ * nptl/tst-spin4.c: New test.
+ * nptl/Makefile (tests): Add tst-spin4.
+
+2014-05-17 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ [BZ #16958]
+ * sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S: Add missing
+ membar to avoid block loads/stores to overlap previous stores.
+
+2014-05-16 Aurelien Jarno <aurelien@aurel32.net>
+
+ [BZ #16943]
+ * sysdeps/unix/sysv/linux/sparc/bits/resource.h: Declare prlimit
+ and prlimit64.
+
+2014-05-06 Aurelien Jarno <aurelien@aurel32.net>
+
+ [BZ# 16916]
+ * sysdeps/unix/sysv/linux/sparc/bits/eventfd.h (EFD_SEMAPHORE):
+ Define.
+
+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-01-29 H.J. Lu <hongjiu.lu@intel.com>
[BZ #16510]
diff --git a/libc/NEWS b/libc/NEWS
index a9920158c..31664e40c 100644
--- a/libc/NEWS
+++ b/libc/NEWS
@@ -9,7 +9,8 @@ Version 2.18.1
* The following bugs are resolved with this release:
- 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510.
+ 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510, 16885, 16916,
+ 16943, 16958.
Version 2.18
@@ -28,7 +29,7 @@ Version 2.18
15429, 15431, 15432, 15441, 15442, 15448, 15465, 15480, 15485, 15488,
15490, 15492, 15493, 15497, 15506, 15529, 15536, 15553, 15577, 15583,
15618, 15627, 15631, 15654, 15655, 15666, 15667, 15674, 15711, 15755,
- 15759, 15985.
+ 15759, 15985, 16882.
* CVE-2013-2207 Incorrectly granting access to another user's pseudo-terminal
has been fixed by disabling the use of pt_chown (Bugzilla #15755).
diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile
index 140e3ed90..37d1c6383 100644
--- a/libc/nptl/Makefile
+++ b/libc/nptl/Makefile
@@ -212,7 +212,7 @@ tests = tst-typesizes \
tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \
tst-mutexpi9 \
- tst-spin1 tst-spin2 tst-spin3 \
+ tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
diff --git a/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S b/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
index 7099f2984..ad1368141 100644
--- a/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
+++ b/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
@@ -19,11 +19,11 @@
.text
ENTRY(pthread_spin_lock)
- ldstub [%o0], %g1
+1: ldstub [%o0], %g1
orcc %g1, 0x0, %g0
bne,a 2f
ldub [%o0], %g1
-1: retl
+ retl
mov 0, %o0
2: orcc %g1, 0x0, %g0
bne,a 2b
diff --git a/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S b/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
index 11091e900..8896a71c9 100644
--- a/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
+++ b/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
@@ -19,10 +19,10 @@
.text
ENTRY(pthread_spin_lock)
- ldstub [%o0], %g1
+1: ldstub [%o0], %g1
brnz,pn %g1, 2f
membar #StoreLoad | #StoreStore
-1: retl
+ retl
mov 0, %o0
2: ldub [%o0], %g1
brnz,pt %g1, 2b
diff --git a/libc/nptl/tst-spin4.c b/libc/nptl/tst-spin4.c
new file mode 100644
index 000000000..5b23a172c
--- /dev/null
+++ b/libc/nptl/tst-spin4.c
@@ -0,0 +1,109 @@
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int count = 0;
+
+static void *
+thread_add_one (void *arg)
+{
+ int tmp;
+ pthread_spinlock_t *lock = (pthread_spinlock_t *) arg;
+
+ /* When do_test holds the lock for 1 sec, the two thread will be
+ in contention for the lock. */
+ if (pthread_spin_lock (lock) != 0)
+ {
+ puts ("thread_add_one(): spin_lock failed");
+ pthread_exit ((void *) 1l);
+ }
+
+ /* sleep 1s before modifying count */
+ tmp = count;
+ sleep (1);
+ count = tmp + 1;
+
+ if (pthread_spin_unlock (lock) != 0)
+ {
+ puts ("thread_add_one(): spin_unlock failed");
+ pthread_exit ((void *) 1l);
+ }
+
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ pthread_t thr1, thr2;
+ pthread_spinlock_t lock;
+ int tmp;
+
+ if (pthread_spin_init (&lock, PTHREAD_PROCESS_PRIVATE) != 0)
+ {
+ puts ("spin_init failed");
+ return 1;
+ }
+
+ if (pthread_spin_lock (&lock) != 0)
+ {
+ puts ("1st spin_lock failed");
+ return 1;
+ }
+
+ if (pthread_create (&thr1, NULL, thread_add_one, (void *) &lock) != 0)
+ {
+ puts ("1st pthread_create failed");
+ return 1;
+ }
+
+ if (pthread_create (&thr2, NULL, thread_add_one, (void *) &lock) != 0)
+ {
+ puts ("2nd pthread_create failed");
+ return 1;
+ }
+
+ /* sleep 1s before modifying count */
+ tmp = count;
+ sleep (1);
+ count = tmp + 1;
+
+ if (pthread_spin_unlock (&lock) != 0)
+ {
+ puts ("1st spin_unlock failed");
+ return 1;
+ }
+
+ void *status;
+ if (pthread_join (thr1, &status) != 0)
+ {
+ puts ("1st pthread_join failed");
+ return 1;
+ }
+ if (status != NULL)
+ {
+ puts ("failure in the 1st thread");
+ return 1;
+ }
+ if (pthread_join (thr2, &status) != 0)
+ {
+ puts ("2nd pthread_join failed");
+ return 1;
+ }
+ if (status != NULL)
+ {
+ puts ("failure in the 2nd thread");
+ return 1;
+ }
+
+ if (count != 3)
+ {
+ printf ("count is %d, should be 3\n", count);
+ return 1;
+ }
+ return 0;
+}
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/string/test-strcmp.c b/libc/string/test-strcmp.c
index f66699392..d4fb82a59 100644
--- a/libc/string/test-strcmp.c
+++ b/libc/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/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S b/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S
index 594405051..63ba0811d 100644
--- a/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S
+++ b/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S
@@ -211,6 +211,7 @@ ENTRY(__memcpy_niagara2)
*/
VISEntryHalf
+ membar #Sync
alignaddr %o1, %g0, %g0
add %o1, (64 - 1), %o4
diff --git a/libc/sysdeps/sparc/sparc64/strcmp.S b/libc/sysdeps/sparc/sparc64/strcmp.S
index a36992e43..0b90f575a 100644
--- a/libc/sysdeps/sparc/sparc64/strcmp.S
+++ b/libc/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
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h
index b0234d1a2..e348cc6fb 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h
@@ -22,6 +22,8 @@
/* Flags for eventfd. */
enum
{
+ EFD_SEMAPHORE = 0x000001,
+#define EFD_SEMAPHORE EFD_SEMAPHORE
EFD_CLOEXEC = 0x400000,
#define EFD_CLOEXEC EFD_CLOEXEC
EFD_NONBLOCK = 0x004000
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index 14c2b70ad..cee1c0fe8 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -252,3 +252,30 @@ enum __priority_which
PRIO_USER = 2 /* WHO is a user ID. */
#define PRIO_USER PRIO_USER
};
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+/* Modify and return resource limits of a process atomically. */
+# ifndef __USE_FILE_OFFSET64
+extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
+ const struct rlimit *__new_limit,
+ struct rlimit *__old_limit) __THROW;
+# else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (prlimit, (__pid_t __pid,
+ enum __rlimit_resource __resource,
+ const struct rlimit *__new_limit,
+ struct rlimit *__old_limit), prlimit64);
+# else
+# define prlimit prlimit64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
+ const struct rlimit64 *__new_limit,
+ struct rlimit64 *__old_limit) __THROW;
+# endif
+#endif
+
+__END_DECLS