about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2015-10-06 13:12:36 +0200
committerFlorian Weimer <fweimer@redhat.com>2015-10-06 13:22:56 +0200
commitf586e1328681b400078c995a0bb6ad301ef73549 (patch)
treebf4c5da9f4100db68bd62f244109687bed3d76dc /stdlib
parentbe64c2ef2ac2357ddff61841f2cc8246e5da1b20 (diff)
downloadglibc-f586e1328681b400078c995a0bb6ad301ef73549.tar.gz
glibc-f586e1328681b400078c995a0bb6ad301ef73549.tar.xz
glibc-f586e1328681b400078c995a0bb6ad301ef73549.zip
Harden tls_dtor_list with pointer mangling [BZ #19018]
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/cxa_thread_atexit_impl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c
index 2d5d56a7fa..5717f09e76 100644
--- a/stdlib/cxa_thread_atexit_impl.c
+++ b/stdlib/cxa_thread_atexit_impl.c
@@ -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