[compiler-rt] [rtsan] Re-enable rtsan tests (PR #98219)
Chris Apple via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 13:45:30 PDT 2024
https://github.com/cjappl requested changes to this pull request.
We also have the failure on fuchsia and windows as outlined here:
https://github.com/llvm/llvm-project/pull/92460#issuecomment-2218652616
Fuchsia we can "fix" I believe via this patch that disables the problematic interceptors for now:
```
diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
index 3a65f9d3f779..ad9a97bdae7c 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
@@ -42,6 +42,8 @@ void ExpectNotRealtime(const char *intercepted_function_name) {
// Filesystem
+#if !SANITIZER_FUCHSIA
+
INTERCEPTOR(int, open, const char *path, int oflag, ...) {
// TODO Establish whether we should intercept here if the flag contains
// O_NONBLOCK
@@ -70,6 +72,8 @@ INTERCEPTOR(int, openat, int fd, const char *path, int oflag, ...) {
return result;
}
+#endif //!SANITIZER_FUCHSIA
+
INTERCEPTOR(int, creat, const char *path, mode_t mode) {
// TODO Establish whether we should intercept here if the flag contains
// O_NONBLOCK
@@ -359,8 +363,11 @@ void __rtsan::InitializeInterceptors() {
INTERCEPT_FUNCTION(pvalloc);
#endif
+#ifndef SANITIZER_FUCHSIA
INTERCEPT_FUNCTION(open);
INTERCEPT_FUNCTION(openat);
+#endif //SANITIZER_FUCHSIA
+
INTERCEPT_FUNCTION(close);
INTERCEPT_FUNCTION(fopen);
INTERCEPT_FUNCTION(fread);
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
index f5b016089087..e250df41b53a 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
@@ -172,6 +172,7 @@ TEST(TestRtsanInterceptors, NanosleepDiesWhenRealtime) {
Filesystem
*/
+#if !SANITIZER_FUCHSIA
TEST_F(RtsanFileTest, OpenDiesWhenRealtime) {
auto func = [this]() { open(GetTemporaryFilePath(), O_RDONLY); };
ExpectRealtimeDeath(func, "open");
@@ -197,6 +198,7 @@ TEST_F(RtsanFileTest, OpenCreatesFileWithProperMode) {
// Mask st_mode to get permission bits only
ASSERT_THAT(st.st_mode & 0777, Eq(mode));
}
+#endif // !SANITIZER_FUCHSIA
TEST_F(RtsanFileTest, CreatDiesWhenRealtime) {
auto func = [this]() { creat(GetTemporaryFilePath(), S_IWOTH | S_IROTH); };
```
Windows we can just disable the entire sanitizer. the guts rely on pthread, so there is no chance of it working at this point, possibly in the future
https://github.com/llvm/llvm-project/pull/98219
More information about the llvm-commits
mailing list