[compiler-rt] [rtsan][compiler-rt] Prevent UB hang in rtsan lock unit tests (PR #104733)

Chris Apple via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 07:17:15 PDT 2024


================
@@ -328,26 +328,64 @@ TEST(TestRtsanInterceptors, PthreadCreateDiesWhenRealtime) {
   ExpectNonRealtimeSurvival(Func);
 }
 
-TEST(TestRtsanInterceptors, PthreadMutexLockDiesWhenRealtime) {
-  auto Func = []() {
-    pthread_mutex_t mutex{};
+class PthreadMutexLockTest : public ::testing::Test {
+protected:
+  void SetUp() override {
+    pthread_mutex_init(&mutex, nullptr);
+    is_locked = false;
+  }
+
+  void TearDown() override {
+    if (is_locked) {
----------------
cjappl wrote:

One of these reviews I'll catch all of them before submitting...

Enjoy your vacation! Thanks again for all your help with RTSan, checking out all our reviews. I very much appreciate you taking the time.

Talk to you when you get back

https://github.com/llvm/llvm-project/pull/104733


More information about the llvm-commits mailing list