[patch] Make _thread_db_sizeof_pthread public for Sanitizers

Jan Kratochvil jan.kratochvil@redhat.com
Fri Jan 1 10:08:18 GMT 2021


Sanitizers currently contain ugly list of glibc versions and their
sizeof(struct pthread).
	https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp#L276

This list is not much maintained causing SEGVs of Sanitizers:
	$ echo 'int main(){}'|clang -g -fsanitize=leak -x c++ -;./a.out
	Tracer caught signal 11: addr=0x7f1087f51f40 pc=0x4222c8 sp=0x7f1086effd40
	==234624==LeakSanitizer has encountered a fatal error.
	==234624==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
	==234624==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)

I would find better if just glibc made the value public, Sanitizers can then
read it by dlsym():
	http://people.redhat.com/jkratoch/lsan-pthread.patch

diff --git a/nptl/Versions b/nptl/Versions
index aed118e717..4144acbac7 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -297,6 +297,10 @@ libpthread {
     pthread_clockjoin_np;
   }
 
+  GLIBC_2.33 {
+    _thread_db_sizeof_pthread;
+  }
+
   GLIBC_PRIVATE {
     __pthread_initialize_minimal;
     __pthread_clock_gettime; __pthread_clock_settime;



More information about the Libc-alpha mailing list