public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: sbrivio@redhat.com
Cc: passt-dev@passt.top
Subject: [PATCH passt 0/5] Add fuzzing
Date: Thu, 17 Nov 2022 12:26:09 +0000	[thread overview]
Message-ID: <20221117122614.1269214-1-rjones@redhat.com> (raw)

(Note this patch series does not work so far and needs some help, read on ...)

Patches 1 & 2 are general cleanup.

The rest of the patches aim to add fuzzing support for Passt using
AFL++, Clang and ASAN.  I used the same approach as with libnbd:

https://gitlab.com/nbdkit/libnbd/-/tree/master/fuzzing

Firstly (patch 3) I added an --fd option.  This is useful for fuzzing,
but also generally useful.  It allows a controller process to open a
connected stream socket and pass that down to passt via inheritance.
Uses outside fuzzing include: having the controlling process open the
socket with elevated privleges, and allowing alternate address
families to be used (eg. vsock or IB).

Unfortunately I don't think the --fd option is working.  stracing the
code shows the socket being added to the epoll, but it somehow never
gets read.  It might be something obvious but I couldn't see what was
wrong.  (NB: The socket passed in is *connected* already).

Patch 4 adds the fuzzing wrapper.  The purpose of the wrapper is to
allow AFL to submit test cases to passt as local files.  It works by
creating a socketpair(2), forking and execing passt in the parent:

  (parent) passt -f -e -1 --fd <sock>
                               |   ^
                               |   |
  (child)                      |  input file
                               V
                            /dev/null

The child reads the input file (test case) from the command line and
pushes it into the socket, while discarding anything written by passt.
IOW the child takes the place of qemu.

With all patches applied you can test the wrapper alone using:

$ ./fuzz-wrapper testcase_dir/empty_tap

You will see that it currently hangs which it should not do, and I
suspect the problem is related to the implementation of --fd as the
wrapper is old and well-tested code.

Rich.




             reply	other threads:[~2022-11-17 12:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 12:26 Richard W.M. Jones [this message]
2022-11-17 12:26 ` [PATCH passt 1/5] build: Force-create pasta symlink Richard W.M. Jones
2022-11-17 12:26 ` [PATCH passt 2/5] build: Remove *~ files with make clean Richard W.M. Jones
2022-11-17 12:26 ` [PATCH passt 3/5] Add --fd option Richard W.M. Jones
2022-11-17 15:26   ` [PATCH v2 3/5] passt, tap: " Stefano Brivio
2022-11-17 15:31     ` Stefano Brivio
2022-11-17 15:33       ` Richard W.M. Jones
2022-11-17 15:33     ` Richard W.M. Jones
2022-11-17 15:49       ` Stefano Brivio
2022-11-17 16:02         ` Richard W.M. Jones
2022-11-17 16:18           ` Stefano Brivio
2022-11-17 12:26 ` [PATCH passt 4/5] XXX build: Add extra syscalls needed by AFL instrumentation Richard W.M. Jones
2022-11-17 14:22   ` Stefano Brivio
2022-11-17 12:26 ` [PATCH passt 5/5] Import fuzzing wrapper from libnbd Richard W.M. Jones
2022-11-17 15:35   ` Stefano Brivio
2022-11-17 13:58 ` [PATCH passt 0/5] Add fuzzing Stefano Brivio
2022-11-17 14:13   ` Richard W.M. Jones

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=20221117122614.1269214-1-rjones@redhat.com \
    --to=rjones@redhat.com \
    --cc=passt-dev@passt.top \
    --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).