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 | 5f21f50ac45c09c9aebbb0ceaf207d38f2b85873 (patch) | |
tree | 7bba973ccd3f2420edc28f571687298c0b6cb38d /lib/asan/asan_stack.cc | |
parent | 37215cf706ab74ad5f59cd53e0eff26aaab047cb (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224305 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_stack.cc')
-rw-r--r-- | lib/asan/asan_stack.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/asan/asan_stack.cc b/lib/asan/asan_stack.cc index 8188f3b5b..cf7a587fa 100644 --- a/lib/asan/asan_stack.cc +++ b/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 |