- Fix check for PI mutex on non-x86 systems (#1007590).

This commit is contained in:
Siddhesh Poyarekar 2013-10-01 20:30:47 +05:30
parent f4ac86c2ae
commit 00541bf6f3
2 changed files with 53 additions and 1 deletions

46
glibc-rh1007590.patch Normal file
View File

@ -0,0 +1,46 @@
commit ab8473b63982c814cdf509b8061fe0152cf3fd39
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Tue Oct 1 14:29:00 2013 +0530
Fix PI mutex check in pthread_cond_broadcast and pthread_cond_signal
The check had a typo - it checked for PTHREAD_MUTEX_ROBUST instead of
PTHREAD_MUTEX_NORMAL_ROBUST_NP. It has now been replaced by the
already existing convenience macro USE_REQUEUE_PI.
diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
index 0702ec0..7ba9efa 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 102d0b3..ffc35dc 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,

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.18
%define glibcversion 2.18
%define glibcrelease 9%{?dist}
%define glibcrelease 10%{?dist}
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
@ -225,6 +225,8 @@ Patch2030: %{name}-rh985342.patch
# Upstream BZ 15754
Patch2031: %{name}-rh985625-CVE-2013-4788.patch
Patch2032: %{name}-rh1007590.patch
##############################################################################
# End of glibc patches.
##############################################################################
@ -556,6 +558,7 @@ package or when debugging this package.
%patch2030 -p1
%patch1002 -p1
%patch2031 -p1
%patch2032 -p1
##############################################################################
# %%prep - Additional prep required...
@ -1641,6 +1644,9 @@ rm -f *.filelist*
%endif
%changelog
* Tue Oct 1 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.18-10
- Fix check for PI mutex on non-x86 systems (#1007590).
* Mon Sep 23 2013 Carlos O'Donell <carlos@redhat.com> - 2.18-9
- Fix CVE-2013-4788: Static applications now support pointer mangling.
Existing static applications must be recompiled (#985625).