glibc 2.19 - asyn-signal safe TLS and ASan.
Paul Pluzhnikov
ppluzhnikov@google.com
Fri Jan 24 17:19:00 GMT 2014
On 1/24/14, 1:21 AM, Kostya Serebryany wrote:
> On Fri, Jan 24, 2014 at 1:59 AM, Andrew Hunter <ahh@google.com> wrote:
>> FYI -- you could easily do the same thing with calls to
>> signal_safe_memalign from libc as a stopgap. (Well, we'd need to
>> export the symbols from libc, like I wanted to in the first place.)
>
> Correct. If glibc lets us intercept __signal_safe_memalign&co we can
> apply the same hack as we currently have.
I think it would then be less of a hack: you may not need the "if called
from elf/dl-tls.c" part.
It would also allow an implementation that overrides malloc and can
provide async-signal-safe and more space-efficient implementation to do
so (that was Andrew's argument for exposing the symbols here:
https://sourceware.org/ml/libc-alpha/2013-09/msg00721.html).
> How do I "export" __signal_safe_memalign? (I/d like to experiment myself)
You'll need this snippet of above patch: (line 61,5):
diff --git a/elf/Versions b/elf/Versions
index 2383992..f14e5d0 100644
--- a/elf/Versions
+++ b/elf/Versions
@@ -53,6 +53,7 @@ ld {
_dl_allocate_tls; _dl_allocate_tls_init;
_dl_argv; _dl_find_dso_for_object; _dl_get_tls_static_info;
_dl_deallocate_tls; _dl_make_stack_executable; _dl_out_of_memory;
+ _dl_clear_dtv;
_dl_rtld_di_serinfo; _dl_starting_up; _dl_tls_setup;
_rtld_global; _rtld_global_ro;
@@ -61,5 +62,9 @@ ld {
# Pointer protection.
__pointer_chk_guard;
+
+ # for signal safe TLS
+ signal_safe_malloc; signal_safe_free; signal_safe_memalign;
+ signal_safe_realloc; signal_safe_calloc;
}
}
But adjusted to export __signal_safe_memalign, etc (i.e. add double
underscore).
I *think* exporting these symbols for 2.19 is the right thing to do.
I'll send a real patch later today if there is no major disagreement on
this.
Thanks,
More information about the Libc-alpha
mailing list