Properly handle forced elision in pthread_mutex_trylock (bug 16657)

This commit is contained in:
Andreas Schwab 2014-03-04 13:00:26 +01:00
parent da5bcaa499
commit b0a3c1640a
5 changed files with 17 additions and 20 deletions

View File

@ -1,5 +1,13 @@
2014-12-11 Andreas Schwab <schwab@suse.de> 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. * iconvdata/gconv-modules: Remove duplicate entry.
2014-12-11 Will Newton <will.newton@linaro.org> 2014-12-11 Will Newton <will.newton@linaro.org>

10
NEWS
View File

@ -10,11 +10,11 @@ Version 2.21
* The following bugs are resolved with this release: * The following bugs are resolved with this release:
6652, 10672, 12847, 12926, 13862, 14132, 14138, 14171, 14498, 15215, 6652, 10672, 12847, 12926, 13862, 14132, 14138, 14171, 14498, 15215,
15884, 16469, 16619, 16740, 16857, 17192, 17266, 17344, 17363, 17370, 15884, 16469, 16619, 16657, 16740, 16857, 17192, 17266, 17344, 17363,
17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522, 17555, 17370, 17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522,
17570, 17571, 17572, 17573, 17574, 17581, 17582, 17583, 17584, 17585, 17555, 17570, 17571, 17572, 17573, 17574, 17581, 17582, 17583, 17584,
17589, 17594, 17601, 17608, 17616, 17625, 17633, 17634, 17647, 17653, 17585, 17589, 17594, 17601, 17608, 17616, 17625, 17633, 17634, 17647,
17664, 17665, 17668, 17682. 17653, 17664, 17665, 17668, 17682.
* CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag * CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
under certain input conditions resulting in the execution of a shell for under certain input conditions resulting in the execution of a shell for

View File

@ -26,8 +26,8 @@
#define lll_trylock_elision(a,t) lll_trylock(a) #define lll_trylock_elision(a,t) lll_trylock(a)
#endif #endif
#ifndef DO_ELISION #ifndef FORCE_ELISION
#define DO_ELISION(m) 0 #define FORCE_ELISION(m, s)
#endif #endif
/* We don't force elision in trylock, because this can lead to inconsistent /* We don't force elision in trylock, because this can lead to inconsistent
@ -69,7 +69,7 @@ __pthread_mutex_trylock (mutex)
break; break;
case PTHREAD_MUTEX_TIMED_ELISION_NP: case PTHREAD_MUTEX_TIMED_ELISION_NP:
elision: elision: __attribute__((unused))
if (lll_trylock_elision (mutex->__data.__lock, if (lll_trylock_elision (mutex->__data.__lock,
mutex->__data.__elision) != 0) mutex->__data.__elision) != 0)
break; break;
@ -77,8 +77,7 @@ __pthread_mutex_trylock (mutex)
return 0; return 0;
case PTHREAD_MUTEX_TIMED_NP: case PTHREAD_MUTEX_TIMED_NP:
if (DO_ELISION (mutex)) FORCE_ELISION (mutex, goto elision);
goto elision;
/*FALL THROUGH*/ /*FALL THROUGH*/
case PTHREAD_MUTEX_ADAPTIVE_NP: case PTHREAD_MUTEX_ADAPTIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP: case PTHREAD_MUTEX_ERRORCHECK_NP:

View File

@ -17,11 +17,6 @@
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
#ifdef ENABLE_LOCK_ELISION #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. */ /* Automatically enable elision for existing user lock kinds. */
#define FORCE_ELISION(m, s) \ #define FORCE_ELISION(m, s) \
if (__pthread_force_elision \ if (__pthread_force_elision \

View File

@ -16,11 +16,6 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */ <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. */ /* Automatically enable elision for existing user lock kinds. */
#define FORCE_ELISION(m, s) \ #define FORCE_ELISION(m, s) \
if (__pthread_force_elision \ if (__pthread_force_elision \