aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2024-02-02 13:17:20 +0100
committervanhauser-thc <vh@thc.org>2024-02-02 13:17:20 +0100
commitba3a039e457025399f7b58905d3923d068ef0eef (patch)
treebf3d583860f65648c2614b738453cdb3e884d677
parentbd13d32437ebf0c1f7304dc4c8f9797dc4cce7fb (diff)
downloadafl++-ba3a039e457025399f7b58905d3923d068ef0eef.tar.gz
finish lto-ctx
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index 31d26ca3..65602109 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -250,7 +250,7 @@ class ModuleSanitizerCoverageLTO
uint32_t afl_global_id = 0;
uint32_t unhandled = 0;
uint32_t select_cnt = 0;
- uint32_t instrument_ctx = 1;
+ uint32_t instrument_ctx = 0;
uint32_t extra_ctx_inst = 0;
uint64_t map_addr = 0;
const char *skip_nozero = NULL;
@@ -771,12 +771,12 @@ bool ModuleSanitizerCoverageLTO::instrumentModule(
else
Str2 = TmpStr.str();
- if (debug)
+ /*if (debug)
fprintf(stderr, "F:%s %p(%s)->\"%s\"(%s) %p(%s)->\"%s\"(%s)\n",
FuncName.c_str(), Str1P, Str1P->getName().str().c_str(),
Str1.c_str(), HasStr1 == true ? "true" : "false", Str2P,
Str2P->getName().str().c_str(), Str2.c_str(),
- HasStr2 == true ? "true" : "false");
+ HasStr2 == true ? "true" : "false");*/
// we handle the 2nd parameter first because of llvm memcpy
if (!HasStr2) {
@@ -1398,10 +1398,7 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
CTX_add = NULL;
- if (debug)
- fprintf(stderr,
- "Function: %s (%u %u) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n",
- F.getName().str().c_str(), inst, afl_global_id);
+ if (debug) fprintf(stderr, "Function: %s\n", F.getName().str().c_str());
if (instrument_ctx) {
@@ -1613,7 +1610,6 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
}
- // bool loaded = false, multicall = false;
for (auto &IN : BB) {
// check all calls and where callee count == 1 instrument
@@ -1627,15 +1623,14 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
fprintf(stderr, "DEBUG: %s call to %s with only one caller\n",
F.getName().str().c_str(),
Callee->getName().str().c_str());
- /* if (loaded == false || multicall == true) { // } */
+
IRBuilder<> Builder(IN.getContext());
Builder.SetInsertPoint(callInst);
StoreInst *StoreCtx =
Builder.CreateStore(PrevCtxLoad, AFLContext);
StoreCtx->setMetadata("nosanitize", N);
- // multicall = false; loaded = true;
- } // else { multicall = true; }
+ }
}