| Issue |
52989
|
| Summary |
[libsanitizer] Use _thread_db_sizeof_pthread in ThreadDescriptorSize
|
| Labels |
|
| Assignees |
|
| Reporter |
mpolacek
|
`ThreadDescriptorSize` in `libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp` currently hardcodes the size of `struct pthread`. Starting with glibc 2.34 and this commit:
> commit fef400a2f976d1fd6a4639e6980f6c50ee13fbf5
> Author: Florian Weimer <[email protected]>
> Date: Mon Jun 28 14:33:53 2021 +0200
>
> nptl: Export libthread_db-used symbols under GLIBC_PRIVATE
>
> This allows distributions to strip debugging information from
> libc.so.6 without impacting the debugging experience.
>
> Reviewed-by: Carlos O'Donell <[email protected]>
it is possible to determine `sizeof (struct pthread)` using `dl(v)sym`, like this:
```
const unsigned int *psize = dlvsym(RTLD_DEFAULT, "_thread_db_sizeof_pthread",
"GLIBC_PRIVATE");
if (psize != nullptr) {
val = *psize;
atomic_store_relaxed(&thread_descriptor_size, val);
return val;
}
```
Such a change would prevent breakage if `struct pthread` in glibc changes.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs