aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2024-05-02 08:35:24 +0200
committervanhauser-thc <vh@thc.org>2024-05-02 08:35:24 +0200
commit26eaf53a832be0b12dadbbd290b4a7e676818347 (patch)
treeb7171e10d36fbd8ee708ba326b4e029b38c12523 /src
parent5d623a27edcd4e6608178f80c7e29ede73138db6 (diff)
downloadafl++-26eaf53a832be0b12dadbbd290b4a7e676818347.tar.gz
AFL_DISABLE_REDUNDANT
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz-init.c7
-rw-r--r--src/afl-fuzz-queue.c1
-rw-r--r--src/afl-fuzz-redqueen.c9
-rw-r--r--src/afl-fuzz-state.c7
-rw-r--r--src/afl-fuzz.c1
5 files changed, 19 insertions, 6 deletions
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 2d540eb1..b3fe9318 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -933,10 +933,13 @@ void perform_dry_run(afl_state_t *afl) {
res = calibrate_case(afl, q, use_mem, 0, 1);
/* For AFLFast schedules we update the queue entry */
- if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE) && likely(q->exec_cksum)) {
+ if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE) &&
+ likely(q->exec_cksum)) {
+
q->n_fuzz_entry = q->exec_cksum % N_FUZZ_SIZE;
+
}
-
+
if (afl->stop_soon) { return; }
if (res == afl->crash_mode || res == FSRV_RUN_NOBITS) {
diff --git a/src/afl-fuzz-queue.c b/src/afl-fuzz-queue.c
index df4e7d79..5987ad0c 100644
--- a/src/afl-fuzz-queue.c
+++ b/src/afl-fuzz-queue.c
@@ -370,6 +370,7 @@ void mark_as_redundant(afl_state_t *afl, struct queue_entry *q, u8 state) {
s32 fd;
+ if (unlikely(afl->afl_env.afl_disable_redundant)) { q->disabled = 1; }
fd = open(fn, O_WRONLY | O_CREAT | O_EXCL, DEFAULT_PERMISSION);
if (fd < 0) { PFATAL("Unable to create '%s'", fn); }
close(fd);
diff --git a/src/afl-fuzz-redqueen.c b/src/afl-fuzz-redqueen.c
index cfa57c1d..9316da71 100644
--- a/src/afl-fuzz-redqueen.c
+++ b/src/afl-fuzz-redqueen.c
@@ -2764,15 +2764,15 @@ static u8 rtn_fuzz(afl_state_t *afl, u32 key, u8 *orig_buf, u8 *buf, u8 *cbuf,
#ifdef _DEBUG
u32 j;
struct cmp_header *hh = &afl->orig_cmp_map->headers[key];
- fprintf(stderr, "RTN N hits=%u shape=%u attr=%u v0=", h->hits,
- hshape, h->attribute);
+ fprintf(stderr, "RTN N hits=%u shape=%u attr=%u v0=", h->hits, hshape,
+ h->attribute);
for (j = 0; j < 8; j++)
fprintf(stderr, "%02x", o->v0[j]);
fprintf(stderr, " v1=");
for (j = 0; j < 8; j++)
fprintf(stderr, "%02x", o->v1[j]);
- fprintf(stderr, "\nRTN O hits=%u shape=%u attr=%u o0=", hh->hits,
- hshape, hh->attribute);
+ fprintf(stderr, "\nRTN O hits=%u shape=%u attr=%u o0=", hh->hits, hshape,
+ hh->attribute);
for (j = 0; j < 8; j++)
fprintf(stderr, "%02x", orig_o->v0[j]);
fprintf(stderr, " o1=");
@@ -3273,3 +3273,4 @@ exit_its:
return r;
}
+
diff --git a/src/afl-fuzz-state.c b/src/afl-fuzz-state.c
index c21ae6be..543fdc1c 100644
--- a/src/afl-fuzz-state.c
+++ b/src/afl-fuzz-state.c
@@ -293,6 +293,13 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
afl->afl_env.afl_cmplog_only_new =
get_afl_env(afl_environment_variables[i]) ? 1 : 0;
+ } else if (!strncmp(env, "AFL_DISABLE_REDUNDANT",
+
+ afl_environment_variable_len)) {
+
+ afl->afl_env.afl_disable_redundant =
+ get_afl_env(afl_environment_variables[i]) ? 1 : 0;
+
} else if (!strncmp(env, "AFL_NO_STARTUP_CALIBRATION",
afl_environment_variable_len)) {
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 00d24ab1..329ce942 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -264,6 +264,7 @@ static void usage(u8 *argv0, int more_help) {
"AFL_CYCLE_SCHEDULES: after completing a cycle, switch to a different -p schedule\n"
"AFL_DEBUG: extra debugging output for Python mode trimming\n"
"AFL_DEBUG_CHILD: do not suppress stdout/stderr from target\n"
+ "AFL_DISABLE_REDUNDANT: disable any queue item that is redundant\n"
"AFL_DISABLE_TRIM: disable the trimming of test cases\n"
"AFL_DUMB_FORKSRV: use fork server without feedback from target\n"
"AFL_EXIT_WHEN_DONE: exit when all inputs are run and no new finds are found\n"