[compiler-rt] ffd9c12 - [dfsan] Dfsan version of D113328

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 9 18:24:09 PST 2021


Author: Vitaly Buka
Date: 2021-11-09T18:23:55-08:00
New Revision: ffd9c123e759e5811c1f643ab0ec21a23962a7af

URL: https://github.com/llvm/llvm-project/commit/ffd9c123e759e5811c1f643ab0ec21a23962a7af
DIFF: https://github.com/llvm/llvm-project/commit/ffd9c123e759e5811c1f643ab0ec21a23962a7af.diff

LOG: [dfsan] Dfsan version of D113328

Depends on D113328.

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

Added: 
    

Modified: 
    compiler-rt/lib/dfsan/dfsan_custom.cpp
    compiler-rt/lib/dfsan/dfsan_thread.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/dfsan/dfsan_custom.cpp b/compiler-rt/lib/dfsan/dfsan_custom.cpp
index 2ecbc07033668..217bd35c1c541 100644
--- a/compiler-rt/lib/dfsan/dfsan_custom.cpp
+++ b/compiler-rt/lib/dfsan/dfsan_custom.cpp
@@ -756,6 +756,7 @@ static void *DFsanThreadStartFunc(void *arg) {
   DFsanThread *t = (DFsanThread *)arg;
   SetCurrentThread(t);
   t->Init();
+  SetSigProcMask(&t->starting_sigset_, nullptr);
   return t->ThreadStart();
 }
 
@@ -776,6 +777,7 @@ static int dfsan_pthread_create(pthread_t *thread, const pthread_attr_t *attr,
   DFsanThread *t =
       DFsanThread::Create(start_routine_trampoline,
                           (thread_callback_t)start_routine, arg, track_origins);
+  ScopedBlockSignals block(&t->starting_sigset_);
   int res = pthread_create(thread, attr, DFsanThreadStartFunc, t);
 
   if (attr == &myattr)

diff  --git a/compiler-rt/lib/dfsan/dfsan_thread.h b/compiler-rt/lib/dfsan/dfsan_thread.h
index 6952963cfc48f..1c33a18549972 100644
--- a/compiler-rt/lib/dfsan/dfsan_thread.h
+++ b/compiler-rt/lib/dfsan/dfsan_thread.h
@@ -15,6 +15,7 @@
 
 #include "dfsan_allocator.h"
 #include "sanitizer_common/sanitizer_common.h"
+#include "sanitizer_common/sanitizer_posix.h"
 
 namespace __dfsan {
 
@@ -45,6 +46,7 @@ class DFsanThread {
   DFsanThreadLocalMallocStorage &malloc_storage() { return malloc_storage_; }
 
   int destructor_iterations_;
+  __sanitizer_sigset_t starting_sigset_;
 
  private:
   void SetThreadStackAndTls();


        


More information about the llvm-commits mailing list