diff options
-rw-r--r-- | compiler-rt/lib/asan/asan_interceptors.cc | 12 | ||||
-rw-r--r-- | compiler-rt/lib/lsan/lsan_interceptors.cc | 12 |
2 files changed, 16 insertions, 8 deletions
diff --git a/compiler-rt/lib/asan/asan_interceptors.cc b/compiler-rt/lib/asan/asan_interceptors.cc index 1f0dc9e2df3..e82a5a4a7e9 100644 --- a/compiler-rt/lib/asan/asan_interceptors.cc +++ b/compiler-rt/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/compiler-rt/lib/lsan/lsan_interceptors.cc b/compiler-rt/lib/lsan/lsan_interceptors.cc index b8cf6ae0748..a0a59daa07a 100644 --- a/compiler-rt/lib/lsan/lsan_interceptors.cc +++ b/compiler-rt/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) { |