[NFC][compiler-rt][hwasan] Move hwasanThreadList().CreateCurrentThread() into InitThreads
authorLeonard Chan <leonardchan@google.com>
Fri, 18 Jun 2021 20:39:58 +0000 (13:39 -0700)
committerLeonard Chan <leonardchan@google.com>
Fri, 18 Jun 2021 20:40:55 +0000 (13:40 -0700)
Once D104553 lands, CreateCurrentThread will be able to accept optional
parameters for initializing the hwasan thread object. On fuchsia, we can get
stack info in the platform-specific InitThreads and pass it through
CreateCurrentThread. On linux, this is a no-op.

Differential Revision: https://reviews.llvm.org/D104561

compiler-rt/lib/hwasan/hwasan.cpp
compiler-rt/lib/hwasan/hwasan_linux.cpp

index 6b4aefc..0401783 100644 (file)
@@ -276,7 +276,6 @@ static void InitInstrumentation() {
   }
 
   InitThreads();
-  hwasanThreadList().CreateCurrentThread();
 
   hwasan_instrumentation_inited = 1;
 }
index 8fbb8ee..bc5ac3b 100644 (file)
@@ -250,6 +250,7 @@ void InitThreads() {
   ProtectGap(thread_space_end,
              __hwasan_shadow_memory_dynamic_address - thread_space_end);
   InitThreadList(thread_space_start, thread_space_end - thread_space_start);
+  hwasanThreadList().CreateCurrentThread();
 }
 
 bool MemIsApp(uptr p) {