From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
Thomas Huth <thuth@redhat.com>,
qemu-block@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
Bandan Das <bsd@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Juan Quintela <quintela@redhat.com>, Peter Lieven <pl@kamp.de>,
Yuval Shaia <yuval.shaia.ml@gmail.com>,
Max Reitz <mreitz@redhat.com>, Alexander Bulekov <alxndr@bu.edu>,
Alex Williamson <alex.williamson@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Darren Kenny <darren.kenny@oracle.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [PULL 1/4] fuzz: select fuzz target using executable name
Date: Fri, 1 May 2020 09:28:03 +0100 [thread overview]
Message-ID: <20200501082806.205696-2-stefanha@redhat.com> (raw)
In-Reply-To: <20200501082806.205696-1-stefanha@redhat.com>
From: Alexander Bulekov <alxndr@bu.edu>
The fuzzers are built into a binary (e.g. qemu-fuzz-i386). To select the
device to fuzz/fuzz target, we usually use the --fuzz-target= argument.
This commit allows the fuzz-target to be specified using the name of the
executable. If the executable name ends with -target-FUZZ_TARGET, then
we select the fuzz target based on this name, rather than the
--fuzz-target argument. This is useful for systems such as oss-fuzz
where we don't have control of the arguments passed to the fuzzer.
[Fixed incorrect indentation.
--Stefan]
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Message-id: 20200421182230.6313-1-alxndr@bu.edu
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/qtest/fuzz/fuzz.c | 19 +++++++++++--------
slirp | 2 +-
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
index 0d78ac8d36..f5c923852e 100644
--- a/tests/qtest/fuzz/fuzz.c
+++ b/tests/qtest/fuzz/fuzz.c
@@ -91,6 +91,7 @@ static void usage(char *path)
printf(" * %s : %s\n", tmp->target->name,
tmp->target->description);
}
+ printf("Alternatively, add -target-FUZZ_TARGET to the executable name\n");
exit(0);
}
@@ -143,18 +144,20 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
module_call_init(MODULE_INIT_QOM);
module_call_init(MODULE_INIT_LIBQOS);
- if (*argc <= 1) {
+ target_name = strstr(**argv, "-target-");
+ if (target_name) { /* The binary name specifies the target */
+ target_name += strlen("-target-");
+ } else if (*argc > 1) { /* The target is specified as an argument */
+ target_name = (*argv)[1];
+ if (!strstr(target_name, "--fuzz-target=")) {
+ usage(**argv);
+ }
+ target_name += strlen("--fuzz-target=");
+ } else {
usage(**argv);
}
/* Identify the fuzz target */
- target_name = (*argv)[1];
- if (!strstr(target_name, "--fuzz-target=")) {
- usage(**argv);
- }
-
- target_name += strlen("--fuzz-target=");
-
fuzz_target = fuzz_get_target(target_name);
if (!fuzz_target) {
usage(**argv);
diff --git a/slirp b/slirp
index 2faae0f778..55ab21c9a3 160000
--- a/slirp
+++ b/slirp
@@ -1 +1 @@
-Subproject commit 2faae0f778f818fadc873308f983289df697eb93
+Subproject commit 55ab21c9a36852915b81f1b41ebaf3b6509dd8ba
--
2.25.3
next prev parent reply other threads:[~2020-05-01 8:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 8:28 [PULL 0/4] Block patches Stefan Hajnoczi
2020-05-01 8:28 ` Stefan Hajnoczi [this message]
2020-05-01 8:28 ` [PULL 2/4] lockable: fix __COUNTER__ macro to be referenced properly Stefan Hajnoczi
2020-05-01 8:28 ` [PULL 3/4] lockable: replaced locks with lock guard macros where appropriate Stefan Hajnoczi
2020-05-01 8:28 ` [PULL 4/4] lockable: Replace locks with lock guard macros Stefan Hajnoczi
2020-05-01 9:02 ` [PULL 0/4] Block patches no-reply
2020-05-01 9:32 ` Peter Maydell
2020-05-01 15:23 ` Stefan Hajnoczi
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=20200501082806.205696-2-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=alxndr@bu.edu \
--cc=armbru@redhat.com \
--cc=bsd@redhat.com \
--cc=darren.kenny@oracle.com \
--cc=dgilbert@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=ronniesahlberg@gmail.com \
--cc=thuth@redhat.com \
--cc=yuval.shaia.ml@gmail.com \
/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).