llvm-project/compiler-rt/lib/tsan/rtl
Fangrui Song 9be8f8b34d [sanitizer] Simplify GetTls with dl_iterate_phdr
GetTls is the range of

* thread control block and optional TLS_PRE_TCB_SIZE
* static TLS blocks plus static TLS surplus

On glibc, lsan requires the range to include
`pthread::{specific_1stblock,specific}` so that allocations only referenced by
`pthread_setspecific` can be scanned.

This patch uses `dl_iterate_phdr` to collect TLS ranges. Find the one
with `dlpi_tls_modid==1` as one of the initially loaded module, then find
consecutive ranges. The boundaries give us addr and size.

This allows us to drop the glibc internal `_dl_get_tls_static_info` and
`InitTlsSize` entirely. Use the simplified method with non-Android Linux for
now, but in theory this can be used with *BSD and potentially other ELF OSes.

In the future, we can move `ThreadDescriptorSize` code to lsan (and consider
intercepting `pthread_setspecific`) to avoid hacks in generic code.

See https://reviews.llvm.org/D93972#2480556 for analysis on GetTls usage
across various sanitizers.

Differential Revision: https://reviews.llvm.org/D98926
2021-03-25 21:55:27 -07:00
..
tsan.syms.extra [compiler-rt][tsan] Make fiber support in thread sanitizer dynamic linkable 2020-03-11 14:14:33 +01:00
tsan_clock.cpp tsan: fix false positives in AcquireGlobal 2020-05-27 16:27:47 +02:00
tsan_clock.h tsan: fix false positives in AcquireGlobal 2020-05-27 16:27:47 +02:00
tsan_debugging.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_defs.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_dense_alloc.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_dispatch_defs.h [TSan][libdispatch] Ensure TSan dylib works on old systems 2020-08-18 18:34:14 -07:00
tsan_external.cpp [AArch64][compiler-rt] Strip PAC from the link register. 2021-03-18 22:01:50 +01:00
tsan_fd.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_fd.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_flags.cpp [sanitizers] Remove unneeded MaybeCall*DefaultOptions() and nullptr checks 2020-09-08 10:12:05 -07:00
tsan_flags.h Improve error message when '=' is missing in {ASAN,...}_OPTIONS. 2019-06-15 01:37:14 +00:00
tsan_flags.inc [TSan] Revert removal of ignore_interceptors_accesses flag 2020-06-08 12:35:43 -07:00
tsan_ignoreset.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_ignoreset.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_interceptors.h [compiler-rt] Replace INLINE with inline 2020-09-17 16:24:20 +02:00
tsan_interceptors_libdispatch.cpp [TSan][libdispatch] Fix compilation error on Linux 2020-09-02 11:20:47 -07:00
tsan_interceptors_mac.cpp [sanitizer][Darwin] Suppress -Wno-non-virtual-dtor warning 2021-01-05 17:09:18 -08:00
tsan_interceptors_mach_vm.cpp [TSan][Darwin] Handle NULL argument in interceptor 2020-08-24 11:36:02 -07:00
tsan_interceptors_posix.cpp [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
tsan_interface.cpp [AArch64][compiler-rt] Strip PAC from the link register. 2021-03-18 22:01:50 +01:00
tsan_interface.h [TSan] Support initialize/finalize hooks in dynamic libraries 2021-03-24 12:38:39 -07:00
tsan_interface_ann.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_interface_ann.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_interface_atomic.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_interface_inl.h [AArch64][compiler-rt] Strip PAC from the link register. 2021-03-18 22:01:50 +01:00
tsan_interface_java.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_interface_java.h Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_malloc_mac.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_md5.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_mman.cpp [sanitizer_common] Create max_allocation_size_mb flag. 2019-10-30 11:26:05 -07:00
tsan_mman.h Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_mutex.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_mutex.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_mutexset.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_mutexset.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_new_delete.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_platform.h [sanitizers] Enable runtime vma for mips64 in buildgo.sh 2021-03-09 11:45:55 +01:00
tsan_platform_linux.cpp [sanitizer] Simplify GetTls with dl_iterate_phdr 2021-03-25 21:55:27 -07:00
tsan_platform_mac.cpp [tsan] Use large address space mapping on Apple Silicon Macs 2021-03-08 14:09:42 -08:00
tsan_platform_posix.cpp [tsan] Fix aarch64-*-linux after D86377 2021-03-10 22:16:04 -08:00
tsan_platform_windows.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_ppc_regs.h
tsan_preinit.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_report.cpp [sanitizer] Remove max_len parameter from InternalScopedString 2021-03-17 16:57:09 -07:00
tsan_report.h sanitizers: Introduce ThreadType enum 2019-02-07 11:01:22 +00:00
tsan_rtl.cpp [TSan] Support initialize/finalize hooks in dynamic libraries 2021-03-24 12:38:39 -07:00
tsan_rtl.h [sanitizer] Make destructors protected 2020-11-02 18:00:43 -08:00
tsan_rtl_aarch64.S [TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.6 2019-07-16 20:41:04 +00:00
tsan_rtl_amd64.S Revert "[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.4" 2019-07-05 21:03:46 +00:00
tsan_rtl_mips64.S
tsan_rtl_mutex.cpp [sanitizer] Cleanup -Wnon-virtual-dtor warnings 2020-11-02 20:30:50 -08:00
tsan_rtl_ppc64.S
tsan_rtl_proc.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_rtl_report.cpp [sanitizer][NFC] Fix few cpplint warnings 2020-10-13 20:39:37 -07:00
tsan_rtl_thread.cpp tsan: fix leak of ThreadSignalContext memory mapping when destroying fibers 2020-04-11 10:30:31 +02:00
tsan_stack_trace.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_stack_trace.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_stat.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_stat.h tsan: Adding releaseAcquire() to ThreadClock 2020-03-24 11:27:46 +01:00
tsan_suppressions.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
tsan_suppressions.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_symbolize.cpp compiler-rt: Rename .cc file in lib/tsan/rtl to .cpp 2019-08-01 14:22:42 +00:00
tsan_symbolize.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_sync.cpp [tsan] Respect no_huge_pages_for_shadow. 2020-08-13 15:55:23 -04:00
tsan_sync.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_trace.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
tsan_update_shadow_word_inl.h tsan: Optimize performance of Thread sanitizer memory access functions 2019-02-07 12:43:09 +00:00