Commit Graph
19 Commits
Author SHA1 Message Date
Wei Liu c07574b1a8 fuzz/x86emul: update fuzzer
Provide the fuzzer with more ops, and more sophisticated input
structure.

Based on a patch originally written by Andrew and George.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-02-06 10:15:49 +00:00
Wei Liu 5c6c3ac6e1 x86emul: use msr definitions in msr-index.h
Change the names used in code according to numeric values. Remove the
now unused macros in x86_emualte.c and fix indentation. This in turns
requires including msr-index.h  and removing duplicates in userspace
x86_emulate.c in userspace harness program.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-02-06 10:15:49 +00:00
Wei Liu 7603eb256a x86emul: use eflags definitions in x86-defns.h
Basically this patch does 's/EFLG_/X86_EFLAGS_/g' and with indentation
fixed up. And remove the duplicates in x86_emualte.c.  This in turn
requires userspace test harness to include x86-defns.h. Also remove a
few duplicates in userspace harness program.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-02-06 10:15:49 +00:00
Wei Liu 588a28187a x86emul/test: use x86-vendors.h
No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-02-06 10:15:49 +00:00
Wei Liu 409bd5a02e fuzz/x86emul: use macro to reduce repetition in Makefile
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-02-06 10:15:49 +00:00
Wei Liu 9d3226aa06 fuzz: don't buffer stdout in afl stubs
... to avoid obscuring output.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-02-01 11:25:26 +00:00
Wei Liu 4453129a0b fuzz/libelf: exit with fuzzer function return value
Now the function can return nonzero value. Use that value as exit code
for the stub program. AFL might be able to use such information to
optimise fuzzing process.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2017-01-26 17:23:40 +00:00
Wei Liu 53693bf3be fuzz/libelf: return early if elf_init fails
Coverity-ID: 1399557

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2017-01-26 17:23:40 +00:00
Wei Liu 9e739d7cfe tools/fuzz: add README.afl
And rename README to README.oss-fuzz.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2017-01-25 10:04:31 +00:00
Wei Liu a304574abe tools/fuzz: add AFL stub program for libefl fuzzer
And hook it up into build system.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2017-01-25 10:00:33 +00:00
Wei Liu 39f6daa47d tools/fuzz: add AFL stub program for x86 insn emulator fuzzer
This 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.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2017-01-25 10:00:31 +00:00
Wei Liu 037ff530cd tools/fuzz: add missing dependencies in x86 insn fuzzer build rule
The said file needs the two header files.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2017-01-25 10:00:17 +00:00
Wei Liu e792e01332 tools/fuzz: remove redundant rule in x86 insn fuzzer
The predefined pattern rule works.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2017-01-24 16:24:50 +00:00
Wei Liu e23b93a334 tools/fuzz: make sure targets are always built
Invocation of `make' in top-level directory would end up invoking the
install target.

Adjust fuzzing target makefiles a bit so that they are always build in
that situation.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2017-01-24 16:24:50 +00:00
Wei Liu b2f006fdc0 tools/fuzz: fix compilation after 897129d
We need to add -D__XEN_TOOLS__ so that the correct register names are
generated.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2017-01-24 16:24:50 +00:00
Wei Liu 9868314551 tools/fuzz: add README
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2016-12-13 10:25:57 +00:00
Wei Liu 6f33dea035 tools: hook up fuzz directory
This will make all fuzzing targets get build every time tools directory
is built. This serves as basic regression test.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2016-12-13 10:25:57 +00:00
Wei Liu c808475882 tools/fuzz: introduce x86 instruction emulator target
Instruction emulator fuzzing code is from code previous written by
Andrew and George. Adapt it to llvm fuzzer and hook up the build system.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2016-12-13 10:25:57 +00:00
Wei Liu 4f62f31d25 tools/fuzz: introduce libelf target
Source code and Makefile to fuzz libelf in Google's oss-fuzz
infrastructure.

Introduce FUZZ_NO_LIBXC in libelf-private.h. That macro will be set when
compiling libelf fuzzer target because libxc is not required in libelf
fuzzing.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2016-12-13 10:25:57 +00:00