[compiler-rt] r227789 - [Sanitizers] Re-apply the fix ordering initialization of coverage and guard arrays
Viktor Kutuzov
vkutuzov at accesssoftek.com
Mon Feb 2 01:38:10 PST 2015
Author: vkutuzov
Date: Mon Feb 2 03:38:10 2015
New Revision: 227789
URL: http://llvm.org/viewvc/llvm-project?rev=227789&view=rev
Log:
[Sanitizers] Re-apply the fix ordering initialization of coverage and guard arrays
Original commit: http://reviews.llvm.org/rL226440
Related review: http://reviews.llvm.org/D6892
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=227789&r1=227788&r2=227789&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Mon Feb 2 03:38:10 2015
@@ -157,7 +157,8 @@ void CoverageData::Init() {
}
void CoverageData::Enable() {
- CHECK_EQ(pc_array, nullptr);
+ if (pc_array)
+ return;
pc_array = reinterpret_cast<uptr *>(
MmapNoReserveOrDie(sizeof(uptr) * kPcArrayMaxSize, "CovInit"));
atomic_store(&pc_array_index, 0, memory_order_relaxed);
@@ -183,6 +184,7 @@ void CoverageData::Enable() {
}
void CoverageData::InitializeGuardArray(s32 *guards) {
+ Enable(); // Make sure coverage is enabled at this point.
s32 n = guards[0];
for (s32 j = 1; j <= n; j++) {
uptr idx = atomic_fetch_add(&pc_array_index, 1, memory_order_relaxed);
More information about the llvm-commits
mailing list