about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-06-01 11:28:31 +0200
committervanhauser-thc <vh@thc.org>2021-06-01 11:28:31 +0200
commitb9799bbe1d10461d69f919f950d4a53a578176fa (patch)
treef3f568e5ec7b53ff5f296c9fdbd2d41b1dd873aa
parent07c3e47e6beae3e99637f501095bffb95be9f5da (diff)
downloadafl++-b9799bbe1d10461d69f919f950d4a53a578176fa.tar.gz
fix classic threadsafe counters
-rw-r--r--instrumentation/afl-llvm-pass.so.cc44
1 files changed, 26 insertions, 18 deletions
diff --git a/instrumentation/afl-llvm-pass.so.cc b/instrumentation/afl-llvm-pass.so.cc
index 62f8b2ed..a8f1baff 100644
--- a/instrumentation/afl-llvm-pass.so.cc
+++ b/instrumentation/afl-llvm-pass.so.cc
@@ -662,24 +662,29 @@ bool AFLCoverage::runOnModule(Module &M) {
       /* Update bitmap */
 
       if (use_threadsafe_counters) {                              /* Atomic */
-
-#if LLVM_VERSION_MAJOR < 9
-        if (neverZero_counters_str !=
-            NULL) {  // with llvm 9 we make this the default as the bug in llvm
-                     // is then fixed
-#else
-        if (!skip_nozero) {
-
-#endif
-          // register MapPtrIdx in a todo list
-          todo.push_back(MapPtrIdx);
-
-        } else {
-
-          IRB.CreateAtomicRMW(llvm::AtomicRMWInst::BinOp::Add, MapPtrIdx, One,
-                              llvm::AtomicOrdering::Monotonic);
-
-        }
+                                     /*
+                                     #if LLVM_VERSION_MAJOR < 9
+                                             if (neverZero_counters_str !=
+                                                 NULL) {  // with llvm 9 we make this the default as the bug
+                                     in llvm
+                                                          // is then fixed
+                                     #else
+                                             if (!skip_nozero) {
+                             
+                                     #endif
+                                               // register MapPtrIdx in a todo list
+                                               todo.push_back(MapPtrIdx);
+                             
+                                             } else {
+
+                                     */
+        IRB.CreateAtomicRMW(llvm::AtomicRMWInst::BinOp::Add, MapPtrIdx, One,
+                            llvm::AtomicOrdering::Monotonic);
+        /*
+
+                }
+
+        */
 
       } else {
 
@@ -774,6 +779,7 @@ bool AFLCoverage::runOnModule(Module &M) {
 
     }
 
+#if 0
     if (use_threadsafe_counters) {                       /*Atomic NeverZero */
       // handle the list of registered blocks to instrument
       for (auto val : todo) {
@@ -885,6 +891,8 @@ bool AFLCoverage::runOnModule(Module &M) {
 
     }
 
+#endif
+
   }
 
   /*