diff options
Diffstat (limited to 'compiler-rt/lib/hwasan/hwasan_linux.cpp')
-rw-r--r-- | compiler-rt/lib/hwasan/hwasan_linux.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler-rt/lib/hwasan/hwasan_linux.cpp b/compiler-rt/lib/hwasan/hwasan_linux.cpp index f01fa42..3271a95 100644 --- a/compiler-rt/lib/hwasan/hwasan_linux.cpp +++ b/compiler-rt/lib/hwasan/hwasan_linux.cpp @@ -523,12 +523,24 @@ uptr TagMemoryAligned(uptr p, uptr size, tag_t tag) { void HwasanInstallAtForkHandler() { auto before = []() { - HwasanAllocatorLock(); + if (CAN_SANITIZE_LEAKS) { + __lsan::LockGlobal(); + } + // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and lock the + // stuff we need. + __lsan::LockThreads(); + __lsan::LockAllocator(); StackDepotLockAll(); }; auto after = []() { StackDepotUnlockAll(); - HwasanAllocatorUnlock(); + // `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and unlock + // the stuff we need. + __lsan::UnlockAllocator(); + __lsan::UnlockThreads(); + if (CAN_SANITIZE_LEAKS) { + __lsan::UnlockGlobal(); + } }; pthread_atfork(before, after, after); } |