blacklist function support for llvm_mode
MODIFY
TODO
TODO
Roadmap 2.61+:
==============
+Makefile:
+ - -march=native -Ofast -flto=full
+
afl-fuzz:
- sync_fuzzers(): only masters sync from all, slaves only sync from master

MODIFY
docs/ChangeLog
docs/ChangeLog
@@ -20,7 +20,8 @@ Version ++2.60d (develop):
- afl-fuzz:
- now prints the real python version support compiled in
- afl-clang-fast now shows in the help output for which llvm version it
- was compiled for.
+ was compiled for
+ - added blacklisted function check in llvm_mode
- added fix from Debian project to compile libdislocator and libtokencap

MODIFY
llvm_mode/LLVMInsTrim.so.cc
llvm_mode/LLVMInsTrim.so.cc
@@ -94,6 +94,28 @@ struct InsTrim : public ModulePass {
}
+ // ripped from aflgo
+ static bool isBlacklisted(const Function *F) {
+
+ static const SmallVector<std::string, 4> Blacklist = {
+
+ "asan.",
+ "llvm.",
+ "sancov.",
+ "__ubsan_handle_",
+
+ };
+
+ for (auto const &BlacklistFunc : Blacklist) {
+
+ if (F->getName().startswith(BlacklistFunc)) { return true; }
+
+ }
+
+ return false;
+
+ }
+
bool runOnModule(Module &M) override {
char be_quiet = 0;
@@ -240,6 +262,8 @@ struct InsTrim : public ModulePass {
}
+ if (isBlacklisted(&F)) continue;
+
std::unordered_set<BasicBlock *> MS;
if (!MarkSetOpt) {

MODIFY
llvm_mode/afl-clang-fast.c
llvm_mode/afl-clang-fast.c
@@ -444,7 +444,8 @@ int main(int argc, char** argv) {
"You can specify custom next-stage toolchain via AFL_CC and AFL_CXX. "
"Setting\n"
"AFL_HARDEN enables hardening optimizations in the compiled code.\n\n"
- "afl-clang-fast was built for llvm %s with the llvm binary path of \"%s\".\n\n",
+ "afl-clang-fast was built for llvm %s with the llvm binary path of "
+ "\"%s\".\n\n",
BIN_PATH, BIN_PATH, LLVM_VERSION, LLVM_BINDIR);
exit(1);

MODIFY
llvm_mode/afl-llvm-pass.so.cc
llvm_mode/afl-llvm-pass.so.cc
@@ -75,6 +75,28 @@ class AFLCoverage : public ModulePass {
}
+ // ripped from aflgo
+ static bool isBlacklisted(const Function *F) {
+
+ static const SmallVector<std::string, 4> Blacklist = {
+
+ "asan.",
+ "llvm.",
+ "sancov.",
+ "__ubsan_handle_",
+
+ };
+
+ for (auto const &BlacklistFunc : Blacklist) {
+
+ if (F->getName().startswith(BlacklistFunc)) { return true; }
+
+ }
+
+ return false;
+
+ }
+
bool runOnModule(Module &M) override;
// StringRef getPassName() const override {
@@ -156,13 +178,11 @@ bool AFLCoverage::runOnModule(Module &M) {
/* Instrument all the things! */
- const char *IntrinsicPrefix = "llvm.";
int inst_blocks = 0;
for (auto &F : M) {
- auto Fname = F.getName();
- if (Fname.startswith(IntrinsicPrefix)) continue;
+ if (isBlacklisted(&F)) continue;
for (auto &BB : F) {
@@ -377,6 +397,7 @@ bool AFLCoverage::runOnModule(Module &M) {
inst_blocks++;
}
+
}
/* Say something nice. */

blacklist function support for llvm_mode