summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2017-06-05 07:36:02 +0000
committerRenato Golin <renato.golin@linaro.org>2017-06-05 07:36:02 +0000
commit9c790e8abc177dee14e192c982c911f37b9653e7 (patch)
tree37e2d6e5f19ec172d9656de696e579c5d04a4a8e /lib
parenta3054203772cb561ce8023508c9005d74b1afe0d (diff)
Revert "[sanitizer-coverage] test for -fsanitize-coverage=inline-8bit-counters"
Revert "Mark sancov test as unsupported on Darwin" Revert "[LSan] Detect dynamic loader by its base address." This reverts commit r304633. This reverts commit r304673. This reverts commit r304632. Those commit have broken LOTS of ARM/AArch64 bots for two days. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/lsan/lsan_common.cc3
-rw-r--r--lib/lsan/lsan_common_linux.cc23
-rw-r--r--lib/sanitizer_common/sanitizer_linux.cc10
-rw-r--r--lib/sanitizer_common/sanitizer_platform.h9
4 files changed, 16 insertions, 29 deletions
diff --git a/lib/lsan/lsan_common.cc b/lib/lsan/lsan_common.cc
index d4f670681..a5ffc6835 100644
--- a/lib/lsan/lsan_common.cc
+++ b/lib/lsan/lsan_common.cc
@@ -408,9 +408,6 @@ static void MarkInvalidPCCb(uptr chunk, void *arg) {
// On Linux, handles dynamically allocated TLS blocks by treating all chunks
// allocated from ld-linux.so as reachable.
-// On Linux, treats all chunks allocated from ld-linux.so as reachable, which
-// covers dynamically allocated TLS blocks, internal dynamic loader's loaded
-// modules accounting etc.
// Dynamic TLS blocks contain the TLS variables of dynamically loaded modules.
// They are allocated with a __libc_memalign() call in allocate_and_init()
// (elf/dl-tls.c). Glibc won't tell us the address ranges occupied by those
diff --git a/lib/lsan/lsan_common_linux.cc b/lib/lsan/lsan_common_linux.cc
index 2e4095b49..c903be42d 100644
--- a/lib/lsan/lsan_common_linux.cc
+++ b/lib/lsan/lsan_common_linux.cc
@@ -23,10 +23,6 @@
#include "sanitizer_common/sanitizer_linux.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
-#if SANITIZER_USE_GETAUXVAL
-#include <sys/auxv.h>
-#endif // SANITIZER_USE_GETAUXVAL
-
namespace __lsan {
static const char kLinkerName[] = "ld";
@@ -34,12 +30,8 @@ static const char kLinkerName[] = "ld";
static char linker_placeholder[sizeof(LoadedModule)] ALIGNED(64);
static LoadedModule *linker = nullptr;
-static bool IsLinker(const LoadedModule& module) {
-#if SANITIZER_USE_GETAUXVAL
- return module.base_address() == getauxval(AT_BASE);
-#else
- return LibraryNameIs(module.full_name(), kLinkerName);
-#endif // SANITIZER_USE_GETAUXVAL
+static bool IsLinker(const char* full_name) {
+ return LibraryNameIs(full_name, kLinkerName);
}
__attribute__((tls_model("initial-exec")))
@@ -57,25 +49,22 @@ void InitializePlatformSpecificModules() {
ListOfModules modules;
modules.init();
for (LoadedModule &module : modules) {
- if (!IsLinker(module))
- continue;
+ if (!IsLinker(module.full_name())) continue;
if (linker == nullptr) {
linker = reinterpret_cast<LoadedModule *>(linker_placeholder);
*linker = module;
module = LoadedModule();
} else {
VReport(1, "LeakSanitizer: Multiple modules match \"%s\". "
- "TLS and other allocations originating from linker might be "
- "falsely reported as leaks.\n", kLinkerName);
+ "TLS will not be handled correctly.\n", kLinkerName);
linker->clear();
linker = nullptr;
return;
}
}
if (linker == nullptr) {
- VReport(1, "LeakSanitizer: Dynamic linker not found. TLS and other "
- "allocations originating from linker might be falsely reported "
- "as leaks.\n");
+ VReport(1, "LeakSanitizer: Dynamic linker not found. "
+ "TLS will not be handled correctly.\n");
}
}
diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc
index 7bc7682dd..cec2f264c 100644
--- a/lib/sanitizer_common/sanitizer_linux.cc
+++ b/lib/sanitizer_common/sanitizer_linux.cc
@@ -75,6 +75,16 @@ extern char **environ; // provided by crt1
#include <sys/signal.h>
#endif
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
+#if SANITIZER_LINUX && __GLIBC_PREREQ(2, 16)
+# define SANITIZER_USE_GETAUXVAL 1
+#else
+# define SANITIZER_USE_GETAUXVAL 0
+#endif
+
#if SANITIZER_USE_GETAUXVAL
#include <sys/auxv.h>
#endif
diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h
index 8fa3f7ab6..49732aa32 100644
--- a/lib/sanitizer_common/sanitizer_platform.h
+++ b/lib/sanitizer_common/sanitizer_platform.h
@@ -269,14 +269,5 @@
# define SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT 0
#endif
-#ifndef __GLIBC_PREREQ
-#define __GLIBC_PREREQ(x, y) 0
-#endif
-
-#if SANITIZER_LINUX && __GLIBC_PREREQ(2, 16)
-# define SANITIZER_USE_GETAUXVAL 1
-#else
-# define SANITIZER_USE_GETAUXVAL 0
-#endif
#endif // SANITIZER_PLATFORM_H