Skip to content

[rtsan] Remove mkfifoat interceptor #116997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2024
Merged

[rtsan] Remove mkfifoat interceptor #116997

merged 1 commit into from
Nov 20, 2024

Conversation

cjappl
Copy link
Contributor

@cjappl cjappl commented Nov 20, 2024

This partially reverts #116915 fce917d

I mis-read the version that mkfifoat was introduced in darwin. It was introduced in 13.0, while I guarded against 10.13 (as you can see in the code:

#define MKFIFOAT_AVAILABLE() (__builtin_available(macOS 10.13, *))

The fix is more difficult than just declaring this as 13.0, we have to pre-declare a weak symbol as we do with aligned_alloc etc, which takes a bit of time.

This is a band-aid while we work on that (or kick it into the future)

@cjappl
Copy link
Contributor Author

cjappl commented Nov 20, 2024

I am going to be submitting this directly as soon as my local builds pass

@llvmbot
Copy link
Member

llvmbot commented Nov 20, 2024

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

Author: Chris Apple (cjappl)

Changes

This partially reverts #116915 fce917d

I mis-read the version that mkfifoat was introduced in darwin. It was introduced in 13.0, while I guarded against 10.13 (as you can see in the code:

#define MKFIFOAT_AVAILABLE() (__builtin_available(macOS 10.13, *))

The fix is more difficult than just declaring this as 13.0, we have to pre-declare a weak symbol as we do with aligned_alloc etc, which takes a bit of time.

This is a band-aid while we work on that (or kick it into the future)


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

2 Files Affected:

  • (modified) compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp (-11)
  • (modified) compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp (-15)
diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
index 5ef52d72fceb31..73448cfc117884 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
@@ -746,16 +746,6 @@ INTERCEPTOR(int, mkfifo, const char *pathname, mode_t mode) {
   return REAL(mkfifo)(pathname, mode);
 }
 
-// see comment above about -Wunguarded-availability-new
-// and why we disable it here
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
-INTERCEPTOR(int, mkfifoat, int dirfd, const char *pathname, mode_t mode) {
-  __rtsan_notify_intercepted_call("mkfifoat");
-  return REAL(mkfifoat)(dirfd, pathname, mode);
-}
-#pragma clang diagnostic pop
-
 // Preinit
 void __rtsan::InitializeInterceptors() {
   INTERCEPT_FUNCTION(calloc);
@@ -859,7 +849,6 @@ void __rtsan::InitializeInterceptors() {
 
   INTERCEPT_FUNCTION(pipe);
   INTERCEPT_FUNCTION(mkfifo);
-  INTERCEPT_FUNCTION(mkfifoat);
 }
 
 #endif // SANITIZER_POSIX
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 72f6d819b216c0..3e14346f33c7ca 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
@@ -971,21 +971,6 @@ TEST(TestRtsanInterceptors, MkfifoDiesWhenRealtime) {
   ExpectNonRealtimeSurvival(Func);
 }
 
-#if __has_builtin(__builtin_available) && SANITIZER_APPLE
-#define MKFIFOAT_AVAILABLE() (__builtin_available(macOS 10.13, *))
-#else
-// We are going to assume this is true until we hit systems where it isn't
-#define MKFIFOAT_AVAILABLE() (true)
-#endif
-
-TEST(TestRtsanInterceptors, MkfifoatDiesWhenRealtime) {
-  if (MKFIFOAT_AVAILABLE()) {
-    auto Func = []() { mkfifoat(0, "/tmp/rtsan_test_fifo", 0); };
-    ExpectRealtimeDeath(Func, "mkfifoat");
-    ExpectNonRealtimeSurvival(Func);
-  }
-}
-
 TEST(TestRtsanInterceptors, PipeDiesWhenRealtime) {
   int fds[2];
   auto Func = [&fds]() { pipe(fds); };

@cjappl cjappl merged commit 934140a into llvm:main Nov 20, 2024
8 of 9 checks passed
@cjappl cjappl deleted the revert_mkfifoat branch November 20, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants