summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-10-13 22:34:13 +0000
committerKostya Serebryany <kcc@google.com>2016-10-13 22:34:13 +0000
commitfc1639bfbc51826037ac6647c7faf280790c6bf9 (patch)
tree74ec80bf47280c42ceaddaaca6c65d71d4b1d4cb /lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
parentd3c013b9deae818346f31918f8c61d7cbb97a4d3 (diff)
Make lsan complain loudly when running under ptrace
Summary: LeakSanitizer does not work with ptrace but currently it will print warnings (only under verbosity=1) and then proceed to print tons of false reports. This patch makes lsan fail hard under ptrace with a verbose message. https://github.com/google/sanitizers/issues/728 Reviewers: eugenis, vitalybuka, aizatsky Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D25538 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@284171 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index 1ce232b44..eb4c403d3 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -190,6 +190,7 @@ void ThreadSuspender::KillAllThreads() {
bool ThreadSuspender::SuspendAllThreads() {
ThreadLister thread_lister(pid_);
bool added_threads;
+ bool first_iteration = true;
do {
// Run through the directory entries once.
added_threads = false;
@@ -199,12 +200,13 @@ bool ThreadSuspender::SuspendAllThreads() {
added_threads = true;
tid = thread_lister.GetNextTID();
}
- if (thread_lister.error()) {
+ if (thread_lister.error() || (first_iteration && !added_threads)) {
// Detach threads and fail.
ResumeAllThreads();
return false;
}
thread_lister.Reset();
+ first_iteration = false;
} while (added_threads);
return true;
}