summaryrefslogtreecommitdiff
path: root/lib/lsan
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2017-05-17 15:25:41 +0000
committerFrancis Ricci <francisjricci@gmail.com>2017-05-17 15:25:41 +0000
commitea3b9d9e843576962991c63e7e644fe507775db0 (patch)
treef508b4b4aca95d108a6fda8f79978d692e262849 /lib/lsan
parent38cc92468ebb3b822a4ae9387939ad99b06fe56a (diff)
Revert "Implement tls scanning for darwin LSan"
This reverts r303262, due to TSan buildbot breakages. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303266 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/lsan')
-rw-r--r--lib/lsan/lsan_common.cc28
-rw-r--r--lib/lsan/lsan_common_mac.cc7
-rw-r--r--lib/lsan/lsan_flags.inc2
3 files changed, 20 insertions, 17 deletions
diff --git a/lib/lsan/lsan_common.cc b/lib/lsan/lsan_common.cc
index 9f862ac96..a6b3453f5 100644
--- a/lib/lsan/lsan_common.cc
+++ b/lib/lsan/lsan_common.cc
@@ -265,21 +265,19 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
}
if (flags()->use_tls) {
- if (tls_begin) {
- LOG_THREADS("TLS at %p-%p.\n", tls_begin, tls_end);
- // If the tls and cache ranges don't overlap, scan full tls range,
- // otherwise, only scan the non-overlapping portions
- if (cache_begin == cache_end || tls_end < cache_begin ||
- tls_end > cache_end) {
- ScanRangeForPointers(tls_begin, tls_end, frontier, "TLS", kReachable);
- } else {
- if (tls_begin < cache_begin)
- ScanRangeForPointers(tls_begin, cache_begin, frontier, "TLS",
- kReachable);
- if (tls_end > cache_end)
- ScanRangeForPointers(cache_end, tls_end, frontier, "TLS",
- kReachable);
- }
+ LOG_THREADS("TLS at %p-%p.\n", tls_begin, tls_end);
+ if (cache_begin == cache_end) {
+ ScanRangeForPointers(tls_begin, tls_end, frontier, "TLS", kReachable);
+ } else {
+ // Because LSan should not be loaded with dlopen(), we can assume
+ // that allocator cache will be part of static TLS image.
+ CHECK_LE(tls_begin, cache_begin);
+ CHECK_GE(tls_end, cache_end);
+ if (tls_begin < cache_begin)
+ ScanRangeForPointers(tls_begin, cache_begin, frontier, "TLS",
+ kReachable);
+ if (tls_end > cache_end)
+ ScanRangeForPointers(cache_end, tls_end, frontier, "TLS", kReachable);
}
if (dtls && !DTLSInDestruction(dtls)) {
for (uptr j = 0; j < dtls->dtv_size; ++j) {
diff --git a/lib/lsan/lsan_common_mac.cc b/lib/lsan/lsan_common_mac.cc
index 839dea4ad..5ee1e2286 100644
--- a/lib/lsan/lsan_common_mac.cc
+++ b/lib/lsan/lsan_common_mac.cc
@@ -91,7 +91,12 @@ LoadedModule *GetLinker() { return nullptr; }
// Required on Linux for initialization of TLS behavior, but should not be
// required on Darwin.
-void InitializePlatformSpecificModules() {}
+void InitializePlatformSpecificModules() {
+ if (flags()->use_tls) {
+ Report("use_tls=1 is not supported on Darwin.\n");
+ Die();
+ }
+}
// Scans global variables for heap pointers.
void ProcessGlobalRegions(Frontier *frontier) {
diff --git a/lib/lsan/lsan_flags.inc b/lib/lsan/lsan_flags.inc
index e390e2ae5..8135bdcff 100644
--- a/lib/lsan/lsan_flags.inc
+++ b/lib/lsan/lsan_flags.inc
@@ -30,7 +30,7 @@ LSAN_FLAG(bool, use_globals, true,
"Root set: include global variables (.data and .bss)")
LSAN_FLAG(bool, use_stacks, true, "Root set: include thread stacks")
LSAN_FLAG(bool, use_registers, true, "Root set: include thread registers")
-LSAN_FLAG(bool, use_tls, true,
+LSAN_FLAG(bool, use_tls, !SANITIZER_MAC,
"Root set: include TLS and thread-specific storage")
LSAN_FLAG(bool, use_root_regions, true,
"Root set: include regions added via __lsan_register_root_region().")