This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: glibc 2.19 - asyn-signal safe TLS and ASan.
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Kostya Serebryany <kcc at google dot com>, Andrew Hunter <ahh at google dot com>
- Cc: Carlos O'Donell <carlos at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, Roland McGrath <roland at hack dot frob dot com>, address-sanitizer at googlegroups dot com
- Date: Fri, 24 Jan 2014 09:19:20 -0800
- Subject: Re: glibc 2.19 - asyn-signal safe TLS and ASan.
- Authentication-results: sourceware.org; auth=none
- References: <52D0BCED dot 3000109 at redhat dot com> <52DDBF0E dot 8010501 at redhat dot com> <CAN=P9piS3Xczq2AKrzh4rsK9JxiHtJXawcQs9_+xsYXxrbLQWQ at mail dot gmail dot com> <CADroS=6vODmWCdBsynOf7oM9uVDymwdxrSDFbmD6kT5P9gbBRw at mail dot gmail dot com> <CAN=P9pgAYNZBUBbg2_SiwCjB5vXJ6ZXTNS=yoZWSvS3JoX1bGQ at mail dot gmail dot com>
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,