about summary refs log tree commit diff
path: root/instrumentation/SanitizerCoverageLTO.so.cc
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-12-13 22:58:19 +0100
committerGitHub <noreply@github.com>2021-12-13 22:58:19 +0100
commit22e2362f0fd5685548696f487639104a0059e3eb (patch)
treef59a3c6d5fb0f42056252f400f3bab1e1010432b /instrumentation/SanitizerCoverageLTO.so.cc
parent08ca4d54a55fe73e64a994c41a12af61f52e497e (diff)
parentc6bad07d75aa36671ebc32a722566cb145414b08 (diff)
downloadafl++-22e2362f0fd5685548696f487639104a0059e3eb.tar.gz
Merge pull request #1213 from AFLplusplus/dev
push to stable
Diffstat (limited to 'instrumentation/SanitizerCoverageLTO.so.cc')
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index 8d7f0c80..aa1826cd 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -1123,7 +1123,7 @@ bool ModuleSanitizerCoverage::instrumentModule(
             M, PointerType::get(Int8Tyi, 0), false,
             GlobalValue::ExternalLinkage, 0, "__afl_dictionary");
 
-        Value *AFLDictOff = IRB.CreateGEP(AFLInternalDictionary, Zero);
+        Value *AFLDictOff = IRB.CreateGEP(Int8Ty, AFLInternalDictionary, Zero);
         Value *AFLDictPtr =
             IRB.CreatePointerCast(AFLDictOff, PointerType::get(Int8Tyi, 0));
         StoreInst *StoreDict = IRB.CreateStore(AFLDictPtr, AFLDictionary);
@@ -1388,7 +1388,8 @@ void ModuleSanitizerCoverage::instrumentFunction(
         local_selects++;
         uint32_t vector_cur = 0;
         /* Load SHM pointer */
-        LoadInst *MapPtr = IRB.CreateLoad(AFLMapPtr);
+        LoadInst *MapPtr =
+            IRB.CreateLoad(PointerType::get(Int8Ty, 0), AFLMapPtr);
         ModuleSanitizerCoverage::SetNoSanitizeMetadata(MapPtr);
 
         while (1) {
@@ -1399,12 +1400,12 @@ void ModuleSanitizerCoverage::instrumentFunction(
           /* Load counter for CurLoc */
           if (!vector_cnt) {
 
-            MapPtrIdx = IRB.CreateGEP(MapPtr, result);
+            MapPtrIdx = IRB.CreateGEP(Int8Ty, MapPtr, result);
 
           } else {
 
             auto element = IRB.CreateExtractElement(result, vector_cur++);
-            MapPtrIdx = IRB.CreateGEP(MapPtr, element);
+            MapPtrIdx = IRB.CreateGEP(Int8Ty, MapPtr, element);
 
           }
 
@@ -1418,7 +1419,7 @@ void ModuleSanitizerCoverage::instrumentFunction(
 
           } else {
 
-            LoadInst *Counter = IRB.CreateLoad(MapPtrIdx);
+            LoadInst *Counter = IRB.CreateLoad(IRB.getInt8Ty(), MapPtrIdx);
             ModuleSanitizerCoverage::SetNoSanitizeMetadata(Counter);
 
             /* Update bitmap */
@@ -1672,13 +1673,13 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
 
     if (map_addr) {
 
-      MapPtrIdx = IRB.CreateGEP(MapPtrFixed, CurLoc);
+      MapPtrIdx = IRB.CreateGEP(Int8Ty, MapPtrFixed, CurLoc);
 
     } else {
 
-      LoadInst *MapPtr = IRB.CreateLoad(AFLMapPtr);
+      LoadInst *MapPtr = IRB.CreateLoad(PointerType::get(Int8Ty, 0), AFLMapPtr);
       ModuleSanitizerCoverage::SetNoSanitizeMetadata(MapPtr);
-      MapPtrIdx = IRB.CreateGEP(MapPtr, CurLoc);
+      MapPtrIdx = IRB.CreateGEP(Int8Ty, MapPtr, CurLoc);
 
     }
 
@@ -1693,7 +1694,7 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
 
     } else {
 
-      LoadInst *Counter = IRB.CreateLoad(MapPtrIdx);
+      LoadInst *Counter = IRB.CreateLoad(IRB.getInt8Ty(), MapPtrIdx);
       ModuleSanitizerCoverage::SetNoSanitizeMetadata(Counter);
 
       Value *Incr = IRB.CreateAdd(Counter, One);