[compiler-rt] 6f61318 - sanitizer_common: Suppress another thread safety warning

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 08:58:04 PDT 2021


Author: Benjamin Kramer
Date: 2021-07-12T17:57:42+02:00
New Revision: 6f6131815e2cedac66bf63d918d36da38526ccbe

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

LOG: sanitizer_common: Suppress another thread safety warning

Another follow-up to 0da172b1766e1559ef677aa836dce4f1995dfef3

compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'CandidateTSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
}
^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:95:21: note: mutex acquired here
      CandidateTSD->lock();
                    ^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'TSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
}
^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:101:8: note: mutex acquired here
  TSD->lock();
       ^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'TSDs[Index].Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
}
^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:80:23: note: mutex acquired here
      if (TSDs[Index].tryLock()) {
                      ^

Added: 
    

Modified: 
    compiler-rt/lib/scudo/scudo_tsd_shared.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/scudo_tsd_shared.cpp b/compiler-rt/lib/scudo/scudo_tsd_shared.cpp
index 59ad2549998c..fd85a7c4017f 100644
--- a/compiler-rt/lib/scudo/scudo_tsd_shared.cpp
+++ b/compiler-rt/lib/scudo/scudo_tsd_shared.cpp
@@ -64,7 +64,7 @@ void initThread(bool MinimalInit) {
   setCurrentTSD(&TSDs[Index % NumberOfTSDs]);
 }
 
-ScudoTSD *getTSDAndLockSlow(ScudoTSD *TSD) {
+ScudoTSD *getTSDAndLockSlow(ScudoTSD *TSD) NO_THREAD_SAFETY_ANALYSIS {
   if (NumberOfTSDs > 1) {
     // Use the Precedence of the current TSD as our random seed. Since we are in
     // the slow path, it means that tryLock failed, and as a result it's very


        


More information about the llvm-commits mailing list