The pthread_self fallback implementation in libc.so returns NULL before libpthread is loaded. It should return the POSIX thread ID of the main thread instead.
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU C Library master sources". The branch, master has been updated via 8a26ad2ab7396bc94fd3cd7b25cba433908d30e1 (commit) from 5069ff32842c60c55f8b573ee66fe43f9ec364af (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8a26ad2ab7396bc94fd3cd7b25cba433908d30e1 commit 8a26ad2ab7396bc94fd3cd7b25cba433908d30e1 Author: Florian Weimer <fweimer@redhat.com> Date: Wed Dec 20 11:40:36 2017 +0100 nptl: Implement pthread_self in libc.so [BZ #22635] All binaries use TLS and thus need a properly set up TCB, so we can simply return its address directly, instead of forwarding to the libpthread implementation from libc. For versioned symbols, the dynamic linker checks that the soname matches the name supplied by the link editor, so a compatibility symbol in libpthread is needed. To avoid linking against the libpthread function in all cases, we would have to bump the symbol version of libpthread in libc.so and supply a compat symbol. This commit does not do that because the function implementation is so small, so the overhead by two active copies of the same function might well be smaller than the increase in symbol table size. ----------------------------------------------------------------------- Summary of changes: ChangeLog | 15 +++++++++++++++ nptl/Makefile | 4 ++-- .../compat-pthread_self.c | 20 ++++++++------------ nptl/forward.c | 4 ---- nptl/nptl-init.c | 1 - nptl/pthread_self.c | 4 +--- sysdeps/nptl/pthread-functions.h | 1 - 7 files changed, 26 insertions(+), 23 deletions(-) copy sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S => nptl/compat-pthread_self.c (71%)
Fixed in 2.27.