From: Thomas Huth <thuth@redhat.com>
To: Alexander Bulekov <alxndr@bu.edu>, qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Bandan Das <bsd@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [PATCH v2 1/3] fuzz: enable dynamic args for generic-fuzz configs
Date: Mon, 18 Jan 2021 10:25:06 +0100 [thread overview]
Message-ID: <076dae16-6e1e-dab8-b822-926f1b4a9a76@redhat.com> (raw)
In-Reply-To: <20210117230924.449676-2-alxndr@bu.edu>
On 18/01/2021 00.09, Alexander Bulekov wrote:
> For some device configurations, it is useful to configure some
> resources, and adjust QEMU arguments at runtime, prior to fuzzing. This
> patch adds an "argfunc" to generic the generic_fuzz_config. When
> specified, it is responsible for configuring the resources and returning
> a string containing the corresponding QEMU arguments. This can be useful
> for targets that rely on e.g.:
> * a temporary qcow2 image
> * a temporary directory
> * an unused TCP port used to bind the VNC server
>
> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> ---
> tests/qtest/fuzz/generic_fuzz.c | 10 +++++++++-
> tests/qtest/fuzz/generic_fuzz_configs.h | 1 +
> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
> index be76d47d2d..6adf62a5be 100644
> --- a/tests/qtest/fuzz/generic_fuzz.c
> +++ b/tests/qtest/fuzz/generic_fuzz.c
> @@ -936,12 +936,20 @@ static GString *generic_fuzz_cmdline(FuzzTarget *t)
>
> static GString *generic_fuzz_predefined_config_cmdline(FuzzTarget *t)
> {
> + gchar *args;
> const generic_fuzz_config *config;
> g_assert(t->opaque);
>
> config = t->opaque;
> setenv("QEMU_AVOID_DOUBLE_FETCH", "1", 1);
> - setenv("QEMU_FUZZ_ARGS", config->args, 1);
> + if (config->argfunc) {
> + args = config->argfunc();
> + setenv("QEMU_FUZZ_ARGS", args, 1);
> + g_free(args);
> + } else {
> + g_assert_nonnull(config->args);
> + setenv("QEMU_FUZZ_ARGS", config->args, 1);
> + }
> setenv("QEMU_FUZZ_OBJECTS", config->objects, 1);
> return generic_fuzz_cmdline(t);
> }
> diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/generic_fuzz_configs.h
> index 7fed035345..1a133655ee 100644
> --- a/tests/qtest/fuzz/generic_fuzz_configs.h
> +++ b/tests/qtest/fuzz/generic_fuzz_configs.h
> @@ -16,6 +16,7 @@
>
> typedef struct generic_fuzz_config {
> const char *name, *args, *objects;
> + gchar* (*argfunc)(void); /* Result must be free
Reviewed-by: Thomas Huth <thuth@redhat.com>
... would it make sense to also add a cleanup function pointer here, so that
the resources can also be freed cleanly after a test has succeeded (instead
of using atexit() like suggested in your third patch)? Well, just an idea,
it still can be done in a later patch.
next prev parent reply other threads:[~2021-01-18 9:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-17 23:09 [PATCH v2 0/3] fuzz: Add 9p generic-fuzz configs Alexander Bulekov
2021-01-17 23:09 ` [PATCH v2 1/3] fuzz: enable dynamic args for " Alexander Bulekov
2021-01-18 9:25 ` Thomas Huth [this message]
2021-01-17 23:09 ` [PATCH v2 2/3] docs/fuzz: add some information about OSS-Fuzz Alexander Bulekov
2021-01-18 15:17 ` Darren Kenny
2021-01-17 23:09 ` [PATCH v2 3/3] fuzz: add virtio-9p configurations for fuzzing Alexander Bulekov
2021-01-18 12:34 ` qemu_oss--- via
2021-01-18 15:30 ` Alexander Bulekov
2021-01-18 15:40 ` Darren Kenny
2021-01-19 15:12 ` Alexander Bulekov
2021-01-19 15:44 ` Darren Kenny
2021-01-19 16:15 ` qemu_oss--- via
2021-01-18 15:36 ` Darren Kenny
2021-01-18 15:44 ` Alexander Bulekov
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=076dae16-6e1e-dab8-b822-926f1b4a9a76@redhat.com \
--to=thuth@redhat.com \
--cc=alxndr@bu.edu \
--cc=bsd@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).