This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix crash in pthread_exit() when statically linked


Fix for the bug 12310: http://sourceware.org/bugzilla/show_bug.cgi?id=12310

diff --git nptl/ChangeLog nptl/ChangeLog
index 0e3b018..97e7668 100644
--- nptl/ChangeLog
+++ nptl/ChangeLog
@@ -1,3 +1,10 @@
+2013-06-22  Vladimir Nikulichev  <v.nikulichev@gmail.com>
+
+ * pthread_exit.c: Add reference to __nptl_nthreads in order to prevent
+ crash if pthread_exit() has been called from statically linked executable
+ that doesn't refer to anything from pthread_create.c
+ * pthreadP.h: Macro PTHREAD_STATIC_SYM_REQUIRE(name)
+
 2013-06-15  Siddhesh Poyarekar  <siddhesh@redhat.com>

  * Versions (libpthread): Add GLIBC_2.18.
diff --git nptl/pthreadP.h nptl/pthreadP.h
index 7883fdf..8ced5d7 100644
--- nptl/pthreadP.h
+++ nptl/pthreadP.h
@@ -578,6 +578,8 @@ extern void __wait_lookup_done (void) attribute_hidden;
 # define PTHREAD_STATIC_FN_REQUIRE(name) __asm (".globl " #name);
 #endif

+#define PTHREAD_STATIC_SYM_REQUIRE(name) PTHREAD_STATIC_FN_REQUIRE(name)
+
 /* Test if the mutex is suitable for the FUTEX_WAIT_REQUEUE_PI operation.  */
 #if (defined lll_futex_wait_requeue_pi \
      && defined __ASSUME_REQUEUE_PI)
diff --git nptl/pthread_exit.c nptl/pthread_exit.c
index 3718081..8ff0b08 100644
--- nptl/pthread_exit.c
+++ nptl/pthread_exit.c
@@ -20,6 +20,9 @@
 #include "pthreadP.h"


+PTHREAD_STATIC_SYM_REQUIRE(__nptl_nthreads);
+
+
 void
 __pthread_exit (value)
      void *value;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]