[compiler-rt] [sanitizer] Disable InstallAtForkHandler on Solaris, NetBSD (PR #75659)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 13:37:08 PST 2023


https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/75659

Handlers need missing FutexWait implementation.


>From b16ec99d885a3c608d46f6e440f18bdab4215c67 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Fri, 15 Dec 2023 13:36:47 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 compiler-rt/lib/asan/asan_posix.cpp                           | 3 +++
 compiler-rt/lib/lsan/lsan_posix.cpp                           | 3 +++
 .../test/sanitizer_common/TestCases/Posix/fork_threaded.c     | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/compiler-rt/lib/asan/asan_posix.cpp b/compiler-rt/lib/asan/asan_posix.cpp
index 206551b6ef910e..0d2e4fe0176772 100644
--- a/compiler-rt/lib/asan/asan_posix.cpp
+++ b/compiler-rt/lib/asan/asan_posix.cpp
@@ -149,6 +149,9 @@ void PlatformTSDDtor(void *tsd) {
 #endif
 
 void InstallAtForkHandler() {
+#  if SANITIZER_SOLARIS || SANITIZER_NETBSD
+  return;  // FIXME: Implement FutexWait.
+#  endif
   auto before = []() {
     if (CAN_SANITIZE_LEAKS) {
       __lsan::LockGlobal();
diff --git a/compiler-rt/lib/lsan/lsan_posix.cpp b/compiler-rt/lib/lsan/lsan_posix.cpp
index 3677f0141a2f02..e0c1899edcd2cf 100644
--- a/compiler-rt/lib/lsan/lsan_posix.cpp
+++ b/compiler-rt/lib/lsan/lsan_posix.cpp
@@ -101,6 +101,9 @@ void InstallAtExitCheckLeaks() {
 }
 
 void InstallAtForkHandler() {
+#  if SANITIZER_SOLARIS || SANITIZER_NETBSD
+  return;  // FIXME: Implement FutexWait.
+#  endif
   auto before = []() {
     LockGlobal();
     LockThreads();
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c
index 6c5102049ae8ef..5c6a8743cdb580 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c
@@ -12,6 +12,10 @@
 // FIXME: False stack overflow report
 // UNSUPPORTED: android && asan
 
+// FIXME: Requires `FutexWait` implementation. See __asan::InstallAtForkHandler.
+// UNSUPPORTED: target={{.*solaris.*}}
+// UNSUPPORTED: target={{.*netbsd.*}}
+
 // Forking in multithread environment is unsupported. However we already have
 // some workarounds, and will add more, so this is the test.
 // The test try to check two things:



More information about the llvm-commits mailing list