[compiler-rt] r300886 - Define a suppression for known leaks on pthread_exit call.
Alex Shlyapnikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 13:54:19 PDT 2017
Author: alekseyshl
Date: Thu Apr 20 15:54:19 2017
New Revision: 300886
URL: http://llvm.org/viewvc/llvm-project?rev=300886&view=rev
Log:
Define a suppression for known leaks on pthread_exit call.
Summary: Refer to D32194 for the context.
Reviewers: eugenis
Subscribers: kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D32303
Modified:
compiler-rt/trunk/lib/asan/tests/asan_test_main.cc
compiler-rt/trunk/lib/lsan/lsan_common.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
Modified: compiler-rt/trunk/lib/asan/tests/asan_test_main.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test_main.cc?rev=300886&r1=300885&r2=300886&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test_main.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test_main.cc Thu Apr 20 15:54:19 2017
@@ -22,13 +22,10 @@ extern "C" const char* __asan_default_op
// turn symbolization off to speed up testing, especially when not running
// with llvm-symbolizer but with atos.
return "symbolize=false:abort_on_error=0:log_to_syslog=0";
-#elif SANITIZER_PPC || defined(__thumb__)
+#elif SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT
// On PowerPC and ARM Thumb, a couple tests involving pthread_exit fail due to
- // leaks detected by LSan. pthread_exit tries to perform unwinding that leads
- // to dlopen'ing libgcc_s.so. dlopen mallocs "libgcc_s.so" string which
- // confuses LSan, it fails to realize that this allocation happens in dynamic
- // linker and should be ignored. Symbolized leak report is required to define
- // a suppression for this known problem.
+ // leaks detected by LSan. Symbolized leak report is required to apply a
+ // suppression for this known problem.
return "";
#else
// Let's turn symbolization off to speed up testing (more than 3 times speedup
Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=300886&r1=300885&r2=300886&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Thu Apr 20 15:54:19 2017
@@ -848,7 +848,13 @@ int __lsan_is_turned_off() {
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
const char *__lsan_default_suppressions() {
+#if SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT
+ // The actual string allocation happens here (for more details refer to the
+ // SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT definition).
+ return "leak:*_dl_map_object_deps*";
+#else
return "";
+#endif // SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT
}
#endif
} // extern "C"
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h?rev=300886&r1=300885&r2=300886&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h Thu Apr 20 15:54:19 2017
@@ -259,4 +259,15 @@
# define SANITIZER_GO 0
#endif
+// On PowerPC and ARM Thumb, calling pthread_exit() causes LSan to detect leaks.
+// pthread_exit() performs unwinding that leads to dlopen'ing libgcc_s.so.
+// dlopen mallocs "libgcc_s.so" string which confuses LSan, it fails to realize
+// that this allocation happens in dynamic linker and should be ignored.
+#if SANITIZER_PPC || defined(__thumb__)
+# define SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT 1
+#else
+# define SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT 0
+#endif
+
+
#endif // SANITIZER_PLATFORM_H
More information about the llvm-commits
mailing list