add env info to afl-gcc-fast
MODIFY
gcc_plugin/Makefile
gcc_plugin/Makefile
@@ -24,9 +24,12 @@ PREFIX ?= /usr/local
HELPER_PATH = $(PREFIX)/lib/afl
BIN_PATH = $(PREFIX)/bin
+VERSION = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f2)
+
CFLAGS ?= -O3 -g -funroll-loops
CFLAGS += -Wall -I../include -D_FORTIFY_SOURCE=2 -Wno-pointer-sign \
-DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
+ -DGCC_VERSION=\"$(GCCVER)\" -DGCC_BINDIR=\"$(GCCBINDIR)\" \
CXXFLAGS ?= -O3 -g -funroll-loops
CXXEFLAGS := $(CXXFLAGS) -Wall -D_FORTIFY_SOURCE=2
@@ -37,6 +40,9 @@ CXX ?= g++
PLUGIN_FLAGS = -fPIC -fno-rtti -I"$(shell $(CC) -print-file-name=plugin)/include"
HASH=\#
+GCCVER = $(shell $(CC) --version 2>/dev/null | awk 'NR == 1 {print $$NF}')
+GCCBINDIR = $(shell dirname `which $(CC)` 2>/dev/null )
+
ifeq "$(shell echo '$(HASH)include <sys/ipc.h>@$(HASH)include <sys/shm.h>@int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 ; rm -f .test2 )" "1"
SHMAT_OK=1
else

MODIFY
gcc_plugin/afl-gcc-fast.c
gcc_plugin/afl-gcc-fast.c
@@ -323,10 +323,24 @@ int main(int argc, char** argv, char** envp) {
"programs\n"
"(similarly to the LLVM plugin used by afl-clang-fast).\n\n"
- "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",
- BIN_PATH, BIN_PATH);
+ "Environment variables used:\n"
+ "AFL_CC: path to the C compiler to use\n"
+ "AFL_CXX: path to the C++ compiler to use\n"
+ "AFL_PATH: path to instrumenting pass and runtime (afl-gcc-rt.*o)\n"
+ "AFL_DONT_OPTIMIZE: disable optimization instead of -O3\n"
+ "AFL_NO_BUILTIN: compile for use with libtokencap.so\n"
+ "AFL_INST_RATIO: percentage of branches to instrument\n"
+ "AFL_QUIET: suppress verbose output\n"
+ "AFL_DEBUG: enable developer debugging output\n"
+ "AFL_HARDEN: adds code hardening to catch memory bugs\n"
+ "AFL_USE_ASAN: activate address sanitizer\n"
+ "AFL_USE_MSAN: activate memory sanitizer\n"
+ "AFL_USE_UBSAN: activate undefined behaviour sanitizer\n"
+ "AFL_GCC_WHITELIST: enable whitelisting (selective instrumentation)\n"
+
+ "\nafl-gcc-fast was built for gcc %s with the gcc binary path of "
+ "\"%s\".\n\n"
+ , BIN_PATH, BIN_PATH, GCC_VERSION, GCC_BINDIR);
exit(1);

add env info to afl-gcc-fast