8000 [sanitizer] Disable InstallAtForkHandler on Solaris, NetBSD by vitalybuka · Pull Request #75659 · llvm/llvm-project · GitHub
[go: up one dir, main page]

Skip to content

[sanitizer] Disable InstallAtForkHandler on Solaris, NetBSD #75659

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 8000

Conversation

vitalybuka
Copy link
Collaborator
@vitalybuka vitalybuka commented Dec 15, 2023

Handlers need missing FutexWait implementation.

Reported in #75290.

Created using spr 1.3.4
@llvmbot
Copy link
Member
llvmbot commented Dec 15, 2023

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

Author: Vitaly Buka (vitalybuka)

Changes

Handlers need missing FutexWait implementation.


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

3 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_posix.cpp (+3)
  • (modified) compiler-rt/lib/lsan/lsan_posix.cpp (+3)
  • (modified) compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c (+4)
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:

@rorth
Copy link
Collaborator
rorth commented Dec 16, 2023

I've just successfully tested the patch on amd64-pc-solaris2.11 for good measure.

@rorth rorth merged commit d01be3c into main Dec 18, 2023
@rorth rorth deleted the users/vitalybuka/spr/sanitizer-disable-installatforkhandler-on-solaris-netbsd branch December 18, 2023 09:50
@azharudd
Copy link
Contributor

This was needed for Darwin too — 2a03854.

https://green.lab.llvm.org/green/job/clang-stage1-RA/36635/consoleFull#21369368358254eaf0-7326-4999-85b0-388101f2d404

@rorth
Copy link
Collaborator
rorth commented Dec 19, 2023

On one hand, that's not surprising given what I reported in [asan] Install pthread_atfork #75290 about the sanitizer_mac.cpp definition of FutexWait. On the other hand, I'm astonished that this wasn't caught earlier by some bot.

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.

6 participants
0