patches/glibc/2.18/110-2770d15-Fix-PI-mutex-check-in-pthread_cond_broadcast-and-pthread_cond_signal.patch
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/2.18/110-2770d15-Fix-PI-mutex-check-in-pthread_cond_broadcast-and-pthread_cond_signal.patch Sun May 11 23:55:16 2014 +0200
1.3 @@ -0,0 +1,78 @@
1.4 +commit 2770d15e7e880821fc586619c59eb45180628e16
1.5 +Author: Siddhesh Poyarekar <siddhesh@redhat.com>
1.6 +Date: Thu Oct 3 08:26:21 2013 +0530
1.7 +
1.8 + Fix PI mutex check in pthread_cond_broadcast and pthread_cond_signal
1.9 +
1.10 + Fixes BZ #15996.
1.11 +
1.12 + The check had a typo - it checked for PTHREAD_MUTEX_ROBUST_NP instead
1.13 + of PTHREAD_MUTEX_ROBUST_NORMAL_NP. It has now been replaced by the
1.14 + already existing convenience macro USE_REQUEUE_PI.
1.15 +
1.16 +diff --git a/NEWS b/NEWS
1.17 +index f64fb82..fb6069d 100644
1.18 +--- a/NEWS
1.19 ++++ b/NEWS
1.20 +@@ -9,7 +9,7 @@ Version 2.18.1
1.21 +
1.22 + * The following bugs are resolved with this release:
1.23 +
1.24 +- 15909.
1.25 ++ 15909, 15996.
1.26 +
1.27 + Version 2.18
1.28 +
1.29 +diff --git a/nptl/ChangeLog b/nptl/ChangeLog
1.30 +index eae5079..2d78490 100644
1.31 +--- a/nptl/ChangeLog
1.32 ++++ b/nptl/ChangeLog
1.33 +@@ -1,3 +1,12 @@
1.34 ++2013-10-03 Siddhesh Poyarekar <siddhesh@redhat.com>
1.35 ++
1.36 ++ [BZ #15996]
1.37 ++ * pthread_cond_broadcast.c (__pthread_cond_broadcast)
1.38 ++ [lll_futex_cmp_requeue_pi && __ASSUME_REQUEUE_PI]: Use
1.39 ++ USE_REQUEUE_PI.
1.40 ++ * pthread_cond_signal.c (__pthread_cond_signal)
1.41 ++ [lll_futex_cmd_requeue_pi && __ASSUME_REQUEUE_PI]: Likewise.
1.42 ++
1.43 + 2013-07-23 David S. Miller <davem@davemloft.net>
1.44 +
1.45 + * tst-cancel4.c (WRITE_BUFFER_SIZE): Adjust comment.
1.46 +diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
1.47 +index 0702ec0..7ba9efa 100644
1.48 +--- a/nptl/pthread_cond_broadcast.c
1.49 ++++ b/nptl/pthread_cond_broadcast.c
1.50 +@@ -63,10 +63,7 @@ __pthread_cond_broadcast (cond)
1.51 +
1.52 + #if (defined lll_futex_cmp_requeue_pi \
1.53 + && defined __ASSUME_REQUEUE_PI)
1.54 +- int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
1.55 +- pi_flag &= mut->__data.__kind;
1.56 +-
1.57 +- if (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP)
1.58 ++ if (USE_REQUEUE_PI (mut))
1.59 + {
1.60 + if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX,
1.61 + &mut->__data.__lock, futex_val,
1.62 +diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
1.63 +index 102d0b3..ffc35dc 100644
1.64 +--- a/nptl/pthread_cond_signal.c
1.65 ++++ b/nptl/pthread_cond_signal.c
1.66 +@@ -49,14 +49,9 @@ __pthread_cond_signal (cond)
1.67 +
1.68 + #if (defined lll_futex_cmp_requeue_pi \
1.69 + && defined __ASSUME_REQUEUE_PI)
1.70 +- int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
1.71 + pthread_mutex_t *mut = cond->__data.__mutex;
1.72 +
1.73 +- /* Do not use requeue for pshared condvars. */
1.74 +- if (mut != (void *) ~0l)
1.75 +- pi_flag &= mut->__data.__kind;
1.76 +-
1.77 +- if (__builtin_expect (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP, 0)
1.78 ++ if (USE_REQUEUE_PI (mut)
1.79 + /* This can only really fail with a ENOSYS, since nobody can modify
1.80 + futex while we have the cond_lock. */
1.81 + && lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0,