[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:25 PDT 2025
https://github.com/davidtrevelyan created https://github.com/llvm/llvm-project/pull/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.
>From f7984395151276bdf03d2f5bc0e2ba87204f9024 Mon Sep 17 00:00:00 2001
From: David Trevelyan <david.trevelyan at gmail.com>
Date: Tue, 29 Jul 2025 17:15:15 +0100
Subject: [PATCH] [rtsan][compiler-rt] Fix ioctl test causing segfault on exit
---
compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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