fuzz: basic AFL suppport
v2 cover fuzz: basic AFL suppport
Provide simple stub programs for AFL fuzzer. For usage, please see README.afl.
This series doesn't aim to improve fuzzing targets. It is just demonstration for how we could use the same fuzzing code for both oss-fuzz and AFL.
The stub programs are identical in libefl and x86 emulator at the moment, but they will likely diverge in the future. The duplication of code is deliberate.
Wei.
Wei Liu (4):
tools/fuzz: add missing dependencies in x86 insn fuzzer build rule tools/fuzz: add AFL stub program for x86 insn emulator fuzzer tools/fuzz: add AFL stub program for libefl fuzzer tools/fuzz: add README.afl
.gitignore | 2 +
tools/fuzz/README.afl | 27 ++++++++++
tools/fuzz/{README => README.oss-fuzz} | 0
tools/fuzz/libelf/Makefile | 7 ++-
tools/fuzz/libelf/afl-libelf-fuzzer.c | 57 ++++++++++++++++++++++
tools/fuzz/x86_instruction_emulator/Makefile | 11 ++++-
.../afl-x86-insn-emulator-fuzzer.c | 57 ++++++++++++++++++++++
7 files changed, 158 insertions(+), 3 deletions(-)
create mode 100644 tools/fuzz/README.afl
rename tools/fuzz/{README => README.oss-fuzz} (100%)
create mode 100644 tools/fuzz/libelf/afl-libelf-fuzzer.c
create mode 100644 tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.cSignature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 1/4 tools/fuzz: add missing dependencies in x86 insn fuzzer build rule
The said file needs the two header files.
---
Cc: Ian Jackson <[email protected]>
--- tools/fuzz/x86_instruction_emulator/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/fuzz/x86_instruction_emulator/Makefile +2 -0
@@ -18,6 +18,8 @@ CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ x86_emulate.o: x86_emulate.c x86_emulate.h x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h +x86-insn-emulator-fuzzer.o: x86_emulate.h x86_emulate/x86_emulate.h + x86-insn-emulator.a: x86_emulate.o $(AR) rc $@ $^
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 2/4 tools/fuzz: add AFL stub program for x86 insn emulator fuzzer
In reply to Wei LiuThis is a basic program to call into the unified fuzzing function.
Hook it up into build system so that we can always build test it.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
--- .gitignore | 1 + tools/fuzz/x86_instruction_emulator/Makefile | 9 +++- .../afl-x86-insn-emulator-fuzzer.c | 57 ++++++++++++++++++++++ 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c
.gitignore +1 -0
@@ -147,6 +147,7 @@ tools/flask/utils/flask-setenforce tools/flask/utils/flask-set-bool tools/flask/utils/flask-label-pci tools/fuzz/x86_instruction_emulator/x86_emulate* +tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer tools/helpers/_paths.h tools/helpers/init-xenstore-domain tools/helpers/xen-init-dom0
tools/fuzz/x86_instruction_emulator/Makefile +7 -2
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk .PHONY: x86-instruction-emulator-fuzzer-all ifeq ($(CONFIG_X86_64),y) -x86-instruction-emulator-fuzzer-all: x86-insn-emulator.a x86-insn-emulator-fuzzer.o +x86-instruction-emulator-fuzzer-all: x86-insn-emulator.a x86-insn-emulator-fuzzer.o afl else x86-instruction-emulator-fuzzer-all: endif
@@ -23,6 +23,8 @@ x86-insn-emulator-fuzzer.o: x86_emulate.h x86_emulate/x86_emulate.h x86-insn-emulator.a: x86_emulate.o $(AR) rc $@ $^ +afl-x86-insn-emulator-fuzzer: afl-x86-insn-emulator-fuzzer.o x86-insn-emulator-fuzzer.o x86_emulate.o + # Common targets .PHONY: all all: x86-instruction-emulator-fuzzer-all
@@ -33,7 +35,10 @@ distclean: clean .PHONY: clean clean: - rm -f *.a *.o + rm -f *.a *.o *-x86-insn-emulator-fuzzer .PHONY: install install: all + +.PHONY: afl +afl: afl-x86-insn-emulator-fuzzer
tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c new file +57 -0
57 lines not on this page · raw message
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 3/4 tools/fuzz: add AFL stub program for libefl fuzzer
In reply to Wei LiuAnd hook it up into build system.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
--- .gitignore | 1 + tools/fuzz/libelf/Makefile | 7 ++++- tools/fuzz/libelf/afl-libelf-fuzzer.c | 57 +++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tools/fuzz/libelf/afl-libelf-fuzzer.c
.gitignore +1 -0
@@ -146,6 +146,7 @@ tools/flask/utils/flask-loadpolicy tools/flask/utils/flask-setenforce tools/flask/utils/flask-set-bool tools/flask/utils/flask-label-pci +tools/fuzz/libelf/afl-libelf-fuzzer tools/fuzz/x86_instruction_emulator/x86_emulate* tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer tools/helpers/_paths.h
tools/fuzz/libelf/Makefile +6 -1
@@ -19,6 +19,8 @@ libelf.a: $(ELF_LIB_OBJS) .PHONY: libelf-fuzzer-all libelf-fuzzer-all: libelf.a libelf-fuzzer.o +afl-libelf-fuzzer: afl-libelf-fuzzer.o libelf-fuzzer.o $(ELF_LIB_OBJS) + # Common targets .PHONY: all all: libelf-fuzzer-all
@@ -28,7 +30,10 @@ distclean: clean .PHONY: clean clean: - rm -f *.o *.a + rm -f *.o *.a *-libelf-fuzzer .PHONY: install install: all + +.PHONY: afl +afl: afl-libelf-fuzzer
tools/fuzz/libelf/afl-libelf-fuzzer.c new file +57 -0
57 lines not on this page · raw message
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v2 3/4] tools/fuzz: add AFL stub program for libefl fuzzer
Wei Liu writes ("[PATCH v2 3/4] tools/fuzz: add AFL stub program for libefl fuzzer"):
Quoted 1 line
And hook it up into build system.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v2 4/4 tools/fuzz: add README.afl
In reply to Wei LiuAnd rename README to README.oss-fuzz.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
---
tools/fuzz/README.afl | 27 +++++++++++++++++++++++++++
tools/fuzz/{README => README.oss-fuzz} | 0
2 files changed, 27 insertions(+)
create mode 100644 tools/fuzz/README.afl
rename tools/fuzz/{README => README.oss-fuzz} (100%)tools/fuzz/README.afl new file +27 -0
@@ -0,0 +1,27 @@ +# OVERVIEW + +Some fuzzing targets have American Fuzzy Lop (AFL) support. + +See also http://lcamtuf.coredump.cx/afl/ + +# HOW IT WORKS + +AFL provides a customised toolchain to build an executable, which in +turn is launched by the fuzzer. + +# HOW TO USE IT + +Use the x86 instruction emulator fuzzer as an example. + +1. download and compile AFL in $AFLPATH. + +2. run the following commands to build: + $ cd tools/fuzz/x86_instruction_emulator + $ make distclean + $ make CC=$AFLPATH/afl-gcc afl # produces afl-x86-insn-emulator-fuzzer + +3. run the fuzzer with AFL: + $ $AFLPATH/afl-fuzz -m none -t 1000 -i testcase_dir -o findings_dir -- \ + ./afl-x86-insn-emulator-fuzzer @@ + +Please see AFL documentation for more information.
tools/fuzz/README.oss-fuzz renamed from tools/fuzz/README +0 -0
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel