about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-10-03 08:26:21 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-10-03 08:26:21 +0530
commit2770d15e7e880821fc586619c59eb45180628e16 (patch)
treeaac8cfee611a22d6f86979c32f5be23cde28b640
parentf8a8e175b8325afb2b1b94630a04359951ea2afe (diff)
downloadglibc-2770d15e7e880821fc586619c59eb45180628e16.tar.gz
glibc-2770d15e7e880821fc586619c59eb45180628e16.tar.xz
glibc-2770d15e7e880821fc586619c59eb45180628e16.zip
Fix PI mutex check in pthread_cond_broadcast and pthread_cond_signal
Fixes BZ #15996.

The check had a typo - it checked for PTHREAD_MUTEX_ROBUST_NP instead
of PTHREAD_MUTEX_ROBUST_NORMAL_NP.  It has now been replaced by the
already existing convenience macro USE_REQUEUE_PI.
-rw-r--r--NEWS2
-rw-r--r--nptl/ChangeLog9
-rw-r--r--nptl/pthread_cond_broadcast.c5
-rw-r--r--nptl/pthread_cond_signal.c7
4 files changed, 12 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index f64fb8225f..fb6069d4d7 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ Version 2.18.1
 
 * The following bugs are resolved with this release:
 
-  15909.
+  15909, 15996.
 
 Version 2.18
 
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index eae507965f..2d78490863 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,12 @@
+2013-10-03  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+	[BZ #15996]
+	* pthread_cond_broadcast.c (__pthread_cond_broadcast)
+	[lll_futex_cmp_requeue_pi && __ASSUME_REQUEUE_PI]: Use
+	USE_REQUEUE_PI.
+	* pthread_cond_signal.c (__pthread_cond_signal)
+	[lll_futex_cmd_requeue_pi && __ASSUME_REQUEUE_PI]: Likewise.
+
 2013-07-23  David S. Miller  <davem@davemloft.net>
 
 	* tst-cancel4.c (WRITE_BUFFER_SIZE): Adjust comment.
diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
index 0702ec0ec2..7ba9efa0c0 100644
--- a/nptl/pthread_cond_broadcast.c
+++ b/nptl/pthread_cond_broadcast.c
@@ -63,10 +63,7 @@ __pthread_cond_broadcast (cond)
 
 #if (defined lll_futex_cmp_requeue_pi \
      && defined __ASSUME_REQUEUE_PI)
-      int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
-      pi_flag &= mut->__data.__kind;
-
-      if (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP)
+      if (USE_REQUEUE_PI (mut))
 	{
 	  if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX,
 					&mut->__data.__lock, futex_val,
diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
index 102d0b380c..ffc35dc9e1 100644
--- a/nptl/pthread_cond_signal.c
+++ b/nptl/pthread_cond_signal.c
@@ -49,14 +49,9 @@ __pthread_cond_signal (cond)
 
 #if (defined lll_futex_cmp_requeue_pi \
      && defined __ASSUME_REQUEUE_PI)
-      int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
       pthread_mutex_t *mut = cond->__data.__mutex;
 
-      /* Do not use requeue for pshared condvars.  */
-      if (mut != (void *) ~0l)
-	pi_flag &= mut->__data.__kind;
-
-      if (__builtin_expect (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP, 0)
+      if (USE_REQUEUE_PI (mut)
 	/* This can only really fail with a ENOSYS, since nobody can modify
 	   futex while we have the cond_lock.  */
 	  && lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0,