aboutsummaryrefslogtreecommitdiff
path: root/instrumentation/SanitizerCoverageLTO.so.cc
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2024-01-27 15:13:27 +0100
committervanhauser-thc <vh@thc.org>2024-01-27 15:13:27 +0100
commite6eee685ceedf92d5ce6dd1c32412e286b4f6104 (patch)
tree7c6f572c299ea0b02ca80ce2a13554a3b7c6be32 /instrumentation/SanitizerCoverageLTO.so.cc
parentceb7e44e6fb614c3efd684b6a1ee71fa89a6fe24 (diff)
downloadafl++-e6eee685ceedf92d5ce6dd1c32412e286b4f6104.tar.gz
fix
Diffstat (limited to 'instrumentation/SanitizerCoverageLTO.so.cc')
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index 3a02cf08..469df42e 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -261,6 +261,7 @@ class ModuleSanitizerCoverageLTO
IntegerType *Int32Tyi = NULL;
IntegerType *Int64Tyi = NULL;
ConstantInt *Zero = NULL;
+ ConstantInt *Zero32 = NULL;
ConstantInt *One = NULL;
AllocaInst *CTX_add = NULL;
LLVMContext *Ct = NULL;
@@ -513,6 +514,7 @@ bool ModuleSanitizerCoverageLTO::instrumentModule(
GlobalVariable::GeneralDynamicTLSModel, 0, false);
Zero = ConstantInt::get(Int8Tyi, 0);
+ Zero32 = ConstantInt::get(Int32Tyi, 0);
One = ConstantInt::get(Int8Tyi, 1);
initInstrumentList();
@@ -1426,7 +1428,7 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
if (inst == inst_save || call_counter < 2) {
fprintf(stderr, "%s: ZERO!\n", F.getName().str().c_str());
- CTX_offset = Zero;
+ CTX_offset = Zero32;
} else {
@@ -1453,7 +1455,7 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
IRBuilder<> Builder(IN.getContext());
Builder.SetInsertPoint(IN.getParent(), IN.getIterator());
- StoreInst *StoreCtx = Builder.CreateStore(Zero, AFLContext);
+ StoreInst *StoreCtx = Builder.CreateStore(Zero32, AFLContext);
StoreCtx->setMetadata("nosanitize", N);
}
@@ -1474,7 +1476,7 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
auto BB = &F.getEntryBlock();
if (!BB) {
- fprintf(stderr, "NULL %s %p\n", F.getName().str().c_str(), BB);
+ fprintf(stderr, "NULL entry %s %p\n", F.getName().str().c_str(), BB);
exit(-1);
}
@@ -1482,7 +1484,7 @@ void ModuleSanitizerCoverageLTO::instrumentFunction(
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);
+ auto nosan = IRB.CreateStore(Zero32, CTX_add);
nosan->setMetadata("nosanitize", N);
}