From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>, Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v2 11/12] fuzz/x86emul: print out minimal input size
Date: Tue, 31 Jan 2017 11:08:08 +0000 [thread overview]
Message-ID: <20170131110809.30001-12-wei.liu2@citrix.com> (raw)
In-Reply-To: <20170131110809.30001-1-wei.liu2@citrix.com>
... so that users can know how big the initial input should be.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
---
.../fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c | 8 ++++++++
tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c b/tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c
index 494c23ba2e..16edbd6bab 100644
--- a/tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c
+++ b/tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c
@@ -2,8 +2,10 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
extern int LLVMFuzzerTestOneInput(const uint8_t *data_p, size_t size);
+extern unsigned int fuzz_minimal_input_size(void);
#define INPUT_SIZE 4096
static uint8_t input[INPUT_SIZE];
@@ -21,6 +23,12 @@ int main(int argc, char **argv)
exit(-1);
}
+ if ( !strcmp(argv[1], "--min-input-size") )
+ {
+ printf("%u\n", fuzz_minimal_input_size());
+ exit(0);
+ }
+
fp = fopen(argv[1], "rb");
if ( fp == NULL )
{
diff --git a/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c b/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
index ef223e856d..40c5ea1c1b 100644
--- a/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
+++ b/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
@@ -716,6 +716,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data_p, size_t size)
return 0;
}
+unsigned int fuzz_minimal_input_size(void)
+{
+ return DATA_OFFSET + 1;
+}
+
/*
* Local variables:
* mode: C
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-01-31 11:16 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 11:07 [PATCH v2 00/12] fuzz: update x86emul fuzzer Wei Liu
2017-01-31 11:07 ` [PATCH v2 01/12] fuzz: don't buffer stdout in afl stubs Wei Liu
2017-01-31 12:44 ` Jan Beulich
2017-01-31 11:07 ` [PATCH v2 02/12] x86: extract macros to x86-defns.h Wei Liu
2017-01-31 12:45 ` Jan Beulich
2017-01-31 13:28 ` Wei Liu
2017-01-31 11:08 ` [PATCH v2 03/12] x86: extract vendor numeric id to x86-vendors.h Wei Liu
2017-01-31 12:48 ` Jan Beulich
2017-01-31 11:08 ` [PATCH v2 04/12] x86emul/test: use x86-vendors.h Wei Liu
2017-01-31 12:50 ` Jan Beulich
2017-01-31 14:36 ` Wei Liu
2017-01-31 15:16 ` Jan Beulich
2017-01-31 15:16 ` Wei Liu
2017-01-31 11:08 ` [PATCH v2 05/12] x86emul: use eflags definitions in x86-defns.h Wei Liu
2017-01-31 12:56 ` Jan Beulich
2017-01-31 14:55 ` Wei Liu
2017-01-31 15:16 ` Jan Beulich
2017-01-31 11:08 ` [PATCH v2 06/12] x86emul: use msr definitions in msr-index.h Wei Liu
2017-01-31 12:59 ` Jan Beulich
2017-01-31 11:08 ` [PATCH v2 07/12] x86: add UMIP CR4 bit Wei Liu
2017-01-31 13:00 ` Jan Beulich
2017-01-31 11:08 ` [PATCH v2 08/12] x86emul: use CR definitions in x86-defns.h Wei Liu
2017-01-31 13:01 ` Jan Beulich
2017-01-31 11:08 ` [PATCH v2 09/12] x86emul: use TRAP " Wei Liu
2017-01-31 11:26 ` Andrew Cooper
2017-01-31 11:08 ` [PATCH v2 10/12] fuzz/x86emul: update fuzzer Wei Liu
2017-01-31 13:33 ` Jan Beulich
2017-01-31 15:51 ` Wei Liu
2017-01-31 15:57 ` Andrew Cooper
2017-01-31 16:01 ` George Dunlap
2017-01-31 16:05 ` Jan Beulich
2017-01-31 16:02 ` Jan Beulich
2017-01-31 17:37 ` Wei Liu
2017-01-31 11:08 ` Wei Liu [this message]
2017-01-31 13:33 ` [PATCH v2 11/12] fuzz/x86emul: print out minimal input size Jan Beulich
2017-01-31 11:08 ` [PATCH v2 12/12] fuzz: update README.afl example Wei Liu
2017-01-31 13:34 ` Jan Beulich
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=20170131110809.30001-12-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).