public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Anshu Kumari <anskuma@redhat.com>
Cc: david@gibson.dropbear.id.au, passt-dev@passt.top,
	aerosound161@gmail.com, abdobngad@gmail.com, lvivier@redhat.com
Subject: Re: [PATCH 5/5] fuzz: Add test server for bidirectional protocol fuzzing
Date: Thu, 13 Aug 2026 09:53:24 +0200 (CEST)	[thread overview]
Message-ID: <20260813095323.4c2719bd@elisabeth> (raw)
In-Reply-To: <20260812072630.3235261-6-anskuma@redhat.com>

On Wed, 12 Aug 2026 12:56:28 +0530
Anshu Kumari <anskuma@redhat.com> wrote:

> Add fuzz-server that acts as passt's network peer
> during fuzzing.

To me, this part makes sense. But this one:

> It connects to passt's UNIX socket

much less, while:

> and listens on 127.0.0.1:9999 for TCP connections.

this is the part that I expected instead. Otherwise it's not just
passt's network peer, it's the guest as well.

> UNIX socket path: responds to ARP requests and TCP SYNs with
>   stateless replies (swapped addresses, fixed ISN). Responses
>   are XOR'd with AFL++ shared memory data so the fuzzer can
>   mutate server behavior.

This looks rather complicated to me.

The approach I was suggesting with a test server is the following:


    ,- exchanges guest-side data with ------------.
    |                                   ,---------|---------.
    |                                ,--|      passt        |
    |                               /   '-.---------------^-'
,---|---.                          /      | connect(),    | accept(),
| AFL++ |-- shares memory with ---|       | send data,    | reply with
'---|---'                          \      | etc.          | data, etc.
    |                               \   ,-v---------------'-.
    |                                '--|    test server    |
    |                                   '---------|---------'
    '- exchanges host-side data with -------------'

...at least in its basic form. Eventually, the test server should be
able to connect to passt itself (and we could call it "test peer" at
that point).

As far as I understood, it's not trivial to make the same instance
of AFL++ share memory with two processes at the same time, so the
memory-sharing path might need to take a more complicated turn, for
example there could be a wrapper starting both passt and the test
server and sharing memory with them, or passt could _additionally_
(using a special out-of-band fuzzing channel) share data from AFL++
with the test server.

An example of communication below (but events don't necessarily need
to be in this order, this is just an example). For simplicity, let's
ignore the fact that AFL++ might not directly share memory with passt
and test server, and assume there are three areas of memory that
AFL++ directly controls:

a. shared with passt: an array of struct epoll_event, 'ev'

b. shared with passt: the kind of tap-side buffer you implemented in
   4/5, 'buf'

c. shared with the test server: a separate buffer, 'test_buf'

Example:

1. AFL++ writes an EPOLLIN event in 'ev' with type
   EPOLL_TYPE_TAP_PASST, of some data in 'buf', and some data in
   'test_buf'

2. AFL++ starts passt and the test server

3. passt reads the EPOLL_TYPE_TAP_PASST event from 'ev', reads data
   from 'buf' and hands it to passt_tap_handler()

4. this happens to be have Ethernet, IP, and TCP headers, with the
   SYN flag set, and destination address set to the address of the
   test server (we might want to force all this, at least initially,
   or give it as a hint to AFL++ somehow), so passt connects to
   the test server

5. the test server accepts the connection, and sends the contents
   of 'test_buf' on it (for the test server, this is directly
   payload, without headers, as they don't make sense there). I'm
   not sure if we should have a different set of events (maybe we
   need a "play script" for the server, in case?)

6. this generates an EPOLLOUT event for passt. It's not in 'ev',
   it's a regular epoll_wait() (I think we could have an
   epoll_wait() loop where we additionally read one event from
   'ev' for every iteration, or something like that)

7. passt marks the connection as established and inserts it in the
   flow table

8. passt reads the data sent from the test server and generates
   whatever TCP data packet to the "guest" (it might simply be
   a sink)

...and this attempt ends here because AFL++ generated a single
event for passt, but there could be more (this should also be
decided by AFL++).

Would something like this make sense?

-- 
Stefano


      reply	other threads:[~2026-08-13  7:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12  7:26 [PATCH 0/5] Add AFL++ fuzzing support for passt Anshu Kumari
2026-08-12  7:26 ` [PATCH 1/5] fuzz: Add deterministic wrappers for system calls Anshu Kumari
2026-08-13  3:46   ` David Gibson
2026-08-12  7:26 ` [PATCH 2/5] fuzz: Add flow type guards for fuzzing stability Anshu Kumari
2026-08-13  4:45   ` David Gibson
2026-08-12  7:26 ` [PATCH 3/5] fuzz: Bypass isolation and adapt sockets for AFL++ Anshu Kumari
2026-08-13  5:04   ` David Gibson
2026-08-12  7:26 ` [PATCH 4/5] fuzz: Add AFL++ persistent mode fuzz loop Anshu Kumari
2026-08-13  6:34   ` Stefano Brivio
2026-08-12  7:26 ` [PATCH 5/5] fuzz: Add test server for bidirectional protocol fuzzing Anshu Kumari
2026-08-13  7:53   ` Stefano Brivio [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=20260813095323.4c2719bd@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=abdobngad@gmail.com \
    --cc=aerosound161@gmail.com \
    --cc=anskuma@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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).