summary refs log tree commit diff
path: root/nptl/pthreadP.h
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@redhat.com>2018-06-22 09:28:47 -0400
committerCarlos O'Donell <carlos@redhat.com>2018-06-29 22:39:06 -0400
commit2827ab990aefbb0e53374199b875d98f116d6390 (patch)
tree0063b4c07be87d887d4a4893b9681b9e61479e8b /nptl/pthreadP.h
parent37d3d244e1a0ca7e7ac89b8e768e665adbb2e2d8 (diff)
downloadglibc-2827ab990aefbb0e53374199b875d98f116d6390.tar.gz
glibc-2827ab990aefbb0e53374199b875d98f116d6390.tar.xz
glibc-2827ab990aefbb0e53374199b875d98f116d6390.zip
libc: Extend __libc_freeres framework (Bug 23329).
The __libc_freeres framework does not extend to non-libc.so objects.
This causes problems in general for valgrind and mtrace detecting
unfreed objects in both libdl.so and libpthread.so.  This change is
a pre-requisite to properly moving the malloc hooks out of malloc
since such a move now requires precise accounting of all allocated
data before destructors are run.

This commit adds a proper hook in libc.so.6 for both libdl.so and
for libpthread.so, this ensures that shm-directory.c which uses
freeit () to free memory is called properly.  We also remove the
nptl_freeres hook and fall back to using weak-ref-and-check idiom
for a loaded libpthread.so, thus making this process similar for
all DSOs.

Lastly we follow best practice and use explicit free calls for
both libdl.so and libpthread.so instead of the generic hook process
which has undefined order.

Tested on x86_64 with no regressions.

Signed-off-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nptl/pthreadP.h')
-rw-r--r--nptl/pthreadP.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 075530c15c..3cba0b6f9e 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -279,8 +279,8 @@ hidden_proto (__pthread_register_cancel)
 hidden_proto (__pthread_unregister_cancel)
 # ifdef SHARED
 extern void attribute_hidden pthread_cancel_init (void);
-extern void __unwind_freeres (void);
 # endif
+extern void __nptl_unwind_freeres (void) attribute_hidden;
 #endif
 
 
@@ -597,7 +597,8 @@ extern int __nptl_setxid (struct xid_command *cmdp) attribute_hidden;
 extern void __nptl_set_robust (struct pthread *self);
 #endif
 
-extern void __free_stacks (size_t limit) attribute_hidden;
+extern void __nptl_stacks_freeres (void) attribute_hidden;
+extern void __shm_directory_freeres (void) attribute_hidden;
 
 extern void __wait_lookup_done (void) attribute_hidden;