From: Stefan Hajnoczi <stefanha@redhat.com>
To: Alexander Bulekov <alxndr@bu.edu>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org, f4bug@amsat.org, darren.kenny@oracle.com,
bsd@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [RFC PATCH 3/3] fuzz: Add callbacks for dma-access functions
Date: Mon, 13 Jul 2020 12:41:10 +0100 [thread overview]
Message-ID: <20200713114110.GK28639@stefanha-x1.localdomain> (raw)
In-Reply-To: <20200709234855.lpto2yc5fanzgzjs@mozz.bu.edu>
[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]
On Thu, Jul 09, 2020 at 07:48:55PM -0400, Alexander Bulekov wrote:
> On 200623 1514, Stefan Hajnoczi wrote:
> > On Thu, Jun 11, 2020 at 01:56:51AM -0400, Alexander Bulekov wrote:
> > > Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> > > ---
> > > exec.c | 17 ++++++++++++++++-
> > > include/exec/memory.h | 8 ++++++++
> > > include/exec/memory_ldst_cached.inc.h | 9 +++++++++
> > > include/sysemu/dma.h | 5 ++++-
> > > memory_ldst.inc.c | 12 ++++++++++++
> > > 5 files changed, 49 insertions(+), 2 deletions(-)
> >
> > Please rename dma_read_cb() to fuzz_dma_read_cb() so the purpose of the
> > function is clear.
> >
> > The ifdefs can be avoided by defining an empty function when CONFIG_FUZZ
> > is undefined. In a header file:
> >
> > #ifdef CONFIG_FUZZ
> > void fuzz_dma_read_cb(size_t addr, size_t len);
> > #else
> > static inline void fuzz_dma_read_cb(size_t addr, size_t len)
> > {
> > /* Do nothing */
> > }
> > #endif
> >
>
> If I understand correctly, this still has the problem that normal
> qemu-system builds under --enable-fuzzing are broken. I'm not sure if
> there is some nice solution for this. For example, a sort-of ugly
> solution could add this to softmmu/main.c (ie something that is linked
> for the qemu-system build, but not for qemu-fuzz).
>
> #ifdef CONFIG_FUZZ
> #include "something.h"
> static void fuzz_dma_read_cb(size_t addr, size_t len)
> {
> /* Do nothing */
> }
> #endif
Another ugly solution is using weak symbols in the main code and a
strong symbol in the fuzzer target:
https://en.wikipedia.org/wiki/Weak_symbol
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-07-13 11:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-11 5:56 [RFC PATCH 0/3] fuzz: add generic fuzzer Alexander Bulekov
2020-06-11 5:56 ` [RFC PATCH 1/3] fuzz: add a general fuzzer for any qemu arguments Alexander Bulekov
2020-06-11 5:56 ` [RFC PATCH 2/3] fuzz: add support for fuzzing DMA regions Alexander Bulekov
2020-06-11 5:56 ` [RFC PATCH 3/3] fuzz: Add callbacks for dma-access functions Alexander Bulekov
2020-06-23 14:14 ` Stefan Hajnoczi
2020-06-23 14:55 ` Alexander Bulekov
2020-06-26 15:44 ` Stefan Hajnoczi
2020-07-09 23:48 ` Alexander Bulekov
2020-07-13 11:41 ` Stefan Hajnoczi [this message]
2020-07-13 11:52 ` Alexander Bulekov
2020-06-24 9:46 ` Philippe Mathieu-Daudé
2020-06-11 6:55 ` [RFC PATCH 0/3] fuzz: add generic fuzzer no-reply
2020-06-23 14:16 ` Stefan Hajnoczi
2020-06-25 15:30 ` Dima Stepanov
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=20200713114110.GK28639@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=alxndr@bu.edu \
--cc=bsd@redhat.com \
--cc=darren.kenny@oracle.com \
--cc=f4bug@amsat.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=stefanha@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.