[compiler-rt] [rtsan][compiler-rt] Fix ioctl test causing segfault on exit (PR #151182)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 29 09:18:58 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: None (davidtrevelyan)
<details>
<summary>Changes</summary>
I was observing segfaults at executable exit in the rtsan instrumented unit tests. Bisecting the offending test led to observing that this test is not using our safe test fixture for anything involving a file descriptor. Changing to use the fixture eliminated the segfault on exit.
---
Full diff: https://github.com/llvm/llvm-project/pull/151182.diff
1 Files Affected:
- (modified) compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp (+2-2)
``````````diff
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
index 26a3b252d3b6b..9b684e36e3b35 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
@@ -752,8 +752,8 @@ TEST_F(RtsanOpenedFileTest, RewindDieWhenRealtime) {
}
#endif
-TEST(TestRtsanInterceptors, IoctlDiesWhenRealtime) {
- auto Func = []() { ioctl(0, FIONREAD); };
+TEST_F(RtsanOpenedFileTest, IoctlDiesWhenRealtime) {
+ auto Func = [this]() { ioctl(GetOpenFd(), FIONREAD); };
ExpectRealtimeDeath(Func, "ioctl");
ExpectNonRealtimeSurvival(Func);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/151182
More information about the llvm-commits
mailing list