Skip to content

Commit 0278eb5

Browse files
Merge pull request AFLplusplus#2259 from AFLplusplus/removeoutdated
Remove outdated afl-gcc/afl-clang
2 parents ad2eaf5 + 8e88ef0 commit 0278eb5

22 files changed

+95
-1789
lines changed

GNUmakefile

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ INCLUDE_PATH = $(PREFIX)/include/afl
3030
PROGNAME = afl
3131
VERSION = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f2)
3232

33-
# PROGS intentionally omit afl-as, which gets installed elsewhere.
34-
3533
PROGS = afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze
3634
SH_PROGS = afl-plot afl-cmin afl-cmin.bash afl-whatsup afl-addseeds afl-system-config afl-persistent-config afl-cc
37-
HEADERS = include/afl-as.h include/afl-fuzz.h include/afl-mutations.h include/afl-persistent-replay.h include/afl-prealloc.h include/afl-record-compat.h include/alloc-inl.h include/android-ashmem.h include/cmplog.h include/common.h include/config.h include/coverage-32.h include/coverage-64.h include/debug.h include/envs.h include/forkserver.h include/hash.h include/list.h include/sharedmem.h include/snapshot-inl.h include/t1ha.h include/t1ha0_ia32aes_b.h include/t1ha_bits.h include/t1ha_selfcheck.h include/types.h include/xxhash.h
38-
MANPAGES=$(foreach p, $(PROGS) $(SH_PROGS), $(p).8) afl-as.8
35+
HEADERS = include/afl-fuzz.h include/afl-mutations.h include/afl-persistent-replay.h include/afl-prealloc.h include/afl-record-compat.h include/alloc-inl.h include/android-ashmem.h include/cmplog.h include/common.h include/config.h include/coverage-32.h include/coverage-64.h include/debug.h include/envs.h include/forkserver.h include/hash.h include/list.h include/sharedmem.h include/snapshot-inl.h include/t1ha.h include/t1ha0_ia32aes_b.h include/t1ha_bits.h include/t1ha_selfcheck.h include/types.h include/xxhash.h
36+
MANPAGES=$(foreach p, $(PROGS) $(SH_PROGS), $(p).8)
3937
ASAN_OPTIONS=detect_leaks=0
4038

4139
SYS = $(shell uname -s)
@@ -327,10 +325,12 @@ ifdef TEST_MMAP
327325
endif
328326

329327
.PHONY: all
330-
all: test_x86 test_shm test_python ready $(PROGS) afl-as llvm gcc_plugin test_build all_done
328+
all: test_x86 test_shm test_python ready $(PROGS) llvm gcc_plugin test_build all_done
331329
-$(MAKE) -C utils/aflpp_driver
332330
@echo
333331
@echo
332+
@echo
333+
@echo
334334
@echo Build Summary:
335335
@test -e afl-fuzz && echo "[+] afl-fuzz and supporting tools successfully built" || echo "[-] afl-fuzz could not be built, please set CC to a working compiler"
336336
@test -e afl-llvm-pass.so && echo "[+] LLVM basic mode successfully built" || echo "[-] LLVM mode could not be built, please install at least llvm-11 and clang-11 or newer, see docs/INSTALL.md"
@@ -339,6 +339,7 @@ all: test_x86 test_shm test_python ready $(PROGS) afl-as llvm gcc_plugin test_bu
339339
ifneq "$(SYS)" "Darwin"
340340
@test -e afl-gcc-pass.so && echo "[+] gcc_mode successfully built" || echo "[-] gcc_mode could not be built, it is optional, install gcc-VERSION-plugin-dev to enable this"
341341
endif
342+
@test -e afl-cc || echo "[-] AFL++ instrumentation compilers could not be built! Install llvm-VERSION-dev or gcc-VERSION-plugin-dev, see docs/INSTALL.md!"
342343
@echo
343344

344345
.PHONY: llvm
@@ -465,10 +466,6 @@ endif
465466
ready:
466467
@echo "[+] Everything seems to be working, ready to compile. ($(shell $(CC) --version 2>&1|head -n 1))"
467468

468-
afl-as: src/afl-as.c include/afl-as.h $(COMM_HDR) | test_x86
469-
$(CC) $(CFLAGS) src/$@.c -o $@ $(LDFLAGS)
470-
@ln -sf afl-as as
471-
472469
src/afl-performance.o : $(COMM_HDR) src/afl-performance.c include/hash.h
473470
$(CC) $(CFLAGS) $(CFLAGS_OPT) $(SPECIAL_PERFORMANCE) -Iinclude -c src/afl-performance.c -o src/afl-performance.o
474471

@@ -576,7 +573,7 @@ code-format:
576573

577574
.PHONY: test_build
578575
ifndef AFL_NO_X86
579-
test_build: afl-cc afl-gcc afl-as afl-showmap
576+
test_build: afl-cc afl-showmap
580577
@echo "[*] Testing the CC wrapper afl-cc and its instrumentation output..."
581578
@unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_LSAN AFL_USE_ASAN AFL_USE_MSAN AFL_LLVM_ALLOWLIST AFL_LLVM_DENYLIST; ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-cc test-instr.c $(LDFLAGS) -o test-instr 2>&1 || (echo "Oops, afl-cc failed"; exit 1 )
582579
-ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -q -m none -o .test-instr0 ./test-instr < /dev/null
@@ -585,18 +582,18 @@ test_build: afl-cc afl-gcc afl-as afl-showmap
585582
@cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation of afl-cc does not seem to be behaving correctly!"; echo; echo "Please post to https://github.com/AFLplusplus/AFLplusplus/issues to troubleshoot the issue."; echo; exit 1; fi
586583
@echo
587584
@echo "[+] All right, the instrumentation of afl-cc seems to be working!"
588-
# @echo "[*] Testing the CC wrapper afl-gcc and its instrumentation output..."
589-
# @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_LSAN AFL_USE_ASAN AFL_USE_MSAN; AFL_CC=$(CC) ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-gcc test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-gcc failed"; exit 1 )
585+
# @echo "[*] Testing the CC wrapper and its instrumentation output..."
586+
# @unset AFL_MAP_SIZE AFL_USE_UBSAN AFL_USE_CFISAN AFL_USE_LSAN AFL_USE_ASAN AFL_USE_MSAN; AFL_CC=$(CC) ASAN_OPTIONS=detect_leaks=0 AFL_INST_RATIO=100 AFL_PATH=. ./afl-clang-fast test-instr.c -o test-instr 2>&1 || (echo "Oops, afl-clang-fast failed"; exit 1 )
590587
# ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
591588
# echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
592589
# @rm -f test-instr
593-
# @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation of afl-gcc does not seem to be behaving correctly!"; \
590+
# @cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ]; then echo; echo "Oops, the instrumentation of afl-clang-fast does not seem to be behaving correctly!"; \
594591
# gcc -v 2>&1 | grep -q -- --with-as= && ( echo; echo "Gcc is configured not to use an external assembler with the -B option." ) || \
595592
# ( echo; echo "Please post to https://github.com/AFLplusplus/AFLplusplus/issues to troubleshoot the issue." ); echo; exit 0; fi
596593
# @echo
597-
# @echo "[+] All right, the instrumentation of afl-gcc seems to be working!"
594+
# @echo "[+] All right, the instrumentation of afl-clang-fast seems to be working!"
598595
else
599-
test_build: afl-cc afl-as afl-showmap
596+
test_build: afl-cc afl-showmap
600597
@echo "[!] Note: skipping build tests (you may need to use LLVM or QEMU mode)."
601598
endif
602599

@@ -606,15 +603,16 @@ all_done: test_build
606603
@test -e cmplog-instructions-pass.so && echo "[+] LLVM mode for 'afl-cc' successfully built!" || echo "[-] LLVM mode for 'afl-cc' failed to build, likely you either don't have llvm installed, or you need to set LLVM_CONFIG, to point to e.g. llvm-config-11. See instrumentation/README.llvm.md how to do this. Highly recommended!"
607604
@test -e SanitizerCoverageLTO.so && echo "[+] LLVM LTO mode for 'afl-cc' successfully built!" || echo "[-] LLVM LTO mode for 'afl-cc' failed to build, this would need LLVM 11+, see instrumentation/README.lto.md how to build it"
608605
@test -e afl-gcc-pass.so && echo "[+] gcc_plugin for 'afl-cc' successfully built!" || echo "[-] gcc_plugin for 'afl-cc' failed to build, unless you really need it that is fine - or read instrumentation/README.gcc_plugin.md how to build it"
609-
@echo "[+] All done! Be sure to review the README.md - it's pretty short and useful."
606+
@test -e afl-cc && echo "[+] All done! Be sure to review the README.md - it's pretty short and useful."
607+
@test -e afl-cc || echo "[-] ERROR - neither afl-clang-fast or afl-gcc-fast could be compiled - YOU ARE MISSING PACKAGES! Read docs/INSTALL.md!"
610608
@if [ "$(SYS)" = "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 for fuzzing software not\nspecifically for MacOS.\n\n"; fi
611609
@! 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.md for advice.\033[0m\n" 2>/dev/null
612610

613611
.NOTPARALLEL: clean all
614612

615613
.PHONY: clean
616614
clean:
617-
rm -rf $(PROGS) afl-fuzz-document afl-as as afl-g++ afl-clang afl-clang++ *.o src/*.o *~ a.out core core.[1-9][0-9]* *.stackdump .test .test1 .test2 test-instr .test-instr0 .test-instr1 afl-cs-proxy afl-qemu-trace afl-gcc-fast afl-g++-fast ld *.so *.8 test/unittests/*.o test/unittests/unit_maybe_alloc test/unittests/preallocable .afl-* afl-gcc afl-g++ afl-clang afl-clang++ test/unittests/unit_hash test/unittests/unit_rand *.dSYM lib*.a
615+
rm -rf $(PROGS) afl-fuzz-document as afl-g++ afl-clang afl-clang++ *.o src/*.o *~ a.out core core.[1-9][0-9]* *.stackdump .test .test1 .test2 test-instr .test-instr0 .test-instr1 afl-cs-proxy afl-qemu-trace afl-gcc-fast afl-g++-fast ld *.so *.8 test/unittests/*.o test/unittests/unit_maybe_alloc test/unittests/preallocable .afl-* afl-gcc afl-g++ afl-clang afl-clang++ test/unittests/unit_hash test/unittests/unit_rand *.dSYM lib*.a
618616
-$(MAKE) -f GNUmakefile.llvm clean
619617
-$(MAKE) -f GNUmakefile.gcc_plugin clean
620618
-$(MAKE) -C utils/libdislocator clean
@@ -831,18 +829,16 @@ endif
831829
install -m 644 $(HEADERS) $${DESTDIR}$(INCLUDE_PATH)
832830
@mkdir -m 0755 -p ${DESTDIR}$(MAN_PATH)
833831
install -m0644 *.8 ${DESTDIR}$(MAN_PATH)
834-
install -m 755 afl-as $${DESTDIR}$(HELPER_PATH)
835-
ln -sf afl-as $${DESTDIR}$(HELPER_PATH)/as
836832
install -m 644 docs/*.md $${DESTDIR}$(DOC_PATH)
837833
cp -r testcases/ $${DESTDIR}$(MISC_PATH)
838834
cp -r dictionaries/ $${DESTDIR}$(MISC_PATH)
839835
cp injections.dic $${DESTDIR}$(MISC_PATH)
840836

841837
.PHONY: uninstall
842838
uninstall:
843-
-cd $${DESTDIR}$(BIN_PATH) && rm -f $(PROGS) $(SH_PROGS) afl-cs-proxy afl-qemu-trace afl-plot-ui afl-fuzz-document afl-network-client afl-network-server afl-g* afl-plot.sh afl-as afl-ld-lto afl-c* afl-lto*
839+
-cd $${DESTDIR}$(BIN_PATH) && rm -f $(PROGS) $(SH_PROGS) afl-cs-proxy afl-qemu-trace afl-plot-ui afl-fuzz-document afl-network-client afl-network-server afl-g* afl-plot.sh afl-ld-lto afl-c* afl-lto*
844840
-cd $${DESTDIR}$(INCLUDE_PATH) && rm -f $(HEADERS:include/%=%)
845-
-cd $${DESTDIR}$(HELPER_PATH) && rm -f afl-g*.*o afl-llvm-*.*o afl-compiler-*.*o libdislocator.so libtokencap.so libcompcov.so libqasan.so afl-frida-trace.so libnyx.so socketfuzz*.so argvfuzz*.so libAFLDriver.a libAFLQemuDriver.a as afl-as SanitizerCoverage*.so compare-transform-pass.so cmplog-*-pass.so split-*-pass.so dynamic_list.txt injections.dic
841+
-cd $${DESTDIR}$(HELPER_PATH) && rm -f afl-g*.*o afl-llvm-*.*o afl-compiler-*.*o libdislocator.so libtokencap.so libcompcov.so libqasan.so afl-frida-trace.so libnyx.so socketfuzz*.so argvfuzz*.so libAFLDriver.a libAFLQemuDriver.a SanitizerCoverage*.so compare-transform-pass.so cmplog-*-pass.so split-*-pass.so dynamic_list.txt injections.dic
846842
-rm -rf $${DESTDIR}$(MISC_PATH)/testcases $${DESTDIR}$(MISC_PATH)/dictionaries
847843
-sh -c "ls docs/*.md | sed 's|^docs/|$${DESTDIR}$(DOC_PATH)/|' | xargs rm -f"
848844
-cd $${DESTDIR}$(MAN_PATH) && rm -f $(MANPAGES)

docs/env_variables.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,10 @@ fairly broad use of environment variables instead:
4545
make
4646
```
4747
48-
- Setting `AFL_AS`, `AFL_CC`, and `AFL_CXX` lets you use alternate downstream
49-
compilation tools, rather than the default 'as', 'clang', or 'gcc' binaries
48+
- Setting `AFL_CC`, and `AFL_CXX` lets you use alternate downstream
49+
compilation tools, rather than the default 'clang', or 'gcc' binaries
5050
in your `$PATH`.
5151
52-
- If you are a weird person that wants to compile and instrument asm text
53-
files, then use the `AFL_AS_FORCE_INSTRUMENT` variable:
54-
`AFL_AS_FORCE_INSTRUMENT=1 afl-gcc foo.s -o foo`
55-
5652
- Most AFL tools do not print any output if stdout/stderr are redirected. If
5753
you want to get the output into a file, then set the `AFL_DEBUG` environment
5854
variable. This is sadly necessary for various build processes which fail
@@ -83,17 +79,13 @@ fairly broad use of environment variables instead:
8379
Setting `AFL_INST_RATIO` to 0 is a valid choice. This will instrument only
8480
the transitions between function entry points, but not individual branches.
8581
86-
Note that this is an outdated variable. A few instances (e.g., afl-gcc)
87-
still support these, but state-of-the-art (e.g., LLVM LTO and LLVM PCGUARD)
88-
do not need this.
82+
Note that this is an outdated variable. Only LLVM CLASSIC pass can use this.
8983
9084
- `AFL_NO_BUILTIN` causes the compiler to generate code suitable for use with
9185
libtokencap.so (but perhaps running a bit slower than without the flag).
9286
93-
- `AFL_PATH` can be used to point afl-gcc to an alternate location of afl-as.
94-
One possible use of this is utils/clang_asm_normalize/, which lets you
95-
instrument hand-written assembly when compiling clang code by plugging a
96-
normalizer into the chain. (There is no equivalent feature for GCC.)
87+
- `AFL_PATH` can be used to point a directory that contains LLVM/GCC plugins
88+
for AFL++, AFL++'s runtime objects and QEMU/Frida support files.
9789
9890
- Setting `AFL_QUIET` will prevent afl-as and afl-cc banners from being
9991
displayed during compilation, in case you find them distracting.

docs/features.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@ QEMU 5.1 with laf-intel and Redqueen, FRIDA mode, unicorn mode, gcc plugin, full
66

77
## Features and instrumentation
88

9-
| Feature/Instrumentation | afl-gcc | llvm | gcc_plugin | FRIDA mode(9) | QEMU mode(10) | unicorn_mode(10) | nyx_mode(12) | coresight_mode(11) |
10-
| ------------------------------|:--------:|:---------:|:----------:|:--------------:|:----------------:|:----------------:|:------------:|:------------------:|
11-
| Threadsafe counters [A] | | x(3) | | | | | x | |
12-
| NeverZero [B] | x86[_64] | x(1) | x | x | x | x | | |
13-
| Persistent Mode [C] | | x | x | x86[_64]/arm64 | x86[_64]/arm[64] | x | | |
14-
| LAF-Intel / CompCov [D] | | x | | | x86[_64]/arm[64] | x86[_64]/arm[64] | x86[_64] | |
15-
| CmpLog [E] | | x | x | x86[_64]/arm64 | x86[_64]/arm[64] | | | |
16-
| Selective Instrumentation [F] | | x | x | x | x | | | |
17-
| Non-Colliding Coverage [G] | | x(4) | | | (x)(5) | | | |
18-
| Ngram prev_loc Coverage [H] | | x(6) | | | | | | |
19-
| Context Coverage [I] | | x(6) | | | | | | |
20-
| Auto Dictionary [J] | | x(7) | | | | | | |
21-
| Snapshot Support [K] | | (x)(8) | (x)(8) | | (x)(5) | | x | |
22-
| Shared Memory Test cases [L] | | x | x | x86[_64]/arm64 | x | x | x | |
9+
Note that afl-gcc and afl-clang have been removed because their instrumentation is absolutely outdated.
10+
11+
| Feature/Instrumentation | llvm | gcc_plugin | FRIDA mode(9) | QEMU mode(10) | unicorn_mode(10) | nyx_mode(12) | coresight_mode(11) |
12+
| ------------------------------|:---------:|:----------:|:--------------:|:----------------:|:----------------:|:------------:|:------------------:|
13+
| Threadsafe counters [A] | x(3) | | | | | x | |
14+
| NeverZero [B] | x(1) | x | x | x | x | | |
15+
| Persistent Mode [C] | x | x | x86[_64]/arm64 | x86[_64]/arm[64] | x | | |
16+
| LAF-Intel / CompCov [D] | x | | | x86[_64]/arm[64] | x86[_64]/arm[64] | x86[_64] | |
17+
| CmpLog [E] | x | x | x86[_64]/arm64 | x86[_64]/arm[64] | | | |
18+
| Selective Instrumentation [F] | x | x | x | x | | | |
19+
| Non-Colliding Coverage [G] | x(4) | | | (x)(5) | | | |
20+
| Ngram prev_loc Coverage [H] | x(6) | | | | | | |
21+
| Context Coverage [I] | x(6) | | | | | | |
22+
| Auto Dictionary [J] | x(7) | | | | | | |
23+
| Snapshot Support [K] | (x)(8) | (x)(8) | | (x)(5) | | x | |
24+
| Shared Memory Test cases [L] | x | x | x86[_64]/arm64 | x | x | x | |
2325

2426
## More information about features
2527

@@ -94,7 +96,7 @@ L. Faster fuzzing and less kernel syscall overhead by in-memory fuzz testcase
9496

9597
Among others, the following features and patches have been integrated:
9698

97-
* NeverZero patch for afl-gcc, instrumentation, QEMU mode and unicorn_mode which
99+
* NeverZero for llvm/gcc instrumentation, QEMU mode and unicorn_mode which
98100
prevents a wrapping map value to zero, increases coverage
99101
* Persistent mode, deferred forkserver and in-memory fuzzing for QEMU mode
100102
* Unicorn mode which allows fuzzing of binaries from completely different

docs/fuzzing_binary-only_targets.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ have an x86_64 or arm64 binary that does not contain C++ exceptions and - if
199199
x86_64 - still has it's symbols and compiled with position independent code
200200
(PIC/PIE), then the RetroWrite solution might be for you.
201201
It decompiles to ASM files which can then be instrumented with afl-gcc.
202+
Note that afl-gcc is only present until AFL++ v4.21c and was subsequently removed as it is obsolete.
202203

203204
Binaries that are statically instrumented for fuzzing using RetroWrite are close
204205
in performance to compiler-instrumented binaries and outperform the QEMU-based

0 commit comments

Comments
 (0)