From d668010bedf5373e25ea12c24dbb477f54da91ba Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Fri, 26 Jan 2024 16:44:31 +0100 Subject: fixes --- instrumentation/SanitizerCoverageLTO.so.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'instrumentation/SanitizerCoverageLTO.so.cc') diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc index b280e947..a3074ae2 100644 --- a/instrumentation/SanitizerCoverageLTO.so.cc +++ b/instrumentation/SanitizerCoverageLTO.so.cc @@ -249,7 +249,7 @@ class ModuleSanitizerCoverageLTO uint32_t afl_global_id = 0; uint32_t unhandled = 0; uint32_t select_cnt = 0; - uint32_t instrument_ctx = 0; + uint32_t instrument_ctx = 1; uint32_t extra_ctx_inst = 0; uint64_t map_addr = 0; const char *skip_nozero = NULL; @@ -1481,6 +1481,18 @@ void ModuleSanitizerCoverageLTO::instrumentFunction( IsLeafFunc = true; skip_next = 0; + if (CTX_add == NULL) { + + auto BB = &F.getEntryBlock(); + fprintf(stderr, "NULL %s %p\n", F.getName().str().c_str(), BB); + if (!BB) { exit(-1); } + BasicBlock::iterator IP = BB->getFirstInsertionPt(); + IRBuilder<> IRB(&(*IP)); + CTX_add = IRB.CreateAlloca(Type::getInt32Ty(Context), nullptr, "CTX_add"); + auto nosan = IRB.CreateStore(Zero, CTX_add); + nosan->setMetadata("nosanitize", N); + } + for (auto &BB : F) { // fprintf(stderr, "BB: %s\n", BB.getName().str().c_str()); -- cgit 1.4.1