aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-07-14 14:31:27 +0200
committervanhauser-thc <vh@thc.org>2021-07-14 14:31:27 +0200
commit9ec63d3f1776ae1442fe89d5e076b58b36997f76 (patch)
tree470b04c8a3ddbda1b5fe1e6329eaac93d35ee44d
parent4fe572b80f76ff0b0e916b639d1e04d5af48b157 (diff)
downloadafl++-9ec63d3f1776ae1442fe89d5e076b58b36997f76.tar.gz
fix frida, fix dictionary generation to honor AFL_LLVM_{ALLOW/DENY}LIST
-rw-r--r--docs/Changelog.md2
-rw-r--r--frida_mode/src/instrument/instrument.c3
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc2
-rw-r--r--instrumentation/afl-llvm-dict2file.so.cc1
-rw-r--r--instrumentation/afl-llvm-pass.so.cc4
5 files changed, 9 insertions, 3 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 29af44ab..8aca5608 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -24,10 +24,12 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
- Fix to instrument global namespace functions in c++
- Fix for llvm 13
- support partial linking
+ - do honor AFL_LLVM_{ALLOW/DENY}LIST for LTO autodictionary and DICT2FILE
- We do support llvm versions from 3.8 to 5.0 again
- frida_mode:
- several fixes for cmplog
- remove need for AFL_FRIDA_PERSISTENT_RETADDR_OFFSET
+ - less coverage collision
- feature parity of aarch64 with intel now (persistent, cmplog,
in-memory testcases, asan)
- afl-cmin and afl-showmap -i do now descend into subdirectories
diff --git a/frida_mode/src/instrument/instrument.c b/frida_mode/src/instrument/instrument.c
index 81d14013..e1dabf92 100644
--- a/frida_mode/src/instrument/instrument.c
+++ b/frida_mode/src/instrument/instrument.c
@@ -1,6 +1,7 @@
#include <unistd.h>
#include <sys/shm.h>
#include <sys/mman.h>
+#include <sys/syscall.h>
#include "frida-gumjs.h"
@@ -289,7 +290,7 @@ void instrument_init(void) {
* needs to be different for each instance.
*/
instrument_hash_seed =
- g_get_monotonic_time() ^ (((guint64)getpid()) << 32) ^ gettid();
+ g_get_monotonic_time() ^ (((guint64)getpid()) << 32) ^ syscall(SYS_gettid);
OKF("Instrumentation - seed [0x%016" G_GINT64_MODIFIER "x]",
instrument_hash_seed);
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index 28eb0b9f..91b81910 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -516,6 +516,8 @@ bool ModuleSanitizerCoverage::instrumentModule(
for (auto &F : M) {
+ if (!isInInstrumentList(&F) || !F.size()) { continue; }
+
for (auto &BB : F) {
for (auto &IN : BB) {
diff --git a/instrumentation/afl-llvm-dict2file.so.cc b/instrumentation/afl-llvm-dict2file.so.cc
index 5350f62b..9daa75a8 100644
--- a/instrumentation/afl-llvm-dict2file.so.cc
+++ b/instrumentation/afl-llvm-dict2file.so.cc
@@ -154,6 +154,7 @@ bool AFLdict2filePass::runOnModule(Module &M) {
for (auto &F : M) {
if (isIgnoreFunction(&F)) continue;
+ if (!isInInstrumentList(&F) || !F.size()) { continue; }
/* Some implementation notes.
*
diff --git a/instrumentation/afl-llvm-pass.so.cc b/instrumentation/afl-llvm-pass.so.cc
index 94b77f7d..ecf28f31 100644
--- a/instrumentation/afl-llvm-pass.so.cc
+++ b/instrumentation/afl-llvm-pass.so.cc
@@ -438,9 +438,9 @@ bool AFLCoverage::runOnModule(Module &M) {
fprintf(stderr, "FUNCTION: %s (%zu)\n", F.getName().str().c_str(),
F.size());
- if (!isInInstrumentList(&F)) continue;
+ if (!isInInstrumentList(&F)) { continue; }
- if (F.size() < function_minimum_size) continue;
+ if (F.size() < function_minimum_size) { continue; }
std::list<Value *> todo;
for (auto &BB : F) {