Properly handle forced elision in pthread_mutex_trylock (bug 16657)
authorAndreas Schwab <schwab@suse.de>
Tue, 4 Mar 2014 12:00:26 +0000 (13:00 +0100)
committerAndreas Schwab <schwab@suse.de>
Thu, 11 Dec 2014 11:44:27 +0000 (12:44 +0100)
ChangeLog
NEWS
nptl/pthread_mutex_trylock.c
sysdeps/unix/sysv/linux/s390/force-elision.h
sysdeps/unix/sysv/linux/x86/force-elision.h

index e388d0b..ef4b50e 100644 (file)
--- 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 e1bccd6..8b788c8 100644 (file)
--- 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
index 0293d0f..3cdf9f1 100644 (file)
@@ -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:
index 8fd7684..31b3662 100644 (file)
    <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                                          \
index 945f886..a767cf1 100644 (file)
    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                                          \