[PATCH] D45562: Asan, attmept to fix FreeBSD from stalling
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 12 03:11:11 PDT 2018
devnexen created this revision.
devnexen added reviewers: eugenis, vitalybuka.
Herald added subscribers: Sanitizers, llvm-commits, krytarowski, kubamracek, emaste.
devnexen abandoned this revision.
- Actually Asan on FreeBSD, due pthread_key_specific approach, during AsanTSDInit, remains stuck in this state.
- Here a proposal to simply save the context as is.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D45562
Files:
lib/asan/asan_posix.cc
Index: lib/asan/asan_posix.cc
===================================================================
--- lib/asan/asan_posix.cc
+++ lib/asan/asan_posix.cc
@@ -40,29 +40,47 @@
// ---------------------- TSD ---------------- {{{1
+#if SANITIZER_FREEBSD
+static void *_tsd = nullptr;
+#else
static pthread_key_t tsd_key;
+#endif
static bool tsd_key_inited = false;
void AsanTSDInit(void (*destructor)(void *tsd)) {
CHECK(!tsd_key_inited);
tsd_key_inited = true;
+#if !SANITIZER_FREEBSD
CHECK_EQ(0, pthread_key_create(&tsd_key, destructor));
+#endif
}
void *AsanTSDGet() {
CHECK(tsd_key_inited);
+#if SANITIZER_FREEBSD
+ return _tsd;
+#else
return pthread_getspecific(tsd_key);
+#endif
}
void AsanTSDSet(void *tsd) {
CHECK(tsd_key_inited);
+#if SANITIZER_FREEBSD
+ _tsd = tsd;
+#else
pthread_setspecific(tsd_key, tsd);
+#endif
}
void PlatformTSDDtor(void *tsd) {
AsanThreadContext *context = (AsanThreadContext*)tsd;
if (context->destructor_iterations > 1) {
context->destructor_iterations--;
+#if SANITIZER_FREEBSD
+ _tsd = tsd;
+#else
CHECK_EQ(0, pthread_setspecific(tsd_key, tsd));
+#endif
return;
}
AsanThread::TSDDtor(tsd);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45562.142140.patch
Type: text/x-patch
Size: 1194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/23fe6d66/attachment.bin>
More information about the llvm-commits
mailing list