Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
compiler-rt/lib/asan/asan_activation.cc
Show All 10 Lines | |||||
// | // | ||||
// ASan activation/deactivation logic. | // ASan activation/deactivation logic. | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#include "asan_activation.h" | #include "asan_activation.h" | ||||
#include "asan_allocator.h" | #include "asan_allocator.h" | ||||
#include "asan_flags.h" | #include "asan_flags.h" | ||||
#include "asan_internal.h" | #include "asan_internal.h" | ||||
#include "asan_mapping.h" | |||||
#include "asan_poisoning.h" | #include "asan_poisoning.h" | ||||
#include "asan_stack.h" | #include "asan_stack.h" | ||||
#include "sanitizer_common/sanitizer_common.h" | |||||
#include "sanitizer_common/sanitizer_flags.h" | #include "sanitizer_common/sanitizer_flags.h" | ||||
namespace __asan { | namespace __asan { | ||||
static struct AsanDeactivatedFlags { | static struct AsanDeactivatedFlags { | ||||
AllocatorOptions allocator_options; | AllocatorOptions allocator_options; | ||||
int malloc_context_size; | int malloc_context_size; | ||||
bool poison_heap; | bool poison_heap; | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | void AsanDeactivate() { | ||||
// Deactivate the runtime. | // Deactivate the runtime. | ||||
SetCanPoisonMemory(false); | SetCanPoisonMemory(false); | ||||
SetMallocContextSize(1); | SetMallocContextSize(1); | ||||
AllocatorOptions disabled = asan_deactivated_flags.allocator_options; | AllocatorOptions disabled = asan_deactivated_flags.allocator_options; | ||||
disabled.quarantine_size_mb = 0; | disabled.quarantine_size_mb = 0; | ||||
disabled.thread_local_quarantine_size_kb = 0; | disabled.thread_local_quarantine_size_kb = 0; | ||||
disabled.min_redzone = 16; // Redzone must be at least 16 bytes long. | // Redzone must be at least Max(16, granularity) bytes long. | ||||
disabled.max_redzone = 16; | disabled.min_redzone = Max(16, (int)SHADOW_GRANULARITY); | ||||
disabled.max_redzone = Max(16, (int)SHADOW_GRANULARITY); | |||||
disabled.alloc_dealloc_mismatch = false; | disabled.alloc_dealloc_mismatch = false; | ||||
disabled.may_return_null = true; | disabled.may_return_null = true; | ||||
ReInitializeAllocator(disabled); | ReInitializeAllocator(disabled); | ||||
asan_is_deactivated = true; | asan_is_deactivated = true; | ||||
} | } | ||||
void AsanActivate() { | void AsanActivate() { | ||||
Show All 19 Lines |