This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Simplify ThreadDescriptorSize on i386/x86_64/s390
AbandonedPublic

Authored by MaskRay on Mar 30 2021, 1:12 AM.

Details

Reviewers
vitalybuka
eugenis
Group Reviewers
Restricted Project
Summary

ThreadDescriptorSize is only used by lsan to scan thread-specific data keys in
the thread control block.

On TLS Variant II architectures (i386/x86_64/s390), our dl_iterate_phdr
based approach can cover the region from the first byte of the static
TLS block (static TLS surplus) to the thread pointer.
We just need to extend the range to include the first few members of
struct pthread. offsetof(struct pthread, specific_used) satisfies
the requirement and has not changed since 2007-05-10. We don't need to
update ThreadDescriptorSize for each glibc version.

Diff Detail

Event Timeline

MaskRay created this revision.Mar 30 2021, 1:12 AM
MaskRay requested review of this revision.Mar 30 2021, 1:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2021, 1:12 AM
MaskRay edited the summary of this revision. (Show Details)Mar 30 2021, 1:13 AM
vitalybuka added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
201

we don't need atomic_load_relaxed on non-glibcversion path

207

why this works only for x86?

vitalybuka requested changes to this revision.Apr 26 2021, 5:54 PM

There is few minor unanswered questions, but I don't know if this patch is still needed.

This revision now requires changes to proceed.Apr 26 2021, 5:54 PM
MaskRay abandoned this revision.Apr 26 2021, 8:14 PM

This should be unneeded after D100892. Now we can't delete the x86-64 struct pthread size switch because we keep using the old approach for x86-64.