diff options
author | John Levon <john.levon@nutanix.com> | 2022-04-21 13:43:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 13:43:44 +0100 |
commit | 3779fca8c766b18b6d68feda9ed7958aa60bd4cf (patch) | |
tree | 07401acbf0d8656dc1de00b2a9ecb3fec1d2a932 /samples/server.c | |
parent | 9ad7474568a6c9f1fbb12fb8048f2083078a8144 (diff) | |
download | libvfio-user-3779fca8c766b18b6d68feda9ed7958aa60bd4cf.zip libvfio-user-3779fca8c766b18b6d68feda9ed7958aa60bd4cf.tar.gz libvfio-user-3779fca8c766b18b6d68feda9ed7958aa60bd4cf.tar.bz2 |
support AFL++ fuzzing (#623)
To support fuzzing with AFL++, add a "pipe" transport that reads from stdin and
outputs to stdout: this is the most convenient way of doing fuzzing.
Add some docs on how to run a fuzzing session.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/server.c')
-rw-r--r-- | samples/server.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/samples/server.c b/samples/server.c index 25b4908..c6feb34 100644 --- a/samples/server.c +++ b/samples/server.c @@ -429,6 +429,7 @@ int main(int argc, char *argv[]) } }; vfu_ctx_t *vfu_ctx; + vfu_trans_t trans = VFU_TRANS_SOCK; int tmpfd; const vfu_migration_callbacks_t migr_callbacks = { .version = VFU_MIGR_CALLBACKS_VERS, @@ -459,7 +460,11 @@ int main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to register signal handler"); } - vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, argv[optind], 0, &server_data, + if (strcmp(argv[optind], "pipe") == 0) { + trans = VFU_TRANS_PIPE; + } + + vfu_ctx = vfu_create_ctx(trans, argv[optind], 0, &server_data, VFU_DEV_TYPE_PCI); if (vfu_ctx == NULL) { err(EXIT_FAILURE, "failed to initialize device emulation"); |