diff options
| author | Maxim Ostapenko <chefmax7@gmail.com> | 2017-05-31 07:28:09 +0000 |
|---|---|---|
| committer | Maxim Ostapenko <chefmax7@gmail.com> | 2017-05-31 07:28:09 +0000 |
| commit | 62a0f55930d03a7db0e42724db180af517e8dae7 (patch) | |
| tree | ecbf9126d18ac61c2016a2725b2c403e58e5380a /compiler-rt/lib/asan/asan_allocator.h | |
| parent | 043fa4b3d62190b45390347fc1a39e1c75e9ea0d (diff) | |
| download | bcm5719-llvm-62a0f55930d03a7db0e42724db180af517e8dae7.tar.gz bcm5719-llvm-62a0f55930d03a7db0e42724db180af517e8dae7.zip | |
[sanitizer] Avoid possible deadlock in child process after fork
This patch addresses https://github.com/google/sanitizers/issues/774. When we
fork a multi-threaded process it's possible to deadlock if some thread acquired
StackDepot or allocator internal lock just before fork. In this case the lock
will never be released in child process causing deadlock on following memory alloc/dealloc
routine. While calling alloc/dealloc routines after multi-threaded fork is not allowed,
most of modern allocators (Glibc, tcmalloc, jemalloc) are actually fork safe. Let's do the same
for sanitizers except TSan that has complex locking rules.
Differential Revision: https://reviews.llvm.org/D33325
llvm-svn: 304285
Diffstat (limited to 'compiler-rt/lib/asan/asan_allocator.h')
| -rw-r--r-- | compiler-rt/lib/asan/asan_allocator.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_allocator.h b/compiler-rt/lib/asan/asan_allocator.h index ad1aeb58a86..ce3e25dc509 100644 --- a/compiler-rt/lib/asan/asan_allocator.h +++ b/compiler-rt/lib/asan/asan_allocator.h @@ -213,5 +213,7 @@ void asan_mz_force_unlock(); void PrintInternalAllocatorStats(); void AsanSoftRssLimitExceededCallback(bool exceeded); +AsanAllocator &get_allocator(); + } // namespace __asan #endif // ASAN_ALLOCATOR_H |

