summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/asan/asan_interceptors.cc12
-rw-r--r--lib/lsan/lsan_interceptors.cc12
2 files changed, 16 insertions, 8 deletions
diff --git a/lib/asan/asan_interceptors.cc b/lib/asan/asan_interceptors.cc
index 1f0dc9e2d..e82a5a4a7 100644
--- a/lib/asan/asan_interceptors.cc
+++ b/lib/asan/asan_interceptors.cc
@@ -707,13 +707,17 @@ INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
#if ASAN_INTERCEPT_FORK
static void BeforeFork() {
- get_allocator().ForceLock();
- StackDepotLockAll();
+ if (SANITIZER_LINUX) {
+ get_allocator().ForceLock();
+ StackDepotLockAll();
+ }
}
static void AfterFork() {
- StackDepotUnlockAll();
- get_allocator().ForceUnlock();
+ if (SANITIZER_LINUX) {
+ StackDepotUnlockAll();
+ get_allocator().ForceUnlock();
+ }
}
INTERCEPTOR(int, fork, void) {
diff --git a/lib/lsan/lsan_interceptors.cc b/lib/lsan/lsan_interceptors.cc
index b8cf6ae07..a0a59daa0 100644
--- a/lib/lsan/lsan_interceptors.cc
+++ b/lib/lsan/lsan_interceptors.cc
@@ -99,13 +99,17 @@ INTERCEPTOR(void*, valloc, uptr size) {
#endif
static void BeforeFork() {
- LockAllocator();
- StackDepotLockAll();
+ if (SANITIZER_LINUX) {
+ LockAllocator();
+ StackDepotLockAll();
+ }
}
static void AfterFork() {
- StackDepotUnlockAll();
- UnlockAllocator();
+ if (SANITIZER_LINUX) {
+ StackDepotUnlockAll();
+ UnlockAllocator();
+ }
}
INTERCEPTOR(int, fork, void) {