about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2013-12-18 16:46:18 -0800
committerPaul Pluzhnikov <ppluzhnikov@google.com>2013-12-18 16:46:18 -0800
commit1f33d36a8a9e78c81bed59b47f260723f56bb7e6 (patch)
treeff72018a2e0021f7a1110289681ed8ab4516df37 /sysdeps/generic
parent35e8f7ab94c910659de9d507aa0f3e1f8973d914 (diff)
downloadglibc-1f33d36a8a9e78c81bed59b47f260723f56bb7e6.tar.gz
glibc-1f33d36a8a9e78c81bed59b47f260723f56bb7e6.tar.xz
glibc-1f33d36a8a9e78c81bed59b47f260723f56bb7e6.zip
Patch 2/4 of the effort to make TLS access async-signal-safe.
Add a signal-safe malloc replacement.

2013-12-18  Andrew Hunter  <ahh@google.com>

	* sysdeps/generic/ldsodefs.h (__signal_safe_memalign): New prototype.
	(__signal_safe_malloc, __signal_safe_free): Likewise.
	(__signal_safe_realloc, __signal_safe_calloc): Likewise.
	* elf/dl-misc.c (__signal_safe_allocator_header): New struct.
	(__signal_safe_memalign, __signal_safe_malloc): New function.
	(__signal_safe_free, __signal_safe_realloc): Likewise.
	(__signal_safe_calloc): Likewise.
	* elf/dl-tls.c (allocate_dtv, _dl_clear_dtv): Call signal-safe
	functions.
	(_dl_deallocate_tls, _dl_update_slotinfo): Likewise.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/ldsodefs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 1bda60c6fa..48bdb6e44b 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -994,6 +994,12 @@ rtld_hidden_proto (_dl_allocate_tls_init)
 extern void _dl_clear_dtv (dtv_t *dtv) internal_function;
 rtld_hidden_proto (_dl_clear_dtv)
 
+extern void *__signal_safe_memalign (size_t boundary, size_t size);
+extern void *__signal_safe_malloc (size_t size);
+extern void __signal_safe_free (void *ptr);
+extern void *__signal_safe_realloc (void *ptr, size_t size);
+extern void *__signal_safe_calloc (size_t nmemb, size_t size);
+
 /* Deallocate memory allocated with _dl_allocate_tls.  */
 extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function;
 rtld_hidden_proto (_dl_deallocate_tls)