Skip to content

Commit 8ab2520

Browse files
committed
a mandatory revert
1 parent 1c7d2b3 commit 8ab2520

File tree

183 files changed

+19470
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+19470
-48
lines changed

Makefile

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
#
2+
# american fuzzy lop - makefile
3+
# -----------------------------
4+
#
5+
# Written and maintained by Michal Zalewski <[email protected]>
6+
#
7+
# Copyright 2013, 2014, 2015, 2016, 2017 Google Inc. All rights reserved.
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License");
10+
# you may not use this file except in compliance with the License.
11+
# You may obtain a copy of the License at:
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
16+
PROGNAME = afl
17+
VERSION = $(shell grep '^\#define VERSION ' config.h | cut -d '"' -f2)
18+
19+
PREFIX ?= /usr/local
20+
BIN_PATH = $(PREFIX)/bin
21+
HELPER_PATH = $(PREFIX)/lib/afl
22+
DOC_PATH = $(PREFIX)/share/doc/afl
23+
MISC_PATH = $(PREFIX)/share/afl
24+
25+
# PROGS intentionally omit afl-as, which gets installed elsewhere.
26+
27+
PROGS = afl-gcc afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze
28+
SH_PROGS = afl-plot afl-cmin afl-whatsup
29+
30+
CFLAGS ?= -O3 -funroll-loops
31+
CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \
32+
-DAFL_PATH=\"$(HELPER_PATH)\" -DDOC_PATH=\"$(DOC_PATH)\" \
33+
-DBIN_PATH=\"$(BIN_PATH)\"
34+
35+
ifneq "$(filter Linux GNU%,$(shell uname))" ""
36+
LDFLAGS += -ldl
37+
endif
38+
39+
ifeq "$(findstring clang, $(shell $(CC) --version 2>/dev/null))" ""
40+
TEST_CC = afl-gcc
41+
else
42+
TEST_CC = afl-clang
43+
endif
44+
45+
COMM_HDR = alloc-inl.h config.h debug.h types.h
46+
47+
all: test_x86 $(PROGS) afl-as test_build all_done
48+
49+
ifndef AFL_NO_X86
50+
51+
test_x86:
52+
@echo "[*] Checking for the ability to compile x86 code..."
53+
@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 "Don't panic! You can use the LLVM or QEMU mode, but see docs/INSTALL first."; echo "(To ignore this error, set AFL_NO_X86=1 and try again.)"; echo; exit 1 )
54+
@rm -f .test
55+
@echo "[+] Everything seems to be working, ready to compile."
56+
57+
else
58+
59+
test_x86:
60+
@echo "[!] Note: skipping x86 compilation checks (AFL_NO_X86 set)."
61+
62+
endif
63+
64+
afl-gcc: afl-gcc.c $(COMM_HDR) | test_x86
65+
$(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
66+
set -e; for i in afl-g++ afl-clang afl-clang++; do ln -sf afl-gcc $$i; done
67+
68+
afl-as: afl-as.c afl-as.h $(COMM_HDR) | test_x86
69+
$(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
70+
ln -sf afl-as as
71+
72+
afl-fuzz: afl-fuzz.c $(COMM_HDR) | test_x86
73+
$(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
74+
75+
afl-showmap: afl-showmap.c $(COMM_HDR) | test_x86
76+
$(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
77+
78+
afl-tmin: afl-tmin.c $(COMM_HDR) | test_x86
79+
$(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
80+
81+
afl-analyze: afl-analyze.c $(COMM_HDR) | test_x86
82+
$(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
83+
84+
afl-gotcpu: afl-gotcpu.c $(COMM_HDR) | test_x86
85+
$(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
86+
87+
ifndef AFL_NO_X86
88+
89+
test_build: afl-gcc afl-as afl-showmap
90+
@echo "[*] Testing the CC wrapper and instrumentation output..."
91+
unset AFL_USE_ASAN AFL_USE_MSAN; AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. ./$(TEST_CC) $(CFLAGS) test-instr.c -o test-instr $(LDFLAGS)
92+
echo 0 | ./afl-showmap -m none -q -o .test-instr0 ./test-instr
93+
echo 1 | ./afl-showmap -m none -q -o .test-instr1 ./test-instr
94+
@rm -f test-instr
95+
@cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation does not seem to be behaving correctly!"; echo; echo "Please ping <[email protected]> to troubleshoot the issue."; echo; exit 1; fi
96+
@echo "[+] All right, the instrumentation seems to be working!"
97+
98+
else
99+
100+
test_build: afl-gcc afl-as afl-showmap
101+
@echo "[!] Note: skipping build tests (you may need to use LLVM or QEMU mode)."
102+
103+
endif
104+
105+
all_done: test_build
106+
@if [ ! "`which clang 2>/dev/null`" = "" ]; then echo "[+] LLVM users: see llvm_mode/README.llvm for a faster alternative to afl-gcc."; fi
107+
@echo "[+] All done! Be sure to review README - it's pretty short and useful."
108+
@if [ "`uname`" = "Darwin" ]; then printf "\nWARNING: Fuzzing on MacOS X is slow because of the unusually high overhead of\nfork() on this OS. Consider using Linux or *BSD. You can also use VirtualBox\n(virtualbox.org) to put AFL inside a Linux or *BSD VM.\n\n"; fi
109+
@! tty <&1 >/dev/null || printf "\033[0;30mNOTE: If you can read this, your terminal probably uses white background.\nThis will make the UI hard to read. See docs/status_screen.txt for advice.\033[0m\n" 2>/dev/null
110+
111+
.NOTPARALLEL: clean
112+
113+
clean:
114+
rm -f $(PROGS) afl-as as afl-g++ afl-clang afl-clang++ *.o *~ a.out core core.[1-9][0-9]* *.stackdump test .test test-instr .test-instr0 .test-instr1 qemu_mode/qemu-2.10.0.tar.bz2 afl-qemu-trace
115+
rm -rf out_dir qemu_mode/qemu-2.10.0
116+
$(MAKE) -C llvm_mode clean
117+
$(MAKE) -C libdislocator clean
118+
$(MAKE) -C libtokencap clean
119+
120+
install: all
121+
mkdir -p -m 755 $${DESTDIR}$(BIN_PATH) $${DESTDIR}$(HELPER_PATH) $${DESTDIR}$(DOC_PATH) $${DESTDIR}$(MISC_PATH)
122+
rm -f $${DESTDIR}$(BIN_PATH)/afl-plot.sh
123+
install -m 755 $(PROGS) $(SH_PROGS) $${DESTDIR}$(BIN_PATH)
124+
rm -f $${DESTDIR}$(BIN_PATH)/afl-as
125+
if [ -f afl-qemu-trace ]; then install -m 755 afl-qemu-trace $${DESTDIR}$(BIN_PATH); fi
126+
ifndef AFL_TRACE_PC
127+
if [ -f afl-clang-fast -a -f afl-llvm-pass.so -a -f afl-llvm-rt.o ]; then set -e; install -m 755 afl-clang-fast $${DESTDIR}$(BIN_PATH); ln -sf afl-clang-fast $${DESTDIR}$(BIN_PATH)/afl-clang-fast++; install -m 755 afl-llvm-pass.so afl-llvm-rt.o $${DESTDIR}$(HELPER_PATH); fi
128+
else
129+
if [ -f afl-clang-fast -a -f afl-llvm-rt.o ]; then set -e; install -m 755 afl-clang-fast $${DESTDIR}$(BIN_PATH); ln -sf afl-clang-fast $${DESTDIR}$(BIN_PATH)/afl-clang-fast++; install -m 755 afl-llvm-rt.o $${DESTDIR}$(HELPER_PATH); fi
130+
endif
131+
if [ -f afl-llvm-rt-32.o ]; then set -e; install -m 755 afl-llvm-rt-32.o $${DESTDIR}$(HELPER_PATH); fi
132+
if [ -f afl-llvm-rt-64.o ]; then set -e; install -m 755 afl-llvm-rt-64.o $${DESTDIR}$(HELPER_PATH); fi
133+
set -e; for i in afl-g++ afl-clang afl-clang++; do ln -sf afl-gcc $${DESTDIR}$(BIN_PATH)/$$i; done
134+
install -m 755 afl-as $${DESTDIR}$(HELPER_PATH)
135+
ln -sf afl-as $${DESTDIR}$(HELPER_PATH)/as
136+
install -m 644 docs/README docs/ChangeLog docs/*.txt $${DESTDIR}$(DOC_PATH)
137+
cp -r testcases/ $${DESTDIR}$(MISC_PATH)
138+
cp -r dictionaries/ $${DESTDIR}$(MISC_PATH)
139+
140+
publish: clean
141+
test "`basename $$PWD`" = "afl" || exit 1
142+
test -f ~/www/afl/releases/$(PROGNAME)-$(VERSION).tgz; if [ "$$?" = "0" ]; then echo; echo "Change program version in config.h, mmkay?"; echo; exit 1; fi
143+
cd ..; rm -rf $(PROGNAME)-$(VERSION); cp -pr $(PROGNAME) $(PROGNAME)-$(VERSION); \
144+
tar -cvz -f ~/www/afl/releases/$(PROGNAME)-$(VERSION).tgz $(PROGNAME)-$(VERSION)
145+
chmod 644 ~/www/afl/releases/$(PROGNAME)-$(VERSION).tgz
146+
( cd ~/www/afl/releases/; ln -s -f $(PROGNAME)-$(VERSION).tgz $(PROGNAME)-latest.tgz )
147+
cat docs/README >~/www/afl/README.txt
148+
cat docs/status_screen.txt >~/www/afl/status_screen.txt
149+
cat docs/historical_notes.txt >~/www/afl/historical_notes.txt
150+
cat docs/technical_details.txt >~/www/afl/technical_details.txt
151+
cat docs/ChangeLog >~/www/afl/ChangeLog.txt
152+
cat docs/QuickStartGuide.txt >~/www/afl/QuickStartGuide.txt
153+
echo -n "$(VERSION)" >~/www/afl/version.txt

QuickStartGuide.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/QuickStartGuide.txt

README

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/README

0 commit comments

Comments
 (0)