[compiler-rt] 875491f - [rtsan][compiler-rt] Fix ioctl test causing segfault on exit (#151182)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 09:31:23 PDT 2025


Author: davidtrevelyan
Date: 2025-07-29T17:31:19+01:00
New Revision: 875491f59e688f2f7dea437a2425ed7bed1a0708

URL: https://github.com/llvm/llvm-project/commit/875491f59e688f2f7dea437a2425ed7bed1a0708
DIFF: https://github.com/llvm/llvm-project/commit/875491f59e688f2f7dea437a2425ed7bed1a0708.diff

LOG: [rtsan][compiler-rt] Fix ioctl test causing segfault on exit (#151182)

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.

Added: 
    

Modified: 
    compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp

Removed: 
    


################################################################################
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);
 }


        


More information about the llvm-commits mailing list