public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <graf@amazon.com>
To: Sam Caccavale <samcacc@amazon.de>
Cc: <samcaccavale@gmail.com>, <nmanthey@amazon.de>,
	<wipawel@amazon.de>, <dwmw@amazon.co.uk>, <mpohlack@amazon.de>,
	<karahmed@amazon.de>, <andrew.cooper3@citrix.com>,
	<JBeulich@suse.com>, <pbonzini@redhat.com>, <rkrcmar@redhat.com>,
	<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
	<hpa@zytor.com>, <paullangton4@gmail.com>, <x86@kernel.org>,
	<kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 0/5] x86 instruction emulator fuzzing
Date: Fri, 28 Jun 2019 11:33:45 +0200	[thread overview]
Message-ID: <caaeb546-9aa1-7fd5-496d-a0ec1f759d10@amazon.com> (raw)
In-Reply-To: <20190628092621.17823-1-samcacc@amazon.de>



On 28.06.19 11:26, Sam Caccavale wrote:
> Dear all,
> 
> This series aims to provide an entrypoint for, and fuzz KVM's x86 instruction
> emulator from userspace.  It mirrors Xen's application of the AFL fuzzer to
> it's instruction emulator in the hopes of discovering vulnerabilities.
> Since this entrypoint also allows arbitrary execution of the emulators code
> from userspace, it may also be useful for testing.
> 
> The current 4 patches build the emulator and 2 harnesses: simple-harness is
> an example of unit testing; afl-harness is a frontend for the AFL fuzzer.
> The fifth patch contains useful scripts for development but is not intended
> for usptream consumption.
> 
> Patches
> =======
> 
> - 01: Builds and links afl-harness with the required kernel objects.
> - 02: Introduces the minimal set of emulator operations and supporting code
> to emulate simple instructions.
> - 03: Demonstrates simple-harness as a unit test.
> - 04: Adds scripts for install and building.
> - 05: Useful scripts for development
> 
> 
> Issues
> =======
> 
> Currently, fuzzing results in a large amount of FPU related crashes.  Xen's
> fuzzing efforts had this issue too.  Their (temporary?) solution was to
> disable FPU exceptions after every instruction iteration?  Some solution
> is desired for this project.
> 
> 
> Changelog
> =======
> 
> v1 -> v2:
>   - Moved -O0 to ifdef DEBUG
>   - Building with ASAN by default
>   - Removed a number of macros from emulator_ops.c and moved them as
>     static inline functions in emulator_ops.h
>   - Accidentally changed the example in simple-harness (reverted in v3)
>   - Introduced patch 4 for scripts
> 
> v2 -> v3:
>   - Removed a workaround for printf smashing the stack when compiled
>     with -mcmodel=kernel, and stopped compiling with -mcmodel=kernel
>   - Added a null check for malloc's return value
>   - Moved more macros from emulator_ops.c into emulator_ops.h as
>     static inline functions
>   - Removed commented out code
>   - Moved changes to emulator_ops.h into the first patch
>   - Moved addition of afl-many script to the script patch
>   - Fixed spelling mistakes in documentation
>   - Reverted the simple-harness example back to the more useful original one
>   - Moved non-essential development scripts from patch 4 to new patch 5
> 
> v3 -> v4:
>   - Stubbed out all unimplemented emulator_ops with a unimplemented_op macro
>   - Setting FAIL_ON_UNIMPLEMENTED_OP on compile decides whether calling these
>     is treated as a crash or ignored
>   - Moved setting up core dumps out of the default build/install path and
>     detailed this change in the README
>   - Added a .sh extention to afl-many
>   - Added an optional timeout to afl-many.sh and made deploy_remote.sh use it
>   - Building no longer creates a new .config each time and does not force any
>     config options
>   - Fixed a path bug in afl-many.sh
> 
> Any comments/suggestions are greatly appreciated.
> 
> Best,
> Sam Caccavale
> 
> Sam Caccavale (5):
>    Build target for emulate.o as a userspace binary
>    Emulate simple x86 instructions in userspace
>    Demonstrating unit testing via simple-harness
>    Added build and install scripts
>    Development scripts for crash triage and deploy
> 
>   tools/Makefile                                |   9 +
>   tools/fuzz/x86ie/.gitignore                   |   2 +
>   tools/fuzz/x86ie/Makefile                     |  54 ++
>   tools/fuzz/x86ie/README.md                    |  21 +
>   tools/fuzz/x86ie/afl-harness.c                | 151 +++++
>   tools/fuzz/x86ie/common.h                     |  87 +++
>   tools/fuzz/x86ie/emulator_ops.c               | 590 ++++++++++++++++++
>   tools/fuzz/x86ie/emulator_ops.h               | 134 ++++
>   tools/fuzz/x86ie/scripts/afl-many.sh          |  31 +
>   tools/fuzz/x86ie/scripts/bin.sh               |  49 ++
>   tools/fuzz/x86ie/scripts/build.sh             |  34 +
>   tools/fuzz/x86ie/scripts/coalesce.sh          |   5 +
>   tools/fuzz/x86ie/scripts/deploy.sh            |   9 +
>   tools/fuzz/x86ie/scripts/deploy_remote.sh     |  10 +
>   tools/fuzz/x86ie/scripts/gen_output.sh        |  11 +
>   tools/fuzz/x86ie/scripts/install_afl.sh       |  15 +
>   .../fuzz/x86ie/scripts/install_deps_ubuntu.sh |   5 +
>   tools/fuzz/x86ie/scripts/rebuild.sh           |   6 +
>   tools/fuzz/x86ie/scripts/run.sh               |  10 +
>   tools/fuzz/x86ie/scripts/summarize.sh         |   9 +
>   tools/fuzz/x86ie/simple-harness.c             |  49 ++
>   tools/fuzz/x86ie/stubs.c                      |  59 ++
>   tools/fuzz/x86ie/stubs.h                      |  52 ++

Sorry I didn't realize it before. Isn't that missing a patch to the 
MAINTAINERS file?


Alex

  parent reply	other threads:[~2019-06-28  9:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28  9:26 [PATCH v4 0/5] x86 instruction emulator fuzzing Sam Caccavale
2019-06-28  9:26 ` [PATCH v4 1/5] Build target for emulate.o as a userspace binary Sam Caccavale
2019-06-28  9:26 ` [PATCH v4 2/5] Emulate simple x86 instructions in userspace Sam Caccavale
2019-06-28  9:26 ` [PATCH v4 3/5] Demonstrating unit testing via simple-harness Sam Caccavale
2019-06-28  9:26 ` [PATCH v4 4/5] Added build and install scripts Sam Caccavale
2019-06-28  9:26 ` [PATCH v4 5/5] Development scripts for crash triage and deploy Sam Caccavale
2019-06-28  9:33 ` Alexander Graf [this message]
2019-07-03 16:20   ` [PATCH v4 0/5] x86 instruction emulator fuzzing Paolo Bonzini
2019-07-03 20:04     ` Sam Caccavale

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=caaeb546-9aa1-7fd5-496d-a0ec1f759d10@amazon.com \
    --to=graf@amazon.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=dwmw@amazon.co.uk \
    --cc=hpa@zytor.com \
    --cc=karahmed@amazon.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpohlack@amazon.de \
    --cc=nmanthey@amazon.de \
    --cc=paullangton4@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=samcacc@amazon.de \
    --cc=samcaccavale@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=wipawel@amazon.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox