diff options
author | aflpp <aflpp@aflplus.plus> | 2021-01-31 17:30:17 +0100 |
---|---|---|
committer | aflpp <aflpp@aflplus.plus> | 2021-01-31 17:30:17 +0100 |
commit | 459dd8cb0779f72d83e99673e632429d89a4cfa9 (patch) | |
tree | 9499bc11c4bab9ecb40d6364d356dea3a752cd10 /instrumentation/SanitizerCoverageLTO.so.cc | |
parent | e5116c6d55185177413104cad1232ca64e04b844 (diff) | |
parent | 7a861498c27997cd7be01a5650d54cff3b87a02e (diff) | |
download | afl++-459dd8cb0779f72d83e99673e632429d89a4cfa9.tar.gz |
Merge branch 'dev' of https://github.com/AFLplusplus/AFLplusplus into dev
Diffstat (limited to 'instrumentation/SanitizerCoverageLTO.so.cc')
-rw-r--r-- | instrumentation/SanitizerCoverageLTO.so.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc index 016ac71f..e3490847 100644 --- a/instrumentation/SanitizerCoverageLTO.so.cc +++ b/instrumentation/SanitizerCoverageLTO.so.cc @@ -1237,6 +1237,25 @@ void ModuleSanitizerCoverage::instrumentFunction( for (auto &BB : F) { + for (auto &IN : BB) { + + CallInst *callInst = nullptr; + + if ((callInst = dyn_cast<CallInst>(&IN))) { + + Function *Callee = callInst->getCalledFunction(); + if (!Callee) continue; + if (callInst->getCallingConv() != llvm::CallingConv::C) continue; + StringRef FuncName = Callee->getName(); + if (FuncName.compare(StringRef("__afl_coverage_interesting"))) continue; + + Value *val = ConstantInt::get(Int32Ty, ++afl_global_id); + callInst->setOperand(1, val); + + } + + } + if (shouldInstrumentBlock(F, &BB, DT, PDT, Options)) BlocksToInstrument.push_back(&BB); for (auto &Inst : BB) { @@ -1338,6 +1357,7 @@ bool ModuleSanitizerCoverage::InjectCoverage(Function & F, if (AllBlocks.empty()) return false; CreateFunctionLocalArrays(F, AllBlocks); + for (size_t i = 0, N = AllBlocks.size(); i < N; i++) { // afl++ START |