Fix: work-around glibc lying about dlsym()/dlerror() leafness
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 14 Feb 2014 15:02:51 +0000 (10:02 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 14 Feb 2014 15:02:51 +0000 (10:02 -0500)
commitf02baefb3ba4d5493816d63f65625ba4269224d2
tree7573e63d4669bb7494cec6e292b81e94165c7d55
parent79f3848bb8124bfa476effa461d230cb9f54c7a2
Fix: work-around glibc lying about dlsym()/dlerror() leafness

Especially in the LTTng-UST malloc instrumentation, we run into the
following situation:

1) Our calloc wrapper is called,
2) we setup the static allocator,
3) we call dlsym() to lookup the symbol of the real allocator,
4) dlsym() calls into calloc(), which is overridden by our own wrapper.
   Our calloc does not see that the static allocator has been set,
   because the stores setting up the static allocator have been optimized
   away by gcc-4.8 (in O2), because the dlsym() prototype declares it
   with the "leaf" attribute, and thus we end up doing an infinite
   recursion, and eventually a segmentation fault.

Thanks to Alexander Monakov for pointing out the culprit of this glibc
bug.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/Makefile.am
include/lttng/ust-dlfcn.h [new file with mode: 0644]
liblttng-ust-dl/ustdl.c
liblttng-ust-fork/ustfork.c
liblttng-ust-libc-wrapper/lttng-ust-malloc.c
liblttng-ust-libc-wrapper/lttng-ust-pthread.c
liblttng-ust/lttng-ust-baddr.c
liblttng-ust/lttng-ust-comm.c
This page took 0.02547 seconds and 4 git commands to generate.