summaryrefslogtreecommitdiff
path: root/lib/asan/asan_thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asan/asan_thread.cc')
-rw-r--r--lib/asan/asan_thread.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/asan/asan_thread.cc b/lib/asan/asan_thread.cc
index a52ab5a0..00d62c0e 100644
--- a/lib/asan/asan_thread.cc
+++ b/lib/asan/asan_thread.cc
@@ -43,8 +43,12 @@ void AsanThreadContext::OnFinished() {
static ALIGNED(16) char thread_registry_placeholder[sizeof(ThreadRegistry)];
static ThreadRegistry *asan_thread_registry;
+static BlockingMutex mu_for_thread_context(LINKER_INITIALIZED);
+static LowLevelAllocator allocator_for_thread_context;
+
static ThreadContextBase *GetAsanThreadContext(u32 tid) {
- void *mem = MmapOrDie(sizeof(AsanThreadContext), "AsanThreadContext");
+ BlockingMutexLock lock(&mu_for_thread_context);
+ void *mem = allocator_for_thread_context.Allocate(sizeof(AsanThreadContext));
return new(mem) AsanThreadContext(tid);
}