OSDN Git Service

Make dlerror(3) thread-safe.
authorElliott Hughes <enh@google.com>
Tue, 16 Oct 2012 22:54:46 +0000 (15:54 -0700)
committerElliott Hughes <enh@google.com>
Wed, 17 Oct 2012 00:58:17 +0000 (17:58 -0700)
commit5419b9474753d25dff947c7740532f86d130c0be
tree4d746cfc20a1d3b5886f691ed1a49ddf34e2df78
parenta9944cfe9e152ca46afb0a77300ec5a2a1a24e64
Make dlerror(3) thread-safe.

I gave up trying to use the usual thread-local buffer idiom; calls to
calloc(3) and free(3) from any of the "dl" functions -- which live in
the dynamic linker -- end up resolving to the dynamic linker's stubs.
I tried to work around that, but was just making things more complicated.
This alternative costs us a well-known TLS slot (instead of the
dynamically-allocated TLS slot we'd have used otherwise, so no difference
there), plus an extra buffer inside every pthread_internal_t.

Bug: 5404023
Change-Id: Ie9614edd05b6d1eeaf7bf9172792d616c6361767
libc/bionic/pthread.c
libc/bionic/pthread_internal.h
libc/bionic/strerror.cpp
libc/bionic/strsignal.cpp
libc/private/ThreadLocalBuffer.h [moved from libc/bionic/ThreadLocalBuffer.h with 68% similarity]
libc/private/bionic_tls.h
linker/dlfcn.cpp
linker/linker.cpp
tests/dlopen_test.cpp
tests/string_test.cpp