patches/glibc/2.18/110-2770d15-Fix-PI-mutex-check-in-pthread_cond_broadcast-and-pthread_cond_signal.patch
1 commit 2770d15e7e880821fc586619c59eb45180628e16
2 Author: Siddhesh Poyarekar <siddhesh@redhat.com>
3 Date: Thu Oct 3 08:26:21 2013 +0530
5 Fix PI mutex check in pthread_cond_broadcast and pthread_cond_signal
9 The check had a typo - it checked for PTHREAD_MUTEX_ROBUST_NP instead
10 of PTHREAD_MUTEX_ROBUST_NORMAL_NP. It has now been replaced by the
11 already existing convenience macro USE_REQUEUE_PI.
13 diff --git a/NEWS b/NEWS
14 index f64fb82..fb6069d 100644
17 @@ -9,7 +9,7 @@ Version 2.18.1
19 * The following bugs are resolved with this release:
26 diff --git a/nptl/ChangeLog b/nptl/ChangeLog
27 index eae5079..2d78490 100644
31 +2013-10-03 Siddhesh Poyarekar <siddhesh@redhat.com>
34 + * pthread_cond_broadcast.c (__pthread_cond_broadcast)
35 + [lll_futex_cmp_requeue_pi && __ASSUME_REQUEUE_PI]: Use
37 + * pthread_cond_signal.c (__pthread_cond_signal)
38 + [lll_futex_cmd_requeue_pi && __ASSUME_REQUEUE_PI]: Likewise.
40 2013-07-23 David S. Miller <davem@davemloft.net>
42 * tst-cancel4.c (WRITE_BUFFER_SIZE): Adjust comment.
43 diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
44 index 0702ec0..7ba9efa 100644
45 --- a/nptl/pthread_cond_broadcast.c
46 +++ b/nptl/pthread_cond_broadcast.c
47 @@ -63,10 +63,7 @@ __pthread_cond_broadcast (cond)
49 #if (defined lll_futex_cmp_requeue_pi \
50 && defined __ASSUME_REQUEUE_PI)
51 - int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
52 - pi_flag &= mut->__data.__kind;
54 - if (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP)
55 + if (USE_REQUEUE_PI (mut))
57 if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX,
58 &mut->__data.__lock, futex_val,
59 diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
60 index 102d0b3..ffc35dc 100644
61 --- a/nptl/pthread_cond_signal.c
62 +++ b/nptl/pthread_cond_signal.c
63 @@ -49,14 +49,9 @@ __pthread_cond_signal (cond)
65 #if (defined lll_futex_cmp_requeue_pi \
66 && defined __ASSUME_REQUEUE_PI)
67 - int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
68 pthread_mutex_t *mut = cond->__data.__mutex;
70 - /* Do not use requeue for pshared condvars. */
71 - if (mut != (void *) ~0l)
72 - pi_flag &= mut->__data.__kind;
74 - if (__builtin_expect (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP, 0)
75 + if (USE_REQUEUE_PI (mut)
76 /* This can only really fail with a ENOSYS, since nobody can modify
77 futex while we have the cond_lock. */
78 && lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0,