From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: "Richard W.M. Jones" <rjones@redhat.com>, passt-dev@passt.top
Subject: Re: [PATCH passt v2 0/7] Add fuzzing
Date: Wed, 30 Nov 2022 12:11:11 +1100 [thread overview]
Message-ID: <Y4atr0zAL+7louEk@yekko> (raw)
In-Reply-To: <20221129143442.4ae32a9b@elisabeth>
[-- Attachment #1: Type: text/plain, Size: 3380 bytes --]
On Tue, Nov 29, 2022 at 02:34:42PM +0100, Stefano Brivio wrote:
> On Fri, 25 Nov 2022 10:11:03 +0000
> "Richard W.M. Jones" <rjones@redhat.com> wrote:
>
> > On Fri, Nov 25, 2022 at 10:23:54AM +0100, Stefano Brivio wrote:
> > > and introducing frames with special values, as you hinted on IRC, for
> > > example one-byte frames with commands such as "go ahead with socket
> > > processing then come back to 'tap' frames", so that passt has a chance
> > > to do some meaningful socket-side operations before getting back to
> > > fuzz input.
> >
> > You can improve the chance that the fuzzer will find these frames by
> > either including them in test cases (we need better test cases, which
> > is separate issue), or by making the encoding such that they are easy
> > to find. eg. if you had four possible values, encode them only in the
> > bottom two bits and ignore the higher bits. Since these frames are
> > only used for fuzzing you can change the meaning of them later, so
> > exact encoding isn't an ABI issue.
>
> Right, yes, I was thinking we could, under #ifdef FUZZING, accept
> frames that are shorter than a 802.3 header (up to 13 bytes), and take
> their length (in network order, but I guess AFL++ can easily get
> familiar with it) as fuzzing flow commands.
>
> About test cases, I'm not sure this should be included in regular test
> runs, because there's no reasonable definition for a test duration. I'd
> rather have a separate script which keeps running indefinitely, updating
> sources as they become available.
I agree we don't want to do fuzzing per se as part of the regular
test. However, it would be nice to replay specific fuzz-generated
scenarios where we've previously found bugs, to avoid regression. I'm
not really sure what would be involved in that.
> > > Patch 7/7 is very useful and appreciated anyway as it demystifies the
> > > whole topic for me, and we can probably recycle most of the
> > > documentation. I'm not sure yet how/if the wrapper still fits with the
> > > stuff I'm looking into.
> >
> > It would definitely be better to have passt itself be able to
> > read a file off disk.
> >
> > For example when we fuzz nbdkit we do not used or need a wrapper,
> > because nbdkit has an -s / --single option that reads from stdin and
> > writes to stdout. This was originally added to inetd support.
> >
> > We drive nbdkit from the fuzzer directly like this:
> >
> > afl-fuzz -i fuzzing/testcase_dir -o fuzzing/sync_dir -M fuzz01 \
> > ./server/nbdkit -s -t 1 ./plugins/memory/.libs/nbdkit-memory-plugin.so 1M
> >
> > (https://gitlab.com/nbdkit/nbdkit/-/blob/ef035f7090d8bec2700ef1f941e371d351d647ad/fuzzing/README#L35-36)
>
> Ah, I didn't know, interesting. On the other hand, would it really make
> sense to add support for that (which has probably no use other than
> fuzzing) instead of a hack with __AFL_FUZZ_TESTCASE_BUF and mmap()?
>
> According to AFL++ documentation that should speed things up
> considerably:
> https://github.com/AFLplusplus/AFLplusplus/blob/stable/instrumentation/README.persistent_mode.md#5-shared-memory-fuzzing
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2022-11-30 1:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 18:49 [PATCH passt v2 0/7] Add fuzzing Richard W.M. Jones
2022-11-17 18:49 ` [PATCH passt v2 1/7] build: Force-create pasta symlink Richard W.M. Jones
2022-11-18 1:30 ` David Gibson
2022-11-18 7:56 ` Stefano Brivio
2022-11-17 18:49 ` [PATCH passt v2 2/7] build: Remove *~ files with make clean Richard W.M. Jones
2022-11-18 1:31 ` David Gibson
2022-11-17 18:49 ` [PATCH passt v2 3/7] passt, tap: Add --fd option Richard W.M. Jones
2022-11-17 18:49 ` [PATCH passt v2 4/7] passt, tap: Process data on the socket before HUP/ERR events Richard W.M. Jones
2022-11-18 1:32 ` David Gibson
2022-11-17 18:49 ` [PATCH passt v2 5/7] XXX build: Add extra syscalls needed by AFL instrumentation Richard W.M. Jones
2022-11-17 18:49 ` [PATCH passt v2 6/7] XXX passt: Kill seccomp and other isolation mechanisms Richard W.M. Jones
2022-11-17 18:49 ` [PATCH passt v2 7/7] Import fuzzing wrapper from libnbd Richard W.M. Jones
2022-11-17 19:06 ` [PATCH passt v2 0/7] Add fuzzing Richard W.M. Jones
2022-11-18 10:12 ` Richard W.M. Jones
2022-11-25 9:23 ` Stefano Brivio
2022-11-25 10:11 ` Richard W.M. Jones
2022-11-29 13:34 ` Stefano Brivio
2022-11-29 13:44 ` Richard W.M. Jones
2022-11-30 1:11 ` David Gibson [this message]
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=Y4atr0zAL+7louEk@yekko \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=rjones@redhat.com \
--cc=sbrivio@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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).