kumquat-buildroot/package/uclibc/0.9.33.2/uclibc-0016-nptl-sh-fix-race-condition-in-lll_wait_tid.patch
Peter Korsgaard 055f1c02d3 uclibc: add upstream 0.9.33 fixes
Upstream has a large number of patches lined up for the next 0.9.33.x bugfix
release;

http://git.uclibc.org/uClibc/log/?h=0.9.33

Add them here, as atleast some of them are quite critical (E.G. the eventfd
issue gets triggered by recent glib versions).

I've skipped the microblaze and xtensa fixes as we don't currently support
those with 0.9.33.2.

Drop uclibc-0002-Add-definition-of-MSG_WAITFORONE-and-MSG_CMSG_CMSG_CLOEXE.patch
as that is a subset of uclibc-0035-socket.h-pull-socket_type.h-from-eglibc.patch

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-09-06 15:28:51 +02:00

39 lines
1.6 KiB
Diff

From ffd9e147b120e9c2bf30ba4861860f1bc59362c5 Mon Sep 17 00:00:00 2001
From: Stas Sergeev <stsp@users.sourceforge.net>
Date: Thu, 14 Jun 2012 01:00:02 +0200
Subject: [PATCH] nptl: sh: fix race condition in lll_wait_tid
Make a local copy of the tid value to avoid a race condition,
as the value could have been changed to 0, thus using a pointer
it would have been passed to the lll_futex_wait modified.
Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
(cherry picked from commit 0dcc13bf7a61b1d0708e5dd103d5515e0ffec79a)
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
---
libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
index d10cd61..b83d863 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
@@ -396,9 +396,9 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
#define lll_wait_tid(tid) \
do { \
- __typeof (tid) *__tid = &(tid); \
- while (*__tid != 0) \
- lll_futex_wait (__tid, *__tid, LLL_SHARED); \
+ __typeof (tid) __tid; \
+ while ((__tid = (tid)) != 0) \
+ lll_futex_wait (&(tid), __tid, LLL_SHARED); \
} while (0)
extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
--
1.7.10.4