This is an archive of the discontinued LLVM Phabricator instance.

[lsan] [aarch64] Fix calculating TLS area
ClosedPublic

Authored by spetrovic on Sep 12 2016, 6:15 AM.

Details

Summary

This patch fixes calculating begin of TLS area. For example in pthread_setspecific function memory is allocated (calloc) and pointer on that memory is stored in TLS area, before this patch LSAN was skipping that part of TLS area (because begin of TLS area was not calculated correctly). Because of this memory leak was reported. I'm referencing on libc (# define THREAD_SELF \ ((struct pthread *)__builtin_thread_pointer () - 1)) in calculating begin of TLS area. This patch fixes make-check tests: TestCases/use_tls_pthread_specific_dynamic.cc, use_tls_pthread_specific_static.cc.

Diff Detail

Event Timeline

spetrovic updated this revision to Diff 71000.Sep 12 2016, 6:15 AM
spetrovic retitled this revision from to [lsan] [aarch64] Fix calculating TLS area.
spetrovic updated this object.
spetrovic added a subscriber: llvm-commits.
peter.smith accepted this revision.Sep 15 2016, 4:08 AM
peter.smith edited edge metadata.

This looks good to me, with the caveat that I'm not an expert in this area. I've checked that descr_addr will match the glibc THREAD_SELF macro for AARCH64 so this looks sensible.

This revision is now accepted and ready to land.Sep 15 2016, 4:08 AM
This revision was automatically updated to reflect the committed changes.