[dfsan] Dfsan version of D113328
Depends on D113328.
Differential Revision: https://reviews.llvm.org/D113454
GitOrigin-RevId: ffd9c123e759e5811c1f643ab0ec21a23962a7af
diff --git a/lib/dfsan/dfsan_custom.cpp b/lib/dfsan/dfsan_custom.cpp
index 2ecbc07..217bd35 100644
--- a/lib/dfsan/dfsan_custom.cpp
+++ b/lib/dfsan/dfsan_custom.cpp
@@ -756,6 +756,7 @@
DFsanThread *t = (DFsanThread *)arg;
SetCurrentThread(t);
t->Init();
+ SetSigProcMask(&t->starting_sigset_, nullptr);
return t->ThreadStart();
}
@@ -776,6 +777,7 @@
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/lib/dfsan/dfsan_thread.h b/lib/dfsan/dfsan_thread.h
index 6952963..1c33a18 100644
--- a/lib/dfsan/dfsan_thread.h
+++ b/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 @@
DFsanThreadLocalMallocStorage &malloc_storage() { return malloc_storage_; }
int destructor_iterations_;
+ __sanitizer_sigset_t starting_sigset_;
private:
void SetThreadStackAndTls();