aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorh1994st <h1994st@gmail.com>2020-03-02 15:27:31 -0500
committerh1994st <h1994st@gmail.com>2020-03-02 15:27:31 -0500
commit031946136bb61990d03d7cc4ebc9487218b30338 (patch)
tree37f27b4f0a84da70f3e0decddd16639217c936b9
parent7b59e05600aff4e9deb3110887d6ad49838f02b0 (diff)
parentf6050ab804f06fbedfb1fd1b619217be85db2e00 (diff)
downloadafl++-031946136bb61990d03d7cc4ebc9487218b30338.tar.gz
Merge branch 'master' of https://github.com/vanhauser-thc/AFLplusplus
-rw-r--r--Makefile12
-rwxr-xr-xafl-cmin1
-rwxr-xr-xafl-cmin.bash2
-rw-r--r--docs/Changelog.md3
-rw-r--r--docs/env_variables.md4
-rw-r--r--gcc_plugin/afl-gcc-fast.c1
-rw-r--r--include/afl-fuzz.h2
-rw-r--r--include/envs.h1
-rw-r--r--llvm_mode/afl-clang-fast.c1
-rw-r--r--src/afl-fuzz-globals.c1
-rw-r--r--src/afl-fuzz-init.c20
-rw-r--r--src/afl-fuzz.c11
12 files changed, 46 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index f97f7f4f..b64a6dfe 100644
--- a/Makefile
+++ b/Makefile
@@ -68,8 +68,8 @@ override CFLAGS += -Wall -g -Wno-pointer-sign -I include/ \
AFL_FUZZ_FILES = $(wildcard src/afl-fuzz*.c)
-ifneq "$(shell which python3m)" ""
- ifneq "$(shell which python3m-config)" ""
+ifneq "$(shell which python3m 2>/dev/null)" ""
+ ifneq "$(shell which python3m-config 2>/dev/null)" ""
PYTHON_INCLUDE ?= $(shell python3m-config --includes)
PYTHON_VERSION ?= $(strip $(shell python3m --version 2>&1))
# Starting with python3.8, we need to pass the `embed` flag. Earier versions didn't know this flag.
@@ -81,8 +81,8 @@ ifneq "$(shell which python3m)" ""
endif
endif
-ifneq "$(shell which python3)" ""
- ifneq "$(shell which python3-config)" ""
+ifneq "$(shell which python3 2>/dev/null)" ""
+ ifneq "$(shell which python3-config 2>/dev/null)" ""
PYTHON_INCLUDE ?= $(shell python3-config --includes)
PYTHON_VERSION ?= $(strip $(shell python3 --version 2>&1))
# Starting with python3.8, we need to pass the `embed` flag. Earier versions didn't know this flag.
@@ -94,8 +94,8 @@ ifneq "$(shell which python3)" ""
endif
endif
-ifneq "$(shell which python)" ""
- ifneq "$(shell which python-config)" ""
+ifneq "$(shell which python 2>/dev/null)" ""
+ ifneq "$(shell which python-config 2>/dev/null)" ""
PYTHON_INCLUDE ?= $(shell python-config --includes)
PYTHON_LIB ?= $(shell python-config --ldflags)
PYTHON_VERSION ?= $(strip $(shell python --version 2>&1))
diff --git a/afl-cmin b/afl-cmin
index c7531221..28d8c746 100755
--- a/afl-cmin
+++ b/afl-cmin
@@ -1,4 +1,5 @@
#!/usr/bin/env sh
+export AFL_QUIET=1
THISPATH=`dirname ${0}`
export PATH="${THISPATH}:$PATH"
awk -f - -- ${@+"$@"} <<'EOF'
diff --git a/afl-cmin.bash b/afl-cmin.bash
index b1378eb5..1f23f6bc 100755
--- a/afl-cmin.bash
+++ b/afl-cmin.bash
@@ -51,6 +51,8 @@ TIMEOUT=none
unset IN_DIR OUT_DIR STDIN_FILE EXTRA_PAR MEM_LIMIT_GIVEN \
AFL_CMIN_CRASHES_ONLY AFL_CMIN_ALLOW_ANY QEMU_MODE UNICORN_MODE
+export AFL_QUIET=1
+
while getopts "+i:o:f:m:t:eQUCh" opt; do
case "$opt" in
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 2548a356..d5c2a279 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -10,9 +10,12 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
### Version ++2.62d (developt):
+
- qemu_mode now uses solely the internal capstone version to fix builds
on modern Linux distributions
+ - afl-fuzz basic tools now report on the environment variables picked up
- more tools get environment variable usage info in the help output
+ - AFL_AUTORESUME will resume execution without the need to specify `-i -`
### Version ++2.62c (release):
diff --git a/docs/env_variables.md b/docs/env_variables.md
index fdc86a42..527f1c1b 100644
--- a/docs/env_variables.md
+++ b/docs/env_variables.md
@@ -265,6 +265,10 @@ checks or alter some of the more exotic semantics of the tool:
- Setting AFL_NO_CPU_RED will not display very high cpu usages in red color.
+ - Setting AFL_AUTORESUME will resume a fuzz run (same as providing `-i -`)
+ for an existing out folder, even if a different `-i` was provided.
+ Without this setting, afl-fuzz will refuse execution for a long-fuzzed out dir.
+
- Outdated environment variables that are that not supported anymore:
AFL_DEFER_FORKSRV
AFL_PERSISTENT
diff --git a/gcc_plugin/afl-gcc-fast.c b/gcc_plugin/afl-gcc-fast.c
index 91b786ba..a57f48d3 100644
--- a/gcc_plugin/afl-gcc-fast.c
+++ b/gcc_plugin/afl-gcc-fast.c
@@ -41,6 +41,7 @@ static u8* obj_path; /* Path to runtime libraries */
static u8** cc_params; /* Parameters passed to the real CC */
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
u8 use_stdin = 0; /* dummy */
+u8 be_quiet;
/* Try to find the runtime libraries. If that fails, abort. */
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h
index ae04554a..b8b6d5e3 100644
--- a/include/afl-fuzz.h
+++ b/include/afl-fuzz.h
@@ -315,6 +315,7 @@ extern u8 skip_deterministic, /* Skip deterministic stages? */
no_forkserver, /* Disable forkserver? */
crash_mode, /* Crash mode! Yeah! */
in_place_resume, /* Attempt in-place resume? */
+ autoresume, /* Resume if out_dir exists? */
auto_changed, /* Auto-generated tokens changed? */
no_cpu_meter_red, /* Feng shui on the status screen */
no_arith, /* Skip most arithmetic ops */
@@ -697,7 +698,6 @@ u32 find_start_position(void);
void find_timeout(void);
double get_runnable_processes(void);
void nuke_resume_dir(void);
-void maybe_delete_out_dir(void);
void setup_dirs_fds(void);
void setup_cmdline_file(char**);
void setup_stdio_file(void);
diff --git a/include/envs.h b/include/envs.h
index 0f7ed37a..306143be 100644
--- a/include/envs.h
+++ b/include/envs.h
@@ -1,6 +1,7 @@
const char *afl_environment_variables[] = {
"AFL_ALIGNED_ALLOC", "AFL_ALLOW_TMP", "AFL_ANALYZE_HEX", "AFL_AS",
+ "AFL_AUTORESUME",
"AFL_AS_FORCE_INSTRUMENT", "AFL_BENCH_JUST_ONE", "AFL_BENCH_UNTIL_CRASH",
"AFL_CAL_FAST", "AFL_CC", "AFL_CMIN_ALLOW_ANY", "AFL_CMIN_CRASHES_ONLY",
"AFL_CODE_END", "AFL_CODE_START", "AFL_COMPCOV_BINNAME",
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index dd8d2dfc..fa3b5c78 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -43,6 +43,7 @@ static u32 cc_par_cnt = 1; /* Param count, including argv0 */
static u8 llvm_fullpath[PATH_MAX];
static u8 cmplog_mode;
u8 use_stdin = 0; /* dummy */
+u8 be_quiet = 0;
/* Try to find the runtime libraries. If that fails, abort. */
diff --git a/src/afl-fuzz-globals.c b/src/afl-fuzz-globals.c
index 8577f875..1fd4b26d 100644
--- a/src/afl-fuzz-globals.c
+++ b/src/afl-fuzz-globals.c
@@ -115,6 +115,7 @@ u8 skip_deterministic, /* Skip deterministic stages? */
no_forkserver, /* Disable forkserver? */
crash_mode, /* Crash mode! Yeah! */
in_place_resume, /* Attempt in-place resume? */
+ autoresume, /* Resume if out_dir exists? */
auto_changed, /* Auto-generated tokens changed? */
no_cpu_meter_red, /* Feng shui on the status screen */
no_arith, /* Skip most arithmetic ops */
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 9ae95b7d..08b6de60 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -866,7 +866,7 @@ void find_timeout(void) {
}
-/* A helper function for maybe_delete_out_dir(), deleting all prefixed
+/* A helper function for handle_existing_out_dir(), deleting all prefixed
files in a directory. */
static u8 delete_files(u8* path, u8* prefix) {
@@ -990,9 +990,10 @@ dir_cleanup_failed:
}
/* Delete fuzzer output directory if we recognize it as ours, if the fuzzer
- is not currently running, and if the last run time isn't too great. */
+ is not currently running, and if the last run time isn't too great.
+ Resume fuzzing if `-` is set as in_dir or if AFL_AUTORESUME is set */
-void maybe_delete_out_dir(void) {
+static void handle_existing_out_dir(void) {
FILE* f;
u8* fn = alloc_printf("%s/fuzzer_stats", out_dir);
@@ -1035,6 +1036,15 @@ void maybe_delete_out_dir(void) {
fclose(f);
+ /* Autoresume treats a normal run as in_place_resume if a valid out dir already exists */
+
+ if (!in_place_resume && autoresume) {
+
+ OKF("Detected prior run with AFL_AUTORESUME set. Resuming.");
+ in_place_resume = 1;
+
+ }
+
/* Let's see how much work is at stake. */
if (!in_place_resume && last_update - start_time2 > OUTPUT_GRACE * 60) {
@@ -1051,7 +1061,7 @@ void maybe_delete_out_dir(void) {
" or specify a different output location for this job. To resume "
"the old\n"
" session, put '-' as the input directory in the command line "
- "('-i -') and\n"
+ "('-i -') or set the AFL_AUTORESUME=1 env variable and\n"
" try again.\n",
OUTPUT_GRACE);
@@ -1278,7 +1288,7 @@ void setup_dirs_fds(void) {
if (errno != EEXIST) PFATAL("Unable to create '%s'", out_dir);
- maybe_delete_out_dir();
+ handle_existing_out_dir();
} else {
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 035f74dc..2f0043ab 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -186,6 +186,7 @@ static void usage(u8* argv0, int more_help) {
//"AFL_DEFER_FORKSRV: not supported anymore -> no effect, just a warning\n"
"AFL_EXIT_WHEN_DONE: exit when all inputs are run and no new finds are found\n"
"AFL_BENCH_UNTIL_CRASH: exit soon when the first crashing input has been found\n"
+ "AFL_AUTORESUME: resume fuzzing if directory specified by -o already exists\n"
"\n"
);
else
@@ -649,7 +650,7 @@ int main(int argc, char** argv, char** envp) {
usage(argv[0], show_help);
OKF("afl++ is maintained by Marc \"van Hauser\" Heuse, Heiko \"hexcoder\" "
- "Eißfeldt and Andrea Fioraldi");
+ "Eißfeldt, Andrea Fioraldi and Dominik Maier");
OKF("afl++ is open source, get it at "
"https://github.com/vanhauser-thc/AFLplusplus");
OKF("Power schedules from github.com/mboehme/aflfast");
@@ -750,6 +751,14 @@ int main(int argc, char** argv, char** envp) {
if (get_afl_env("AFL_SHUFFLE_QUEUE")) shuffle_queue = 1;
if (get_afl_env("AFL_FAST_CAL")) fast_cal = 1;
+ if (get_afl_env("AFL_AUTORESUME")) {
+
+ autoresume = 1;
+ if (in_place_resume)
+ SAYF("AFL_AUTORESUME has no effect for '-i -'");
+
+ }
+
if (get_afl_env("AFL_HANG_TMOUT")) {
hang_tmout = atoi(getenv("AFL_HANG_TMOUT"));