[llvm-branch-commits] [compiler-rt] [compiler-rt] [rtsan] Revert openat interceptor that breaks fortify-source builds (PR #100876)

Michał Górny via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jul 27 08:11:09 PDT 2024


https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/100876

Remove the openat interceptor from the 19.x branch, as it currently breaks builds against fortify-sources glibc, and full rtsan will not be included in this version anyway.

Suggested by Chris Apple in
https://github.com/llvm/llvm-project/issues/100754#issuecomment-2254169856

Bug #100754

>From 33627d3d2be8c1b1d219ed712ca6e79f3fe50555 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Sat, 27 Jul 2024 17:04:45 +0200
Subject: [PATCH] [compiler-rt] [rtsan] Revert openat interceptor that breaks
 fortify-source builds

Remove the openat interceptor from the 19.x branch, as it currently
breaks builds against fortify-sources glibc, and full rtsan will not
be included in this version anyway.

Patch provided by Chris Apple in
https://github.com/llvm/llvm-project/issues/100754#issuecomment-2254169856

Bug #100754
---
 compiler-rt/lib/rtsan/rtsan_interceptors.cpp      | 15 ---------------
 .../lib/rtsan/tests/rtsan_test_interceptors.cpp   |  6 ------
 2 files changed, 21 deletions(-)

diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
index 4d5423ec629d2..e513d72d95814 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
@@ -69,20 +69,6 @@ INTERCEPTOR(int, open, const char *path, int oflag, ...) {
   return result;
 }
 
-INTERCEPTOR(int, openat, int fd, const char *path, int oflag, ...) {
-  // TODO Establish whether we should intercept here if the flag contains
-  // O_NONBLOCK
-  ExpectNotRealtime("openat");
-
-  va_list args;
-  va_start(args, oflag);
-  mode_t mode = va_arg(args, int);
-  va_end(args);
-
-  const int result = REAL(openat)(fd, path, oflag, mode);
-  return result;
-}
-
 INTERCEPTOR(int, creat, const char *path, mode_t mode) {
   // TODO Establish whether we should intercept here if the flag contains
   // O_NONBLOCK
@@ -385,7 +371,6 @@ void __rtsan::InitializeInterceptors() {
 #endif
 
   INTERCEPT_FUNCTION(open);
-  INTERCEPT_FUNCTION(openat);
   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 f5b016089087d..a5318a52e45c5 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
@@ -178,12 +178,6 @@ TEST_F(RtsanFileTest, OpenDiesWhenRealtime) {
   ExpectNonRealtimeSurvival(func);
 }
 
-TEST_F(RtsanFileTest, OpenatDiesWhenRealtime) {
-  auto func = [this]() { openat(0, GetTemporaryFilePath(), O_RDONLY); };
-  ExpectRealtimeDeath(func, "openat");
-  ExpectNonRealtimeSurvival(func);
-}
-
 TEST_F(RtsanFileTest, OpenCreatesFileWithProperMode) {
   const int mode = S_IRGRP | S_IROTH | S_IRUSR | S_IWUSR;
 



More information about the llvm-branch-commits mailing list