[patch] Make _thread_db_sizeof_pthread public for Sanitizers
Jan Kratochvil
jan.kratochvil@redhat.com
Sat Jan 2 08:24:15 GMT 2021
On Fri, 01 Jan 2021 13:42:43 +0100, Florian Weimer wrote:
> Do you know why the GetTLS function needs to know the size of the
> thread descriptor? And why it adds it to the start address of the TLS
> area, without subtracting it from the area size? I think this
> identifies the wrong memory region as TLS.
I do not know the memory layout of glibc TLSes (all of their kinds there are).
I just find my proposed fix a better one than to play the catch-up with each
glibc version. If you can find some better fix I sure welcome it.
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp#L468
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp#L237
=
static void GetTls(uptr *addr, uptr *size) {
#if defined(__x86_64__) || defined(__i386__) || defined(__s390__)
*addr = ThreadSelf();
*size = GetTlsSize(); // get_tls_static_info_ptr()->dl_tls_static_size
*addr -= *size;
*addr += ThreadDescriptorSize();
Jan
More information about the Libc-alpha
mailing list