Skip to content

Commit b5573b3

Browse files
committed
add seek power schedule, remove update stats in calibration, fix help output
1 parent 15dd4ad commit b5573b3

File tree

8 files changed

+34
-28
lines changed

8 files changed

+34
-28
lines changed

docs/Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ sending a mail to <[email protected]>.
2424
- Ensure that the targets are killed on exit
2525
- fix/update to MOpt (thanks to arnow117)
2626
- added MOpt dictionary support from repo
27+
- added experimental SEEK power schedule. It is EXPLORE with ignoring
28+
the runtime and less focus on the length of the test case
2729
- llvm_mode:
2830
- the default instrumentation is now PCGUARD if the llvm version is >= 7,
2931
as it is faster and provides better coverage. The original afl

docs/power_schedules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ We find that AFL's exploitation-based constant schedule assigns **too much energ
2121
| `-p exploit` (AFL) | ![LIN](http://latex.codecogs.com/gif.latex?p%28i%29%20%3D%20%5Calpha%28i%29) |
2222
| `-p mmopt` | Experimental: `explore` with no weighting to runtime and increased weighting on the last 5 queue entries |
2323
| `-p rare` | Experimental: `rare` puts focus on queue entries that hit rare edges |
24+
| `-p seek` | Experimental: `seek` is EXPLORE but ignoring the runtime of the queue input and less focus on the size |
2425
where *α(i)* is the performance score that AFL uses to compute for the seed input *i*, *β(i)>1* is a constant, *s(i)* is the number of times that seed *i* has been chosen from the queue, *f(i)* is the number of generated inputs that exercise the same path as seed *i*, and *μ* is the average number of generated inputs exercising a path.
2526

2627
More details can be found in the paper that was accepted at the [23rd ACM Conference on Computer and Communications Security (CCS'16)](https://www.sigsac.org/ccs/CCS2016/accepted-papers/).

include/afl-fuzz.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ enum {
233233
/* 05 */ QUAD, /* Quadratic schedule */
234234
/* 06 */ RARE, /* Rare edges */
235235
/* 07 */ MMOPT, /* Modified MOPT schedule */
236+
/* 08 */ SEEK, /* EXPLORE that ignores timings */
236237

237238
POWER_SCHEDULES_NUM
238239

src/afl-fuzz-queue.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) {
201201
else
202202
fuzz_p2 = q->fuzz_level;
203203

204-
if (unlikely(afl->schedule == MMOPT || afl->schedule == RARE) ||
205-
unlikely(afl->fixed_seed)) {
204+
if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) {
206205

207206
fav_factor = q->len << 2;
208207

@@ -228,8 +227,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) {
228227
else
229228
top_rated_fuzz_p2 = afl->top_rated[i]->fuzz_level;
230229

231-
if (unlikely(afl->schedule == MMOPT || afl->schedule == RARE) ||
232-
unlikely(afl->fixed_seed)) {
230+
if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) {
233231

234232
top_rated_fav_factor = afl->top_rated[i]->len << 2;
235233

@@ -250,8 +248,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) {
250248

251249
}
252250

253-
if (unlikely(afl->schedule == MMOPT || afl->schedule == RARE) ||
254-
unlikely(afl->fixed_seed)) {
251+
if (unlikely(afl->schedule >= RARE) || unlikely(afl->fixed_seed)) {
255252

256253
if (fav_factor > afl->top_rated[i]->len << 2) { continue; }
257254

@@ -396,8 +393,7 @@ u32 calculate_score(afl_state_t *afl, struct queue_entry *q) {
396393
// Longer execution time means longer work on the input, the deeper in
397394
// coverage, the better the fuzzing, right? -mh
398395

399-
if (afl->schedule != MMOPT && afl->schedule != RARE &&
400-
likely(!afl->fixed_seed)) {
396+
if (afl->schedule >= RARE && likely(!afl->fixed_seed)) {
401397

402398
if (q->exec_us * 0.1 > avg_exec_us) {
403399

@@ -509,6 +505,9 @@ u32 calculate_score(afl_state_t *afl, struct queue_entry *q) {
509505
case EXPLORE:
510506
break;
511507

508+
case SEEK:
509+
break;
510+
512511
case EXPLOIT:
513512
factor = MAX_FACTOR;
514513
break;

src/afl-fuzz-run.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,6 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
286286

287287
u64 cksum;
288288

289-
if (!first_run && !(afl->stage_cur % afl->stats_update_freq)) {
290-
291-
show_stats(afl);
292-
293-
}
294-
295289
write_to_testcase(afl, use_mem, q->len);
296290

297291
fault = fuzz_run_target(afl, &afl->fsrv, use_tmout);

src/afl-fuzz-state.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ s8 interesting_8[] = {INTERESTING_8};
3030
s16 interesting_16[] = {INTERESTING_8, INTERESTING_16};
3131
s32 interesting_32[] = {INTERESTING_8, INTERESTING_16, INTERESTING_32};
3232

33-
char *power_names[POWER_SCHEDULES_NUM] = {
34-
35-
"explore", "exploit", "fast", "coe", "lin", "quad", "rare", "mmopt"};
33+
char *power_names[POWER_SCHEDULES_NUM] = {"explore", "exploit", "fast",
34+
"coe", "lin", "quad",
35+
"rare", "mmopt", "seek"};
3636

3737
/* Initialize MOpt "globals" for this afl state */
3838

src/afl-fuzz-stats.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ void maybe_update_plot_file(afl_state_t *afl, double bitmap_cvg, double eps) {
194194
afl->plot_prev_uc == afl->unique_crashes &&
195195
afl->plot_prev_uh == afl->unique_hangs &&
196196
afl->plot_prev_md == afl->max_depth) ||
197-
unlikely(!afl->queue_cycle) || unlikely(get_cur_time() - afl->start_time <= 60)) {
197+
unlikely(!afl->queue_cycle) ||
198+
unlikely(get_cur_time() - afl->start_time <= 60)) {
198199

199200
return;
200201

src/afl-fuzz.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,13 @@ static void usage(afl_state_t *afl, u8 *argv0, int more_help) {
115115
" -o dir - output directory for fuzzer findings\n\n"
116116

117117
"Execution control settings:\n"
118-
" -p schedule - power schedules recompute a seed's performance "
119-
"score.\n"
120-
" <explore(default), fast, coe, lin, quad, exploit, "
121-
"mmopt, rare>\n"
118+
" -p schedule - power schedules compute a seed's performance score. "
119+
"<explore\n"
120+
" (default), fast, coe, lin, quad, exploit, mmopt, "
121+
"rare, seek>\n"
122122
" see docs/power_schedules.md\n"
123-
" -f file - location read by the fuzzed program (stdin)\n"
123+
" -f file - location read by the fuzzed program (default: stdin "
124+
"or @@)\n"
124125
" -t msec - timeout for each run (auto-scaled, 50-%d ms)\n"
125126
" -m megs - memory limit for child process (%d MB)\n"
126127
" -Q - use binary-only instrumentation (QEMU mode)\n"
@@ -146,7 +147,7 @@ static void usage(afl_state_t *afl, u8 *argv0, int more_help) {
146147
"devices etc.!)\n"
147148
" -d - quick & dirty mode (skips deterministic steps)\n"
148149
" -n - fuzz without instrumentation (non-instrumented mode)\n"
149-
" -x dir - optional fuzzer dictionary (see README.md, its really "
150+
" -x dict_file - optional fuzzer dictionary (see README.md, its really "
150151
"good!)\n\n"
151152

152153
"Testing settings:\n"
@@ -164,11 +165,11 @@ static void usage(afl_state_t *afl, u8 *argv0, int more_help) {
164165
"fuzzing\n"
165166
" -I command - execute this command/script when a new crash is "
166167
"found\n"
167-
" -B bitmap.txt - mutate a specific test case, use the out/fuzz_bitmap "
168-
"file\n"
168+
//" -B bitmap.txt - mutate a specific test case, use the out/fuzz_bitmap
169+
//" "file\n"
169170
" -C - crash exploration mode (the peruvian rabbit thing)\n"
170-
" -e ext - file extension for the temporarily generated test "
171-
"case\n\n",
171+
" -e ext - file extension for the fuzz test case case (if "
172+
"needed)\n\n",
172173
argv0, EXEC_TIMEOUT, MEM_LIMIT);
173174

174175
if (more_help > 1) {
@@ -349,6 +350,10 @@ int main(int argc, char **argv_orig, char **envp) {
349350

350351
afl->schedule = RARE;
351352

353+
} else if (!stricmp(optarg, "seek")) {
354+
355+
afl->schedule = SEEK;
356+
352357
} else if (!stricmp(optarg, "explore") || !stricmp(optarg, "default") ||
353358

354359
!stricmp(optarg, "normal") || !stricmp(optarg, "afl")) {
@@ -954,6 +959,9 @@ int main(int argc, char **argv_orig, char **envp) {
954959
case RARE:
955960
OKF("Using rare edge focus power schedule (RARE)");
956961
break;
962+
case SEEK:
963+
OKF("Using seek power schedule (SEEK)");
964+
break;
957965
case EXPLORE:
958966
OKF("Using exploration-based constant power schedule (EXPLORE, default)");
959967
break;

0 commit comments

Comments
 (0)