67d1373
commit f586e1328681b400078c995a0bb6ad301ef73549
67d1373
Author: Florian Weimer <fweimer@redhat.com>
67d1373
Date:   Tue Oct 6 13:12:36 2015 +0200
67d1373
67d1373
    Harden tls_dtor_list with pointer mangling [BZ #19018]
67d1373
67d1373
diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c
67d1373
index 2d5d56a..5717f09 100644
67d1373
--- a/stdlib/cxa_thread_atexit_impl.c
67d1373
+++ b/stdlib/cxa_thread_atexit_impl.c
67d1373
@@ -98,6 +98,10 @@ static __thread struct link_map *lm_cache;
67d1373
 int
67d1373
 __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol)
67d1373
 {
67d1373
+#ifdef PTR_MANGLE
67d1373
+  PTR_MANGLE (func);
67d1373
+#endif
67d1373
+
67d1373
   /* Prepend.  */
67d1373
   struct dtor_list *new = calloc (1, sizeof (struct dtor_list));
67d1373
   new->func = func;
67d1373
@@ -142,9 +146,13 @@ __call_tls_dtors (void)
67d1373
   while (tls_dtor_list)
67d1373
     {
67d1373
       struct dtor_list *cur = tls_dtor_list;
67d1373
+      dtor_func func = cur->func;
67d1373
+#ifdef PTR_DEMANGLE
67d1373
+      PTR_DEMANGLE (func);
67d1373
+#endif
67d1373
 
67d1373
       tls_dtor_list = tls_dtor_list->next;
67d1373
-      cur->func (cur->obj);
67d1373
+      func (cur->obj);
67d1373
 
67d1373
       /* Ensure that the MAP dereference happens before
67d1373
 	 l_tls_dtor_count decrement.  That way, we protect this access from a