[scudo] Add thread-safety annotations on TSD data members
authorChia-hung Duan <chiahungduan@google.com>
Wed, 15 Feb 2023 01:30:45 +0000 (01:30 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Wed, 15 Feb 2023 23:44:44 +0000 (23:44 +0000)
commitae1bd3adf02f4f381b3298b794fab8387d794538
treea7a191549defdd052af6b41d1bea1eca38988d8e
parente7d3f43eafdd01e50402754ac9c5e6ae9d5118e1
[scudo] Add thread-safety annotations on TSD data members

Ideally, we want to assert that all the operations on
Cache/QuarantineCache always have the `Mutex` acquired. However,
the current architecture of accessing TSD is not easy to cooperate
with the thread-safety analysis because of pointer aliasing. In
alternative, we add the getters for accessing TSD member and attach
proper thread-safety annotations on them.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D142151
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
compiler-rt/lib/scudo/standalone/tests/tsd_test.cpp
compiler-rt/lib/scudo/standalone/tsd.h