diff options
| author | Alexey Samsonov <vonosmas@gmail.com> | 2014-12-16 01:23:03 +0000 |
|---|---|---|
| committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-12-16 01:23:03 +0000 |
| commit | bba821b5b143625eaad566ed524d5b40ed732ba9 (patch) | |
| tree | 55f5c0564108b9b0b89c0c778e60ed5f3861dea6 /compiler-rt/lib/asan/asan_stack.cc | |
| parent | ab534366fe39b145748d5e004d58fdb0cdabfe77 (diff) | |
| download | bcm5719-llvm-bba821b5b143625eaad566ed524d5b40ed732ba9.tar.gz bcm5719-llvm-bba821b5b143625eaad566ed524d5b40ed732ba9.zip | |
[ASan] Allow to atomically modify malloc_context_size at runtime.
Summary:
Introduce __asan::malloc_context_size atomic that is used to determine
required malloc/free stack trace size. It is initialized with
common_flags()->malloc_context_size flag, but can later be overwritten
at runtime (e.g. when ASan is activated / deactivated).
Test Plan: regression test suite
Reviewers: kcc, eugenis
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D6645
llvm-svn: 224305
Diffstat (limited to 'compiler-rt/lib/asan/asan_stack.cc')
| -rw-r--r-- | compiler-rt/lib/asan/asan_stack.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_stack.cc b/compiler-rt/lib/asan/asan_stack.cc index 8188f3b5b6e..cf7a587fa65 100644 --- a/compiler-rt/lib/asan/asan_stack.cc +++ b/compiler-rt/lib/asan/asan_stack.cc @@ -13,6 +13,21 @@ //===----------------------------------------------------------------------===// #include "asan_internal.h" #include "asan_stack.h" +#include "sanitizer_common/sanitizer_atomic.h" + +namespace __asan { + +static atomic_uint32_t malloc_context_size; + +void SetMallocContextSize(u32 size) { + atomic_store(&malloc_context_size, size, memory_order_release); +} + +u32 GetMallocContextSize() { + return atomic_load(&malloc_context_size, memory_order_acquire); +} + +} // namespace __asan // ------------------ Interface -------------- {{{1 |

