From: <samcacc@amazon.com>
To: Alexander Graf <graf@amazon.com>, Sam Caccavale <samcacc@amazon.de>
Cc: <samcaccavale@gmail.com>, <nmanthey@amazon.de>,
<wipawel@amazon.de>, <dwmw@amazon.co.uk>, <mpohlack@amazon.de>,
<graf@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>, <anirudhkaushik@google.com>,
<x86@kernel.org>, <kvm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: x86 instruction emulator fuzzing
Date: Wed, 12 Jun 2019 17:19:10 +0200 [thread overview]
Message-ID: <c1994ba8-7b94-e814-d911-febc545d7506@amazon.com> (raw)
In-Reply-To: <6f9f4746-7850-0de0-b531-0ea0e6d7ca82@amazon.com>
On 5/31/19 10:39 AM, Alexander Graf wrote:
>
> On 21.05.19 17:39, 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 3 patches build the emulator and 2 harnesses:
>> simple-harness is
>> an example of unit testing; afl-harness is a frontend for the AFL fuzzer.
>> They are early POC and include some issues outlined under "Issues."
>>
>> 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.
>>
>> Issues
>> =======
>>
>> 1. Currently, building requires manually running the `make_deps` script
>> since I was unable to make the kernel objects a dependency of the tool.
>> 2. The code will segfault if `CONFIG_STACKPROTECTOR=y` in config.
>> 3. The code requires stderr to be buffered or it otherwise segfaults.
>>
>> The latter two issues seem related and all of them are likely fixable by
>> someone more familiar with the linux than me.
>>
>> Concerns
>> =======
>>
>> I was able to carve the `arch/x86/kvm/emulate.c` code, but the
>> emulator is
>> constructed in such a way that a lot of the code which enforces expected
>> behavior lives in the x86_emulate_ops supplied in `arch/x86/kvm/x86.c`.
>> Testing the emulator is still valuable, but a reproducible way to use
>> the kvm
>> ops would be useful.
>>
>> Any comments/suggestions are greatly appreciated.
>
>
> First off, thanks a lot for this :). The x86 emulator has been a sore
> (bug prone) point in KVM for a long time and I'm surprised it's not
> covered by fuzzing yet. It's great to see that finally happening.
>
> A few nits:
>
> 1) Cover letter should be [PATCH 0/3]. Just generate it with git
> format-patch --cover-letter.
Understood and corrected in v2.
> 2) The directory name "x86_instruction_emulation" is a bit long, no?
Yes it is. While tab completion has mostly kept me sane until now, I've
renamed the folder to `x86ie`s
> 3) I think the cover letter should also detail how this relates to
> other fuzzing efforts and why we need another, separate one.
This sounds worthwhile. In the interest of time I haven't included this
in v2, but I'll write it up as soon as possible and update.
>
>
> Alex
>
>
Thanks for the advice, v2 to follow.
Sam
prev parent reply other threads:[~2019-06-12 15:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 15:39 Sam Caccavale
2019-05-21 15:39 ` [PATCH 1/3] Build target for emulate.o as a userspace binary Sam Caccavale
2019-05-31 8:02 ` Alexander Graf
2019-06-12 15:19 ` samcacc
2019-05-21 15:39 ` [PATCH 2/3] Emulate simple x86 instructions in userspace Sam Caccavale
2019-05-31 8:38 ` Alexander Graf
2019-06-12 15:19 ` samcacc
2019-06-21 13:28 ` Alexander Graf
2019-05-21 15:39 ` [PATCH 3/3] Demonstrating unit testing via simple-harness Sam Caccavale
2019-05-31 8:39 ` x86 instruction emulator fuzzing Alexander Graf
2019-06-12 15:19 ` samcacc [this message]
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=c1994ba8-7b94-e814-d911-febc545d7506@amazon.com \
--to=samcacc@amazon.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=anirudhkaushik@google.com \
--cc=bp@alien8.de \
--cc=dwmw@amazon.co.uk \
--cc=graf@amazon.com \
--cc=graf@amazon.de \
--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
all inboxes | Powered by JetHome®