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>,
<anirudhkaushik@google.com>, <x86@kernel.org>,
<kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [v2, 3/4] Demonstrating unit testing via simple-harness
Date: Fri, 21 Jun 2019 15:43:51 +0200 [thread overview]
Message-ID: <54e7eb69-3700-2e54-77b9-79b61ca69a1b@amazon.com> (raw)
In-Reply-To: <20190612153600.13073-4-samcacc@amazon.de>
On 12.06.19 17:35, Sam Caccavale wrote:
> Simple-harness.c uses inline asm support to generate asm and then has the
> emulator emulate this code. This may be useful as a form of testing for
> the emulator.
>
> CR: https://code.amazon.com/reviews/CR-8591638
> ---
> tools/fuzz/x86ie/Makefile | 7 ++++--
> tools/fuzz/x86ie/simple-harness.c | 42 +++++++++++++++++++++++++++++++
> 2 files changed, 47 insertions(+), 2 deletions(-)
> create mode 100644 tools/fuzz/x86ie/simple-harness.c
>
> diff --git a/tools/fuzz/x86ie/Makefile b/tools/fuzz/x86ie/Makefile
> index d45fe6d266b9..e79d275e1040 100644
> --- a/tools/fuzz/x86ie/Makefile
> +++ b/tools/fuzz/x86ie/Makefile
> @@ -44,8 +44,11 @@ LOCAL_OBJS := emulator_ops.o stubs.o
> afl-harness: afl-harness.o $(LOCAL_OBJS) $(KERNEL_OBJS)
> @$(CC) -v $(KBUILD_CFLAGS) $(LOCAL_OBJS) $(KERNEL_OBJS) $< $(INCLUDES) -Istubs.h -o $@ -no-pie
>
> -all: afl-harness
> +simple-harness: simple-harness.o $(LOCAL_OBJS) $(KERNEL_OBJS)
> + @$(CC) -v $(KBUILD_CFLAGS) $(LOCAL_OBJS) $(KERNEL_OBJS) $< $(INCLUDES) -Istubs.h -o $@ -no-pie
> +
> +all: afl-harness simple-harness
>
> .PHONY: clean
> clean:
> - $(RM) -r *.o afl-harness
> + $(RM) -r *.o afl-harness simple-harness
> diff --git a/tools/fuzz/x86ie/simple-harness.c b/tools/fuzz/x86ie/simple-harness.c
> new file mode 100644
> index 000000000000..f21fdafe1dd1
> --- /dev/null
> +++ b/tools/fuzz/x86ie/simple-harness.c
> @@ -0,0 +1,42 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <assert.h>
> +#include <stdint.h>
> +#include <stdio.h>
> +#include <string.h>
> +#include "emulator_ops.h"
> +#include <asm/kvm_emulate.h>
> +
> +extern void foo(void)
> +{
> + asm volatile("__start:"
> + ".byte 0x32, 0x05, 0x00, 0x00, 0x00, 0x00;" // xor eax,DWORD PTR [rip+0x0]
> + ".byte 0x90;"
> + //".byte 0x0f, 0x7f, 0xde;" // movq mm6,mm3
Why?
Alex
next prev parent reply other threads:[~2019-06-21 13:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 15:35 [v2, 0/4] x86 instruction emulator fuzzing Sam Caccavale
2019-06-12 15:35 ` [v2, 1/4] Build target for emulate.o as a userspace binary Sam Caccavale
2019-06-21 13:33 ` Alexander Graf
2019-06-12 15:35 ` [v2, 2/4] Emulate simple x86 instructions in userspace Sam Caccavale
2019-06-21 13:40 ` Alexander Graf
2019-06-12 15:35 ` [v2, 3/4] Demonstrating unit testing via simple-harness Sam Caccavale
2019-06-21 13:43 ` Alexander Graf [this message]
2019-06-12 15:36 ` [v2, 4/4] Added scripts for filtering, building, deploying Sam Caccavale
2019-06-21 13:50 ` Alexander Graf
2019-06-21 13:30 ` [v2, 0/4] x86 instruction emulator fuzzing Alexander Graf
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=54e7eb69-3700-2e54-77b9-79b61ca69a1b@amazon.com \
--to=graf@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=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