about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2014-03-04 13:00:26 +0100
committerAndreas Schwab <schwab@suse.de>2014-12-11 12:44:27 +0100
commitb0a3c1640ab2fb7d16d9b9a8d9c0e524e9cb0001 (patch)
tree3e3d5fbf0d33c32e0219d27089b0491b3be42466
parentda5bcaa49916fd99c1cd2bfe11923e680056abd7 (diff)
downloadglibc-b0a3c1640ab2fb7d16d9b9a8d9c0e524e9cb0001.tar.gz
glibc-b0a3c1640ab2fb7d16d9b9a8d9c0e524e9cb0001.tar.xz
glibc-b0a3c1640ab2fb7d16d9b9a8d9c0e524e9cb0001.zip
Properly handle forced elision in pthread_mutex_trylock (bug 16657)
-rw-r--r--ChangeLog8
-rw-r--r--NEWS10
-rw-r--r--nptl/pthread_mutex_trylock.c9
-rw-r--r--sysdeps/unix/sysv/linux/s390/force-elision.h5
-rw-r--r--sysdeps/unix/sysv/linux/x86/force-elision.h5
5 files changed, 17 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index e388d0b88e..ef4b50e98e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2014-12-11  Andreas Schwab  <schwab@suse.de>
 
+	[BZ #16657]
+	* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
+	FORCE_ELISION instead of DO_ELISION.
+	* sysdeps/unix/sysv/linux/x86/force-elision.h (DO_ELISION):
+	Remove.
+	* sysdeps/unix/sysv/linux/s390/force-elision.h (DO_ELISION):
+	Likewise.
+
 	* iconvdata/gconv-modules: Remove duplicate entry.
 
 2014-12-11  Will Newton  <will.newton@linaro.org>
diff --git a/NEWS b/NEWS
index e1bccd640c..8b788c8195 100644
--- a/NEWS
+++ b/NEWS
@@ -10,11 +10,11 @@ Version 2.21
 * The following bugs are resolved with this release:
 
   6652, 10672, 12847, 12926, 13862, 14132, 14138, 14171, 14498, 15215,
-  15884, 16469, 16619, 16740, 16857, 17192, 17266, 17344, 17363, 17370,
-  17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522, 17555,
-  17570, 17571, 17572, 17573, 17574, 17581, 17582, 17583, 17584, 17585,
-  17589, 17594, 17601, 17608, 17616, 17625, 17633, 17634, 17647, 17653,
-  17664, 17665, 17668, 17682.
+  15884, 16469, 16619, 16657, 16740, 16857, 17192, 17266, 17344, 17363,
+  17370, 17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522,
+  17555, 17570, 17571, 17572, 17573, 17574, 17581, 17582, 17583, 17584,
+  17585, 17589, 17594, 17601, 17608, 17616, 17625, 17633, 17634, 17647,
+  17653, 17664, 17665, 17668, 17682.
 
 * CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
   under certain input conditions resulting in the execution of a shell for
diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c
index 0293d0f629..3cdf9f175c 100644
--- a/nptl/pthread_mutex_trylock.c
+++ b/nptl/pthread_mutex_trylock.c
@@ -26,8 +26,8 @@
 #define lll_trylock_elision(a,t) lll_trylock(a)
 #endif
 
-#ifndef DO_ELISION
-#define DO_ELISION(m) 0
+#ifndef FORCE_ELISION
+#define FORCE_ELISION(m, s)
 #endif
 
 /* We don't force elision in trylock, because this can lead to inconsistent
@@ -69,7 +69,7 @@ __pthread_mutex_trylock (mutex)
       break;
 
     case PTHREAD_MUTEX_TIMED_ELISION_NP:
-    elision:
+    elision: __attribute__((unused))
       if (lll_trylock_elision (mutex->__data.__lock,
 			       mutex->__data.__elision) != 0)
 	break;
@@ -77,8 +77,7 @@ __pthread_mutex_trylock (mutex)
       return 0;
 
     case PTHREAD_MUTEX_TIMED_NP:
-      if (DO_ELISION (mutex))
-	goto elision;
+      FORCE_ELISION (mutex, goto elision);
       /*FALL THROUGH*/
     case PTHREAD_MUTEX_ADAPTIVE_NP:
     case PTHREAD_MUTEX_ERRORCHECK_NP:
diff --git a/sysdeps/unix/sysv/linux/s390/force-elision.h b/sysdeps/unix/sysv/linux/s390/force-elision.h
index 8fd7684d9a..31b3662ba1 100644
--- a/sysdeps/unix/sysv/linux/s390/force-elision.h
+++ b/sysdeps/unix/sysv/linux/s390/force-elision.h
@@ -17,11 +17,6 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifdef ENABLE_LOCK_ELISION
-/* Check for elision on this lock without upgrading.  */
-#define DO_ELISION(m)							\
-  (__pthread_force_elision						\
-   && (m->__data.__kind & PTHREAD_MUTEX_NO_ELISION_NP) == 0)		\
-
 /* Automatically enable elision for existing user lock kinds.  */
 #define FORCE_ELISION(m, s)						\
   if (__pthread_force_elision						\
diff --git a/sysdeps/unix/sysv/linux/x86/force-elision.h b/sysdeps/unix/sysv/linux/x86/force-elision.h
index 945f8867fc..a767cf1976 100644
--- a/sysdeps/unix/sysv/linux/x86/force-elision.h
+++ b/sysdeps/unix/sysv/linux/x86/force-elision.h
@@ -16,11 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* Check for elision on this lock without upgrading.  */
-#define DO_ELISION(m)							\
-  (__pthread_force_elision						\
-   && (m->__data.__kind & PTHREAD_MUTEX_NO_ELISION_NP) == 0)		\
-
 /* Automatically enable elision for existing user lock kinds.  */
 #define FORCE_ELISION(m, s)						\
   if (__pthread_force_elision						\