[compiler-rt] r222732 - [asan] Improvements for asan deactivated mode: disable asan activation for runtime library on Linux, disable malloc checks.
Yury Gribov
y.gribov at samsung.com
Mon Nov 24 23:10:30 PST 2014
Author: ygribov
Date: Tue Nov 25 01:10:30 2014
New Revision: 222732
URL: http://llvm.org/viewvc/llvm-project?rev=222732&view=rev
Log:
[asan] Improvements for asan deactivated mode: disable asan activation for runtime library on Linux, disable malloc checks.
Reviewed in http://reviews.llvm.org/D6265
Modified:
compiler-rt/trunk/lib/asan/asan_activation.cc
compiler-rt/trunk/lib/asan/asan_rtl.cc
Modified: compiler-rt/trunk/lib/asan/asan_activation.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_activation.cc?rev=222732&r1=222731&r2=222732&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_activation.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_activation.cc Tue Nov 25 01:10:30 2014
@@ -25,6 +25,8 @@ static struct AsanDeactivatedFlags {
int max_redzone;
int malloc_context_size;
bool poison_heap;
+ bool alloc_dealloc_mismatch;
+ bool allocator_may_return_null;
} asan_deactivated_flags;
static bool asan_is_deactivated;
@@ -37,11 +39,17 @@ void AsanStartDeactivated() {
asan_deactivated_flags.poison_heap = flags()->poison_heap;
asan_deactivated_flags.malloc_context_size =
common_flags()->malloc_context_size;
+ asan_deactivated_flags.alloc_dealloc_mismatch =
+ flags()->alloc_dealloc_mismatch;
+ asan_deactivated_flags.allocator_may_return_null =
+ common_flags()->allocator_may_return_null;
flags()->quarantine_size = 0;
flags()->max_redzone = 16;
flags()->poison_heap = false;
common_flags()->malloc_context_size = 0;
+ flags()->alloc_dealloc_mismatch = false;
+ common_flags()->allocator_may_return_null = true;
asan_is_deactivated = true;
}
@@ -57,6 +65,10 @@ void AsanActivate() {
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;
+ common_flags()->allocator_may_return_null =
+ asan_deactivated_flags.allocator_may_return_null;
ParseExtraActivationFlags();
@@ -65,10 +77,12 @@ void AsanActivate() {
asan_is_deactivated = false;
VReport(
1,
- "quarantine_size %d, max_redzone %d, poison_heap %d, malloc_context_size "
- "%d\n",
+ "quarantine_size %d, max_redzone %d, poison_heap %d, "
+ "malloc_context_size %d, alloc_dealloc_mismatch %d, "
+ "allocator_may_return_null %d\n",
flags()->quarantine_size, flags()->max_redzone, flags()->poison_heap,
- common_flags()->malloc_context_size);
+ common_flags()->malloc_context_size, flags()->alloc_dealloc_mismatch,
+ common_flags()->allocator_may_return_null);
}
} // namespace __asan
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=222732&r1=222731&r2=222732&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Nov 25 01:10:30 2014
@@ -709,8 +709,7 @@ public: // NOLINT
AsanInitializer() {
AsanCheckIncompatibleRT();
AsanCheckDynamicRTPrereqs();
- if (UNLIKELY(!asan_inited))
- __asan_init();
+ AsanInitFromRtl();
}
};
More information about the llvm-commits
mailing list