summaryrefslogtreecommitdiff
path: root/lib/asan/asan_activation.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-12-16 01:23:03 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-12-16 01:23:03 +0000
commit5f21f50ac45c09c9aebbb0ceaf207d38f2b85873 (patch)
tree7bba973ccd3f2420edc28f571687298c0b6cb38d /lib/asan/asan_activation.cc
parent37215cf706ab74ad5f59cd53e0eff26aaab047cb (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_activation.cc')
-rw-r--r--lib/asan/asan_activation.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/asan/asan_activation.cc b/lib/asan/asan_activation.cc
index c4733a337..02e091192 100644
--- a/lib/asan/asan_activation.cc
+++ b/lib/asan/asan_activation.cc
@@ -16,6 +16,7 @@
#include "asan_allocator.h"
#include "asan_flags.h"
#include "asan_internal.h"
+#include "asan_stack.h"
#include "sanitizer_common/sanitizer_flags.h"
namespace __asan {
@@ -62,13 +63,12 @@ void AsanActivate() {
// FIXME: this is not atomic, and there may be other threads alive.
flags()->max_redzone = asan_deactivated_flags.max_redzone;
flags()->poison_heap = asan_deactivated_flags.poison_heap;
- common_flags()->malloc_context_size =
- asan_deactivated_flags.malloc_context_size;
flags()->alloc_dealloc_mismatch =
asan_deactivated_flags.alloc_dealloc_mismatch;
ParseExtraActivationFlags();
+ SetMallocContextSize(asan_deactivated_flags.malloc_context_size);
ReInitializeAllocator(asan_deactivated_flags.allocator_may_return_null,
asan_deactivated_flags.quarantine_size);
@@ -77,7 +77,7 @@ void AsanActivate() {
"malloc_context_size %d, alloc_dealloc_mismatch %d, "
"allocator_may_return_null %d\n",
asan_deactivated_flags.quarantine_size, flags()->max_redzone,
- flags()->poison_heap, common_flags()->malloc_context_size,
+ flags()->poison_heap, asan_deactivated_flags.malloc_context_size,
flags()->alloc_dealloc_mismatch,
asan_deactivated_flags.allocator_may_return_null);
}