sanitizer_common: Fix the build for platforms that use shared TSDs
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 12 Jul 2021 15:47:46 +0000 (17:47 +0200)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 12 Jul 2021 15:49:48 +0000 (17:49 +0200)
Looks like an oversight in 0da172b1766e1559ef677aa836dce4f1995dfef3

compiler-rt/lib/scudo/scudo_tsd_shared.inc:53:1: error: mutex 'TSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
}
^
compiler-rt/lib/scudo/scudo_tsd_shared.inc:49:12: note: mutex acquired here
  if (TSD->tryLock())
           ^

compiler-rt/lib/scudo/scudo_tsd_shared.inc

index 8f3362dd3d7100fc4aa85fbb859df97945b0f71f..e46b044a81f8113f0bf0f50da800842c6ff75f51 100644 (file)
@@ -41,7 +41,8 @@ ALWAYS_INLINE void initThreadMaybe(bool MinimalInit = false) {
 
 ScudoTSD *getTSDAndLockSlow(ScudoTSD *TSD);
 
-ALWAYS_INLINE ScudoTSD *getTSDAndLock(bool *UnlockRequired) {
+ALWAYS_INLINE ScudoTSD *
+getTSDAndLock(bool *UnlockRequired) NO_THREAD_SAFETY_ANALYSIS {
   ScudoTSD *TSD = getCurrentTSD();
   DCHECK(TSD && "No TSD associated with the current thread!");
   *UnlockRequired = true;