]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Harden tls_dtor_list with pointer mangling [BZ #19018]
authorFlorian Weimer <fweimer@redhat.com>
Tue, 6 Oct 2015 11:12:36 +0000 (13:12 +0200)
committerMike Frysinger <vapier@gentoo.org>
Sun, 24 Jan 2016 08:51:42 +0000 (03:51 -0500)
(cherry picked from commit f586e1328681b400078c995a0bb6ad301ef73549)
(cherry picked from commit 5fb7924cb6cf606ce865122e5bbac9df934db14e)

stdlib/cxa_thread_atexit_impl.c

index 2d5d56a7fa9d8417a2a53da63daed269f91c8dec..5717f09e76882cbc386ef35666642936d378c4e6 100644 (file)
@@ -98,6 +98,10 @@ static __thread struct link_map *lm_cache;
 int
 __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol)
 {
+#ifdef PTR_MANGLE
+  PTR_MANGLE (func);
+#endif
+
   /* Prepend.  */
   struct dtor_list *new = calloc (1, sizeof (struct dtor_list));
   new->func = func;
@@ -142,9 +146,13 @@ __call_tls_dtors (void)
   while (tls_dtor_list)
     {
       struct dtor_list *cur = tls_dtor_list;
+      dtor_func func = cur->func;
+#ifdef PTR_DEMANGLE
+      PTR_DEMANGLE (func);
+#endif
 
       tls_dtor_list = tls_dtor_list->next;
-      cur->func (cur->obj);
+      func (cur->obj);
 
       /* Ensure that the MAP dereference happens before
         l_tls_dtor_count decrement.  That way, we protect this access from a