about summary refs log tree commit diff
path: root/llvm_mode/afl-llvm-lto-instrumentation.so.cc
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-23 17:00:02 +0200
committervan Hauser <vh@thc.org>2020-05-23 17:00:02 +0200
commit38df6eb3a9d572d13a0554f6d511723feb644be6 (patch)
treedcd5461614c851361dbb8eb1f5af65783f87353c /llvm_mode/afl-llvm-lto-instrumentation.so.cc
parent0245f8438d71b07e2a2415e8880bd4bbd70b5859 (diff)
downloadafl++-38df6eb3a9d572d13a0554f6d511723feb644be6.tar.gz
LTO whitelist functionality rewritten, now anything can be skipped
Diffstat (limited to 'llvm_mode/afl-llvm-lto-instrumentation.so.cc')
-rw-r--r--llvm_mode/afl-llvm-lto-instrumentation.so.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm_mode/afl-llvm-lto-instrumentation.so.cc b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
index f44b336e..cbe68171 100644
--- a/llvm_mode/afl-llvm-lto-instrumentation.so.cc
+++ b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
@@ -197,6 +197,17 @@ bool AFLLTOPass::runOnModule(Module &M) {
     if (F.size() < function_minimum_size) continue;
     if (isBlacklisted(&F)) continue;
 
+    // whitelist check
+    AttributeList Attrs = F.getAttributes();
+    if (Attrs.hasAttribute(-1, StringRef("skipinstrument"))) {
+
+      if (debug)
+        fprintf(stderr, "DEBUG: Function %s is not whitelisted\n",
+                F.getName().str().c_str());
+      continue;
+
+    }
+
     std::vector<BasicBlock *> InsBlocks;
 
     if (autodictionary) {