aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-07-19 10:31:56 +0200
committerGitHub <noreply@github.com>2021-07-19 10:31:56 +0200
commit939729e504ea269dd6d7252c363b160e01d1be1a (patch)
tree808710139e53d9958cdb660d61680d48e64e8c3a /utils
parent458eb0813a6f7d63eed97f18696bca8274533123 (diff)
parent18fd97fc5ffc5ad94e735cfbfa0d500463dcb585 (diff)
downloadafl++-939729e504ea269dd6d7252c363b160e01d1be1a.tar.gz
Merge pull request #1023 from AFLplusplus/dev
push to stable
Diffstat (limited to 'utils')
-rw-r--r--utils/aflpp_driver/GNUmakefile14
-rw-r--r--utils/aflpp_driver/README.md7
-rw-r--r--utils/aflpp_driver/aflpp_qemu_driver.c4
-rwxr-xr-xutils/qbdi_mode/README.md4
4 files changed, 22 insertions, 7 deletions
diff --git a/utils/aflpp_driver/GNUmakefile b/utils/aflpp_driver/GNUmakefile
index ad99b893..c282a9f3 100644
--- a/utils/aflpp_driver/GNUmakefile
+++ b/utils/aflpp_driver/GNUmakefile
@@ -15,28 +15,28 @@ aflpp_driver.o: aflpp_driver.c
-$(LLVM_BINDIR)clang -I. -I../../include $(CFLAGS) -c aflpp_driver.c
libAFLDriver.a: aflpp_driver.o
- ar ru libAFLDriver.a aflpp_driver.o
- cp -vf libAFLDriver.a ../../
+ @ar rc libAFLDriver.a aflpp_driver.o
+ @cp -vf libAFLDriver.a ../../
debug:
$(LLVM_BINDIR)clang -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.o ../../src/afl-performance.c
$(LLVM_BINDIR)clang -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
#$(LLVM_BINDIR)clang -S -emit-llvm -Wno-deprecated -I../../include $(CFLAGS) -D_DEBUG=\"1\" -c -o afl-performance.ll ../../src/afl-performance.c
#$(LLVM_BINDIR)clang -S -emit-llvm -I../../include -D_DEBUG=\"1\" -g -funroll-loops -c aflpp_driver.c
- ar ru libAFLDriver.a afl-performance.o aflpp_driver.o
+ ar rc libAFLDriver.a afl-performance.o aflpp_driver.o
aflpp_qemu_driver.o: aflpp_qemu_driver.c
-$(LLVM_BINDIR)clang $(CFLAGS) -O0 -funroll-loops -c aflpp_qemu_driver.c
libAFLQemuDriver.a: aflpp_qemu_driver.o
- -ar ru libAFLQemuDriver.a aflpp_qemu_driver.o
- -cp -vf libAFLQemuDriver.a ../../
+ @-ar rc libAFLQemuDriver.a aflpp_qemu_driver.o
+ @-cp -vf libAFLQemuDriver.a ../../
aflpp_qemu_driver_hook.so: aflpp_qemu_driver_hook.o
- -test -e aflpp_qemu_driver_hook.o && $(LLVM_BINDIR)clang -shared aflpp_qemu_driver_hook.o -o aflpp_qemu_driver_hook.so || echo "Note: Optional aflpp_qemu_driver_hook.so not built."
+ @-test -e aflpp_qemu_driver_hook.o && $(LLVM_BINDIR)clang -shared aflpp_qemu_driver_hook.o -o aflpp_qemu_driver_hook.so || echo "Note: Optional aflpp_qemu_driver_hook.so not built."
aflpp_qemu_driver_hook.o: aflpp_qemu_driver_hook.c
- -test -e ../../qemu_mode/qemuafl/qemuafl/api.h && $(LLVM_BINDIR)clang $(CFLAGS) -funroll-loops -c aflpp_qemu_driver_hook.c || echo "Note: Optional aflpp_qemu_driver_hook.o not built."
+ @-test -e ../../qemu_mode/qemuafl/qemuafl/api.h && $(LLVM_BINDIR)clang $(CFLAGS) -funroll-loops -c aflpp_qemu_driver_hook.c || echo "Note: Optional aflpp_qemu_driver_hook.o not built."
test: debug
#clang -S -emit-llvm -D_DEBUG=\"1\" -I../../include -Wl,--allow-multiple-definition -funroll-loops -o aflpp_driver_test.ll aflpp_driver_test.c
diff --git a/utils/aflpp_driver/README.md b/utils/aflpp_driver/README.md
index f03c2fe3..4ca59776 100644
--- a/utils/aflpp_driver/README.md
+++ b/utils/aflpp_driver/README.md
@@ -22,6 +22,8 @@ or `@@` as command line parameters.
## aflpp_qemu_driver
+Note that you can use the driver too for frida_mode (`-O`).
+
aflpp_qemu_driver is used for libfuzzer `LLVMFuzzerTestOneInput()` targets that
are to be fuzzed in qemu_mode. So we compile them with clang/clang++, without
-fsantize=fuzzer or afl-clang-fast, and link in libAFLQemuDriver.a:
@@ -34,3 +36,8 @@ Then just do (where the name of the binary is `fuzz`):
AFL_QEMU_PERSISTENT_ADDR=0x$(nm fuzz | grep "T LLVMFuzzerTestOneInput" | awk '{print $1}')
AFL_QEMU_PERSISTENT_HOOK=/path/to/aflpp_qemu_driver_hook.so afl-fuzz -Q ... -- ./fuzz`
```
+
+if you use afl-cmin or `afl-showmap -C` with the aflpp_qemu_driver you need to
+set the set same AFL_QEMU_... (or AFL_FRIDA_...) environment variables.
+If you want to use afl-showmap (without -C) or afl-cmin.bash then you may not
+set these environment variables and rather set `AFL_QEMU_DRIVER_NO_HOOK=1`.
diff --git a/utils/aflpp_driver/aflpp_qemu_driver.c b/utils/aflpp_driver/aflpp_qemu_driver.c
index 79de5af6..99a4c9a8 100644
--- a/utils/aflpp_driver/aflpp_qemu_driver.c
+++ b/utils/aflpp_driver/aflpp_qemu_driver.c
@@ -1,3 +1,4 @@
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
@@ -27,6 +28,9 @@ int main(int argc, char **argv) {
} else {
+ fprintf(stderr,
+ "Using shared-memory testcases. To read via stdin, set "
+ "AFL_QEMU_DRIVER_NO_HOOK=1.\n");
uint8_t dummy_input[1024000] = {0};
LLVMFuzzerTestOneInput(dummy_input, 1);
diff --git a/utils/qbdi_mode/README.md b/utils/qbdi_mode/README.md
index 641a6e85..cf5d3359 100755
--- a/utils/qbdi_mode/README.md
+++ b/utils/qbdi_mode/README.md
@@ -1,5 +1,9 @@
# qbdi-based binary-only instrumentation for afl-fuzz
+NOTE: this code is outdated and first would need to be adapted to the current
+afl++ versions first.
+Try afl_frida or fpicker [https://github.com/ttdennis/fpicker/](https://github.com/ttdennis/fpicker/) first, maybe they suite your need.
+
## 1) Introduction
The code in ./qbdi_mode allows you to build a standalone feature that