[compiler-rt] [rtsan] Loosen requirements of halt_on_error test (PR #210734)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 07:52:37 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Chris Apple (cjappl)

<details>
<summary>Changes</summary>

Some systems may call other intercepted functions during the course of a `malloc`. This would result in some error stack such as:

```
 ERROR malloc
     ERROR pthread_mutex_lock
     ERROR pthread_mutex_unlock
     
 ERROR free
     ERROR pthread_mutex_lock
     ERROR pthread_mutex_unlock
```

We support this as RTSan, but this test would be overly specific on those platforms. As written, this requires "only malloc, then free immediately after". The change makes this "at least malloc is called, and then later at least free is called". This still keeps the spirit of the check the same but allows for more (valid) interpretation in between.



NOTE:
In the future, we may want to consider doing something similar here:
https://github.com/llvm/llvm-project/blob/40c4fea67f49b841bd064624219efceab91b65e0/compiler-rt/test/rtsan/stack_suppressions.cpp#L65

This specifies ONLY 7 suppressions should happen here which is extremely specific. However I did not change this because it's a little trickier. We don't really have a test for this stack suppressions method anywhere else. We could do something like "at least 7 things should be suppressed", but it's messier so I left that for a future exercise. 

---
Full diff: https://github.com/llvm/llvm-project/pull/210734.diff


1 Files Affected:

- (modified) compiler-rt/test/rtsan/halt_on_error.cpp (+1-1) 


``````````diff
diff --git a/compiler-rt/test/rtsan/halt_on_error.cpp b/compiler-rt/test/rtsan/halt_on_error.cpp
index c2ebdf349f371..4656c1e50f248 100644
--- a/compiler-rt/test/rtsan/halt_on_error.cpp
+++ b/compiler-rt/test/rtsan/halt_on_error.cpp
@@ -22,5 +22,5 @@ int main() {
   // CHECK: ==ERROR: RealtimeSanitizer
   // CHECK-NEXT: {{.*`malloc`.*}}
   // CHECK-NO-HALT: ==ERROR: RealtimeSanitizer
-  // CHECK-NO-HALT-NEXT: {{.*`free`.*}}
+  // CHECK-NO-HALT: {{.*`free`.*}}
 }

``````````

</details>


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


More information about the llvm-commits mailing list