Skip to content

Commit

Permalink
2.03b
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarpenter committed Feb 21, 2016
1 parent 4f48155 commit 48f1f8b
Show file tree
Hide file tree
Showing 19 changed files with 311 additions and 68 deletions.
12 changes: 6 additions & 6 deletions Makefile
Expand Up @@ -4,7 +4,7 @@
#
# Written and maintained by Michal Zalewski <lcamtuf@google.com>
#
# Copyright 2013, 2014, 2015 Google Inc. All rights reserved.
# Copyright 2013, 2014, 2015, 2016 Google Inc. 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.
Expand All @@ -14,7 +14,7 @@
#

PROGNAME = afl
VERSION = 2.02b
VERSION = 2.03b

PREFIX ?= /usr/local
BIN_PATH = $(PREFIX)/bin
Expand Down Expand Up @@ -46,18 +46,18 @@ COMM_HDR = alloc-inl.h config.h debug.h types.h

all: test_x86 $(PROGS) afl-as test_build all_done

ifndef AFL_NOX86
ifndef AFL_NO_X86

test_x86:
@echo "[*] Checking for the ability to compile x86 code..."
@echo 'main() { __asm__("xorb %al, %al"); }' | $(CC) -w -x c - -o .test || ( echo; echo "Oops, looks like your compiler can't generate x86 code."; echo; echo "You can still try using the LLVM or QEMU mode, but see docs/INSTALL first."; echo "To ignore this error, set AFL_NOX86=1."; echo; exit 1 )
@echo 'main() { __asm__("xorb %al, %al"); }' | $(CC) -w -x c - -o .test || ( echo; echo "Oops, looks like your compiler can't generate x86 code."; echo; echo "You can still try using the LLVM or QEMU mode, but see docs/INSTALL first."; echo "To ignore this error, set AFL_NO_X86=1."; echo; exit 1 )
@rm -f .test
@echo "[+] Everything seems to be working, ready to compile."

else

test_x86:
@echo "[!] Note: skipping x86 compilation checks (AFL_NOX86 set)."
@echo "[!] Note: skipping x86 compilation checks (AFL_NO_X86 set)."

endif

Expand All @@ -84,7 +84,7 @@ afl-analyze: afl-analyze.c $(COMM_HDR) | test_x86
afl-gotcpu: afl-gotcpu.c $(COMM_HDR) | test_x86
$(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)

ifndef AFL_NOX86
ifndef AFL_NO_X86

test_build: afl-gcc afl-as afl-showmap
@echo "[*] Testing the CC wrapper and instrumentation output..."
Expand Down
31 changes: 25 additions & 6 deletions afl-analyze.c
Expand Up @@ -677,22 +677,41 @@ static void set_up_environment(void) {

x = getenv("ASAN_OPTIONS");

if (x && !strstr(x, "abort_on_error=1"))
FATAL("Custom ASAN_OPTIONS set without abort_on_error=1 - please fix!");
if (x) {

if (!strstr(x, "abort_on_error=1"))
FATAL("Custom ASAN_OPTIONS set without abort_on_error=1 - please fix!");

if (!strstr(x, "symbolize=0"))
FATAL("Custom ASAN_OPTIONS set without symbolize=0 - please fix!");

}

x = getenv("MSAN_OPTIONS");

if (x && !strstr(x, "exit_code=" STRINGIFY(MSAN_ERROR)))
FATAL("Custom MSAN_OPTIONS set without exit_code="
STRINGIFY(MSAN_ERROR) " - please fix!");
if (x) {

if (!strstr(x, "exit_code=" STRINGIFY(MSAN_ERROR)))
FATAL("Custom MSAN_OPTIONS set without exit_code="
STRINGIFY(MSAN_ERROR) " - please fix!");

if (!strstr(x, "symbolize=0"))
FATAL("Custom MSAN_OPTIONS set without symbolize=0 - please fix!");

}

setenv("ASAN_OPTIONS", "abort_on_error=1:"
"detect_leaks=0:"
"symbolize=0:"
"allocator_may_return_null=1", 0);

setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"msan_track_origins=0", 0);

if (getenv("AFL_LD_PRELOAD"))
setenv("LD_PRELOAD", getenv("AFL_LD_PRELOAD"), 1);

}


Expand Down Expand Up @@ -773,7 +792,7 @@ static void usage(u8* argv0) {

"Required parameters:\n\n"

" -i file - input test case to be shrunk by the tool\n"
" -i file - input test case to be analyzed by the tool\n"

"Execution control settings:\n\n"

Expand Down
40 changes: 32 additions & 8 deletions afl-fuzz.c
Expand Up @@ -6,7 +6,7 @@
Forkserver design by Jann Horn <jannhorn@googlemail.com>
Copyright 2013, 2014, 2015 Google Inc. All rights reserved.
Copyright 2013, 2014, 2015, 2016 Google Inc. 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.
Expand Down Expand Up @@ -1934,12 +1934,14 @@ static void init_forkserver(char** argv) {

setenv("ASAN_OPTIONS", "abort_on_error=1:"
"detect_leaks=0:"
"symbolize=0:"
"allocator_may_return_null=1", 0);

/* MSAN is tricky, because it doesn't support abort_on_error=1 at this
point. So, we do this in a very hacky way. */

setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"msan_track_origins=0", 0);

execv(target_path, argv);
Expand Down Expand Up @@ -2197,9 +2199,11 @@ static u8 run_target(char** argv) {

setenv("ASAN_OPTIONS", "abort_on_error=1:"
"detect_leaks=0:"
"symbolize=0:"
"allocator_may_return_null=1", 0);

setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"msan_track_origins=0", 0);

execv(target_path, argv);
Expand Down Expand Up @@ -7155,14 +7159,28 @@ static void handle_resize(int sig) {
static void check_asan_opts(void) {
u8* x = getenv("ASAN_OPTIONS");

if (x && !strstr(x, "abort_on_error=1"))
FATAL("Custom ASAN_OPTIONS set without abort_on_error=1 - please fix!");
if (x) {

if (!strstr(x, "abort_on_error=1"))
FATAL("Custom ASAN_OPTIONS set without abort_on_error=1 - please fix!");

if (!strstr(x, "symbolize=0"))
FATAL("Custom ASAN_OPTIONS set without symbolize=0 - please fix!");

}

x = getenv("MSAN_OPTIONS");

if (x && !strstr(x, "exit_code=" STRINGIFY(MSAN_ERROR)))
FATAL("Custom MSAN_OPTIONS set without exit_code="
STRINGIFY(MSAN_ERROR) " - please fix!");
if (x) {

if (!strstr(x, "exit_code=" STRINGIFY(MSAN_ERROR)))
FATAL("Custom MSAN_OPTIONS set without exit_code="
STRINGIFY(MSAN_ERROR) " - please fix!");

if (!strstr(x, "symbolize=0"))
FATAL("Custom MSAN_OPTIONS set without symbolize=0 - please fix!");

}

}

Expand Down Expand Up @@ -7365,6 +7383,7 @@ int main(int argc, char** argv) {
u32 sync_interval_cnt = 0, seek_to;
u8 *extras_dir = 0;
u8 mem_limit_given = 0;
u8 exit_1 = !!getenv("AFL_BENCH_JUST_ONE");

char** use_argv;

Expand Down Expand Up @@ -7553,6 +7572,9 @@ int main(int argc, char** argv) {
if (dumb_mode == 2 && no_forkserver)
FATAL("AFL_DUMB_FORKSRV and AFL_NO_FORKSRV are mutually exclusive");

if (getenv("AFL_LD_PRELOAD"))
setenv("LD_PRELOAD", getenv("AFL_LD_PRELOAD"), 1);

save_cmdline(argc, argv);

fix_up_banner(argv[optind]);
Expand Down Expand Up @@ -7661,6 +7683,8 @@ int main(int argc, char** argv) {

}

if (!stop_soon && exit_1) stop_soon = 2;

if (stop_soon) break;

queue_cur = queue_cur->next;
Expand All @@ -7676,8 +7700,8 @@ int main(int argc, char** argv) {

stop_fuzzing:

SAYF(CURSOR_SHOW cLRD "\n\n+++ Testing %s +++\n" cRST,
stop_soon == 2 ? "ended via AFL_EXIT_WHEN_DONE" : "aborted by user");
SAYF(CURSOR_SHOW cLRD "\n\n+++ Testing aborted %s +++\n" cRST,
stop_soon == 2 ? "programatically" : "by user");

/* Running for more than 30 minutes but still doing first cycle? */

Expand Down
7 changes: 6 additions & 1 deletion afl-showmap.c
Expand Up @@ -4,7 +4,7 @@
Written and maintained by Michal Zalewski <lcamtuf@google.com>
Copyright 2013, 2014, 2015 Google Inc. All rights reserved.
Copyright 2013, 2014, 2015, 2016 Google Inc. 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.
Expand Down Expand Up @@ -332,11 +332,16 @@ static void set_up_environment(void) {

setenv("ASAN_OPTIONS", "abort_on_error=1:"
"detect_leaks=0:"
"symbolize=0:"
"allocator_may_return_null=1", 0);

setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"msan_track_origins=0", 0);

if (getenv("AFL_LD_PRELOAD"))
setenv("LD_PRELOAD", getenv("AFL_LD_PRELOAD"), 1);

}


Expand Down
31 changes: 25 additions & 6 deletions afl-tmin.c
Expand Up @@ -4,7 +4,7 @@
Written and maintained by Michal Zalewski <lcamtuf@google.com>
Copyright 2015 Google Inc. All rights reserved.
Copyright 2015, 2016 Google Inc. 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.
Expand Down Expand Up @@ -668,22 +668,41 @@ static void set_up_environment(void) {

x = getenv("ASAN_OPTIONS");

if (x && !strstr(x, "abort_on_error=1"))
FATAL("Custom ASAN_OPTIONS set without abort_on_error=1 - please fix!");
if (x) {

if (!strstr(x, "abort_on_error=1"))
FATAL("Custom ASAN_OPTIONS set without abort_on_error=1 - please fix!");

if (!strstr(x, "symbolize=0"))
FATAL("Custom ASAN_OPTIONS set without symbolize=0 - please fix!");

}

x = getenv("MSAN_OPTIONS");

if (x && !strstr(x, "exit_code=" STRINGIFY(MSAN_ERROR)))
FATAL("Custom MSAN_OPTIONS set without exit_code="
STRINGIFY(MSAN_ERROR) " - please fix!");
if (x) {

if (!strstr(x, "exit_code=" STRINGIFY(MSAN_ERROR)))
FATAL("Custom MSAN_OPTIONS set without exit_code="
STRINGIFY(MSAN_ERROR) " - please fix!");

if (!strstr(x, "symbolize=0"))
FATAL("Custom MSAN_OPTIONS set without symbolize=0 - please fix!");

}

setenv("ASAN_OPTIONS", "abort_on_error=1:"
"detect_leaks=0:"
"symbolize=0:"
"allocator_may_return_null=1", 0);

setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:"
"msan_track_origins=0", 0);

if (getenv("AFL_LD_PRELOAD"))
setenv("LD_PRELOAD", getenv("AFL_LD_PRELOAD"), 1);

}


Expand Down
2 changes: 1 addition & 1 deletion config.h
Expand Up @@ -4,7 +4,7 @@
Written and maintained by Michal Zalewski <lcamtuf@google.com>
Copyright 2013, 2014, 2015 Google Inc. All rights reserved.
Copyright 2013, 2014, 2015, 2016 Google Inc. 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.
Expand Down
2 changes: 1 addition & 1 deletion debug.h
Expand Up @@ -4,7 +4,7 @@
Written and maintained by Michal Zalewski <lcamtuf@google.com>
Copyright 2013, 2014, 2015 Google Inc. All rights reserved.
Copyright 2013, 2014, 2015, 2016 Google Inc. 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.
Expand Down
26 changes: 25 additions & 1 deletion docs/ChangeLog
Expand Up @@ -13,9 +13,33 @@ Want to stay in the loop on major new features? Join our mailing list by
sending a mail to <afl-users+subscribe@googlegroups.com>.

Not sure if you should upgrade? The lowest currently recommended version
is 1.92b. If you're stuck on an earlier release, it's strongly advisable
is 2.03b. If you're stuck on an earlier release, it's strongly advisable
to get on with the times.

--------------
Version 2.03b:
--------------

- Added experimental -fsanitize-coverage=trace-pc support that goes with
some recent additions to LLVM, as implemented by Kostya Serebryany.
Right now, this is cumbersome to use with common build systems, so
the mode remains undocumented.

- Made several substantial improvements to better support non-standard
map sizes in LLVM mode.

- Switched LLVM mode to thread-local execution tracing, which may offer
better results in some multithreaded apps.

- Fixed a minor typo, reported by Heiko Eissfeldt.

- Force-disabled symbolization for ASAN, as suggested by Christian Holler.

- AFL_NOX86 renamed to AFL_NO_X86 for consistency.

- Added AFL_LD_PRELOAD to allow LD_PRELOAD to be set for targets without
affecting AFL itself. Suggested by Daniel Godas-Lopez.

--------------
Version 2.02b:
--------------
Expand Down
2 changes: 1 addition & 1 deletion docs/INSTALL
Expand Up @@ -110,7 +110,7 @@ leverage two other options:
- The QEMU mode (see qemu_mode/README.qemu), which can be also used for
fuzzing cross-platform binaries.

In both cases, you will need to set AFL_NOX86=1 before running make or gmake.
In both cases, you will need to set AFL_NO_X86=1 before running make or gmake.

5) Solaris on x86
-----------------
Expand Down
1 change: 1 addition & 0 deletions docs/README
Expand Up @@ -433,6 +433,7 @@ bug reports, or patches from:
Jacek Wielemborek Leo Barnes
Jeremy Barnes Jeff Trull
Guillaume Endignoux ilovezfs
Daniel Godas-Lopez

Thank you!

Expand Down
10 changes: 9 additions & 1 deletion docs/env_variables.txt
Expand Up @@ -139,9 +139,15 @@ checks or alter some of the more exotic semantics of the tool:

- In QEMU mode (-Q), AFL_PATH will be searched for afl-qemu-trace.

- Setting AFL_LD_PRELOAD causes AFL to set LD_PRELOAD for the target binary
without disrupting the afl-fuzz process itself.

- If you are Jakub, you may need AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES.
Others need not apply.

- Benchmarking only: AFL_BENCH_JUST_ONE causes the fuzzer to exit after
processing the first queue entry.

4) Settings for afl-qemu-trace
------------------------------

Expand Down Expand Up @@ -192,11 +198,13 @@ optimal values if not already present in the environment:

abort_on_error=1
detect_leaks=0
symbolize=0
allocator_may_return_null=1

If you want to set your own options, be sure to include abort_on_error=1 -
otherwise, the fuzzer will not be able to detect crashes in the tested
app.
app. Similarly, include symbolize=0, since without it, AFL may have
difficulty telling crashes and hangs apart.

- In the same vein, by default, MSAN_OPTIONS are set to:

Expand Down

0 comments on commit 48f1f8b

Please sign in to comment.