diff --git a/src/base/linuxthreads.cc b/src/base/linuxthreads.cc index 64bb233..da6959e 100644 --- a/src/base/linuxthreads.cc +++ b/src/base/linuxthreads.cc @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -648,6 +649,14 @@ int TCMalloc_ListAllProcessThreads(void *parameter, } need_sigprocmask = 1; + // make sure all functions used by parent from local_clone to after + // waitpid have plt entries fully initialized. We cannot afford + // dynamic linker running relocations and messing with errno (see + // comment just below) + (void)prctl(PR_GET_PDEATHSIG, 0); + (void)close(-1); + (void)waitpid(INT_MIN, nullptr, 0); + /* After cloning, both the parent and the child share the same * instance of errno. We deal with this by being very * careful. Specifically, child immediately calls into sem_wait