[compiler-rt] 55792b5 - [sanitizer] Fail instead of crash without real_pthread_create

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 23 20:32:20 PST 2021


Author: Vitaly Buka
Date: 2021-11-23T20:32:09-08:00
New Revision: 55792b5ac44e4c0d3a8feb8a793d60d58e38cf20

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

LOG: [sanitizer] Fail instead of crash without real_pthread_create

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 596037d772222..ad70d8f1a3f98 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -1760,6 +1760,8 @@ HandleSignalMode GetHandleSignalMode(int signum) {
 
 #if !SANITIZER_GO
 void *internal_start_thread(void *(*func)(void *arg), void *arg) {
+  if (&real_pthread_create == 0)
+    return nullptr;
   // Start the thread with signals blocked, otherwise it can steal user signals.
   ScopedBlockSignals block(nullptr);
   void *th;


        


More information about the llvm-commits mailing list