From 3779fca8c766b18b6d68feda9ed7958aa60bd4cf Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 21 Apr 2022 13:43:44 +0100 Subject: 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 Reviewed-by: Swapnil Ingle Reviewed-by: Thanos Makatos --- test/CMakeLists.txt | 2 ++ test/py/libvfio_user.py | 3 +++ test/py/test_vfu_create_ctx.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7f94212..2f085b8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -44,6 +44,8 @@ add_executable(unit-tests unit-tests.c mocks.c ../lib/migration.c ../lib/pci.c ../lib/pci_caps.c + ../lib/tran.c + ../lib/tran_pipe.c ../lib/tran_sock.c) target_link_libraries(unit-tests PUBLIC cmocka dl json-c) diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py index dda4038..c96b1bc 100644 --- a/test/py/libvfio_user.py +++ b/test/py/libvfio_user.py @@ -121,6 +121,9 @@ VFIO_DEVICE_STATE_MASK = ((1 << 3) - 1) # libvfio-user defines VFU_TRANS_SOCK = 0 +VFU_TRANS_PIPE = 1 +VFU_TRANS_MAX = 2 + LIBVFIO_USER_FLAG_ATTACH_NB = (1 << 0) VFU_DEV_TYPE_PCI = 0 diff --git a/test/py/test_vfu_create_ctx.py b/test/py/test_vfu_create_ctx.py index cb1448f..720a3fa 100644 --- a/test/py/test_vfu_create_ctx.py +++ b/test/py/test_vfu_create_ctx.py @@ -33,7 +33,7 @@ import errno def test_vfu_create_ctx_bad_trans(): - ctx = vfu_create_ctx(trans=VFU_TRANS_SOCK + 1) + ctx = vfu_create_ctx(trans=VFU_TRANS_MAX) assert ctx is None assert c.get_errno() == errno.ENOTSUP -- cgit v1.1