aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/afl-analyze.c4
-rw-r--r--src/afl-as.c8
-rw-r--r--src/afl-common.c7
-rw-r--r--src/afl-forkserver.c6
-rw-r--r--src/afl-fuzz-bitmap.c2
-rw-r--r--src/afl-fuzz-extras.c2
-rw-r--r--src/afl-fuzz-globals.c3
-rw-r--r--src/afl-fuzz-init.c2
-rw-r--r--src/afl-fuzz-misc.c2
-rw-r--r--src/afl-fuzz-one.c14
-rw-r--r--src/afl-fuzz-python.c2
-rw-r--r--src/afl-fuzz-queue.c2
-rw-r--r--src/afl-fuzz-run.c2
-rw-r--r--src/afl-fuzz-stats.c2
-rw-r--r--src/afl-fuzz.c24
-rw-r--r--src/afl-gcc.c2
-rw-r--r--src/afl-gotcpu.c2
-rw-r--r--src/afl-sharedmem.c2
-rw-r--r--src/afl-showmap.c14
-rw-r--r--src/afl-tmin.c4
20 files changed, 58 insertions, 48 deletions
diff --git a/src/afl-analyze.c b/src/afl-analyze.c
index f71893d8..3d4e636e 100644
--- a/src/afl-analyze.c
+++ b/src/afl-analyze.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ static u64 mem_limit = MEM_LIMIT; /* Memory limit (MB) */
static s32 dev_null_fd = -1; /* FD to /dev/null */
-static u8 edges_only, /* Ignore hit counts? */
+u8 edges_only, /* Ignore hit counts? */
use_hex_offsets, /* Show hex offsets? */
use_stdin = 1; /* Use stdin for program input? */
diff --git a/src/afl-as.c b/src/afl-as.c
index 9abe3fc2..77ac2f97 100644
--- a/src/afl-as.c
+++ b/src/afl-as.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -208,8 +208,12 @@ static void edit_params(int argc, char** argv) {
NSS. */
if (strncmp(input_file, tmp_dir, strlen(tmp_dir)) &&
- strncmp(input_file, "/var/tmp/", 9) && strncmp(input_file, "/tmp/", 5))
+ strncmp(input_file, "/var/tmp/", 9) &&
+ strncmp(input_file, "/tmp/", 5) &&
+ getenv("AFL_AS_FORCE_INSTRUMENT") == NULL)
pass_thru = 1;
+ else if (getenv("AFL_AS_FORCE_INSTRUMENT"))
+ unsetenv("AFL_AS_FORCE_INSTRUMENT");
}
diff --git a/src/afl-common.c b/src/afl-common.c
index ec010c2d..8c2f2b9a 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -35,7 +35,8 @@
#include <unistd.h>
#endif
-u8* target_path; /* Path to target binary */
+u8* target_path; /* Path to target binary */
+extern u8 use_stdin;
void detect_file_args(char** argv, u8* prog_in) {
@@ -78,6 +79,8 @@ void detect_file_args(char** argv, u8* prog_in) {
else
aa_subst = alloc_printf("%s/%s", cwd, prog_in);
+ use_stdin = 0;
+
/* Construct a replacement argv value. */
*aa_loc = 0;
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index 5e20e50b..de50c73c 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -11,7 +11,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -43,6 +43,8 @@
/* a program that includes afl-forkserver needs to define these */
extern u8 uses_asan;
extern u8 *trace_bits;
+extern u8 use_stdin;
+
extern s32 forksrv_pid, child_pid, fsrv_ctl_fd, fsrv_st_fd;
extern s32 out_fd, out_dir_fd, dev_null_fd; /* initialize these with -1 */
#ifndef HAVE_ARC4RANDOM
@@ -211,7 +213,7 @@ void init_forkserver(char **argv) {
}
- if (out_file) {
+ if (!use_stdin) {
dup2(dev_null_fd, 0);
diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c
index c1aeb9ac..0f611cdf 100644
--- a/src/afl-fuzz-bitmap.c
+++ b/src/afl-fuzz-bitmap.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-fuzz-extras.c b/src/afl-fuzz-extras.c
index 23b2c235..fcc7749d 100644
--- a/src/afl-fuzz-extras.c
+++ b/src/afl-fuzz-extras.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-fuzz-globals.c b/src/afl-fuzz-globals.c
index de716098..b3476778 100644
--- a/src/afl-fuzz-globals.c
+++ b/src/afl-fuzz-globals.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -86,6 +86,7 @@ u8 cal_cycles = CAL_CYCLES, /* Calibration cycles defaults */
cal_cycles_long = CAL_CYCLES_LONG, /* Calibration cycles defaults */
debug, /* Debug mode */
no_unlink, /* do not unlink cur_input */
+ use_stdin = 1, /* use stdin for sending data */
custom_only, /* Custom mutator only mode */
python_only; /* Python-only mode */
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 825169cf..5fe3689e 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-fuzz-misc.c b/src/afl-fuzz-misc.c
index f45642f4..b8f376be 100644
--- a/src/afl-fuzz-misc.c
+++ b/src/afl-fuzz-misc.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-fuzz-one.c b/src/afl-fuzz-one.c
index f7cfbbe1..87a1418c 100644
--- a/src/afl-fuzz-one.c
+++ b/src/afl-fuzz-one.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -482,6 +482,9 @@ u8 fuzz_one_original(char** argv) {
if (use_radamsa > 1) goto radamsa_stage;
+
+//custom_stage: // not used - yet
+
if (custom_mutator) {
stage_short = "custom";
@@ -541,9 +544,6 @@ u8 fuzz_one_original(char** argv) {
: havoc_max_mult * 100)) ||
queue_cur->passed_det) {
- if (use_radamsa > 1)
- goto radamsa_stage;
- else
#ifdef USE_PYTHON
goto python_stage;
#else
@@ -557,9 +557,6 @@ u8 fuzz_one_original(char** argv) {
if (master_max && (queue_cur->exec_cksum % master_max) != master_id - 1) {
- if (use_radamsa > 1)
- goto radamsa_stage;
- else
#ifdef USE_PYTHON
goto python_stage;
#else
@@ -2266,9 +2263,6 @@ retry_splicing:
out_buf = ck_alloc_nozero(len);
memcpy(out_buf, in_buf, len);
- if (use_radamsa > 1)
- goto radamsa_stage;
- else
#ifdef USE_PYTHON
goto python_stage;
#else
diff --git a/src/afl-fuzz-python.c b/src/afl-fuzz-python.c
index 6800c0c0..f1cdecde 100644
--- a/src/afl-fuzz-python.c
+++ b/src/afl-fuzz-python.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c
index 9f036186..1b51e3aa 100644
--- a/src/afl-fuzz-queue.c
+++ b/src/afl-fuzz-queue.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c
index 8f72d0fe..fa7a872a 100644
--- a/src/afl-fuzz-run.c
+++ b/src/afl-fuzz-run.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c
index fa4be50f..18f32ae8 100644
--- a/src/afl-fuzz-stats.c
+++ b/src/afl-fuzz-stats.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 59892559..e75ab48a 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -84,13 +84,6 @@ static u8* get_libradamsa_path(u8* own_loc) {
static void usage(u8* argv0) {
-#ifdef USE_PYTHON
-#define PHYTON_SUPPORT \
- "Compiled with Python 2.7 module support, see docs/python_mutators.txt\n"
-#else
-#define PHYTON_SUPPORT ""
-#endif
-
SAYF(
"\n%s [ options ] -- /path/to/fuzzed_app [ ... ]\n\n"
@@ -146,13 +139,15 @@ static void usage(u8* argv0) {
"file\n"
" -C - crash exploration mode (the peruvian rabbit thing)\n"
" -e ext - File extension for the temporarily generated test "
- "case\n\n"
+ "case\n\n",
- PHYTON_SUPPORT
+ argv0, EXEC_TIMEOUT, MEM_LIMIT);
- "For additional tips, please consult %s/README\n\n",
+#ifdef USE_PYTHON
+ SAYF("Compiled with Python %s module support, see docs/python_mutators.txt\n", (char*)PYTHON_VERSION);
+#endif
- argv0, EXEC_TIMEOUT, MEM_LIMIT, doc_path);
+ SAYF("For additional help please consult %s/README.md\n\n", doc_path);
exit(1);
#undef PHYTON_SUPPORT
@@ -304,6 +299,7 @@ int main(int argc, char** argv) {
if (out_file) FATAL("Multiple -f options not supported");
out_file = optarg;
+ use_stdin = 0;
break;
case 'x': /* dictionary */
@@ -595,7 +591,7 @@ int main(int argc, char** argv) {
if (optind == argc || !in_dir || !out_dir) usage(argv[0]);
OKF("afl++ is maintained by Marc \"van Hauser\" Heuse, Heiko \"hexcoder\" "
- "Eissfeldt and Andrea Fioraldi");
+ "Eißfeldt and Andrea Fioraldi");
OKF("afl++ is open source, get it at "
"https://github.com/vanhauser-thc/AFLplusplus");
OKF("Power schedules from github.com/mboehme/aflfast");
@@ -836,6 +832,8 @@ int main(int argc, char** argv) {
if (aa_loc && !out_file) {
+ use_stdin = 0;
+
if (file_extension) {
out_file = alloc_printf("%s/.cur_input.%s", out_dir, file_extension);
diff --git a/src/afl-gcc.c b/src/afl-gcc.c
index 9663b758..301e2034 100644
--- a/src/afl-gcc.c
+++ b/src/afl-gcc.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c
index da574ed8..9a56159c 100644
--- a/src/afl-gotcpu.c
+++ b/src/afl-gotcpu.c
@@ -9,7 +9,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c
index e11221a4..16eb14a7 100644
--- a/src/afl-sharedmem.c
+++ b/src/afl-sharedmem.c
@@ -11,7 +11,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 94bbd421..8c899c9d 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -11,7 +11,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -72,11 +72,12 @@ static u32 total, highest; /* tuple content information */
static u64 mem_limit = MEM_LIMIT; /* Memory limit (MB) */
-static u8 quiet_mode, /* Hide non-essential messages? */
+u8 quiet_mode, /* Hide non-essential messages? */
edges_only, /* Ignore hit counts? */
raw_instr_output, /* Do not apply AFL filters */
cmin_mode, /* Generate output in afl-cmin mode? */
binary_mode, /* Write output as a binary map */
+ use_stdin = 1, /* use stdin - unused here */
keep_cores; /* Allow coredumps? */
static volatile u8 stop_soon, /* Ctrl-C pressed? */
@@ -535,7 +536,7 @@ int main(int argc, char** argv) {
doc_path = access(DOC_PATH, F_OK) ? "docs" : DOC_PATH;
- while ((opt = getopt(argc, argv, "+o:m:t:A:eqZQUWbcrh")) > 0)
+ while ((opt = getopt(argc, argv, "+o:f:m:t:A:eqZQUWbcrh")) > 0)
switch (opt) {
@@ -583,6 +584,13 @@ int main(int argc, char** argv) {
break;
+ case 'f': // only in here to avoid a compiler warning for use_stdin
+
+ use_stdin = 0;
+ FATAL("Option -f is not supported in afl-showmap");
+
+ break;
+
case 't':
if (timeout_given) FATAL("Multiple -t options not supported");
diff --git a/src/afl-tmin.c b/src/afl-tmin.c
index b98208f9..3e33b72f 100644
--- a/src/afl-tmin.c
+++ b/src/afl-tmin.c
@@ -11,7 +11,7 @@
Andrea Fioraldi <andreafioraldi@gmail.com>
Copyright 2016, 2017 Google Inc. All rights reserved.
- Copyright 2019 AFLplusplus Project. All rights reserved.
+ Copyright 2019-2020 AFLplusplus Project. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -88,7 +88,7 @@ u64 mem_limit = MEM_LIMIT; /* Memory limit (MB) */
s32 dev_null_fd = -1; /* FD to /dev/null */
-static u8 crash_mode, /* Crash-centric mode? */
+u8 crash_mode, /* Crash-centric mode? */
exit_crash, /* Treat non-zero exit as crash? */
edges_only, /* Ignore hit counts? */
exact_mode, /* Require path match for crashes? */