diff --git a/include/spdk/vfio_user_pci.h b/include/spdk/vfio_user_pci.h index 3c911f20c..75e556c5a 100644 --- a/include/spdk/vfio_user_pci.h +++ b/include/spdk/vfio_user_pci.h @@ -6,6 +6,7 @@ #define _SPDK_VFIO_USER_PCI_H #include "spdk/stdinc.h" +#include "spdk/vfio_user_spec.h" #ifdef __cplusplus extern "C" { @@ -24,6 +25,11 @@ struct vfio_device *spdk_vfio_user_setup(const char *path); void spdk_vfio_user_release(struct vfio_device *dev); +/* For fuzzing only */ +int spdk_vfio_user_dev_send_request(struct vfio_device *dev, enum vfio_user_command command, + void *arg, size_t arg_len, size_t buf_len, int *fds, + int max_fds); + #ifdef __cplusplus } #endif diff --git a/lib/vfio_user/host/Makefile b/lib/vfio_user/host/Makefile index 768e2a4f8..8049c7e0f 100644 --- a/lib/vfio_user/host/Makefile +++ b/lib/vfio_user/host/Makefile @@ -7,7 +7,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk SO_VER := 3 -SO_MINOR := 0 +SO_MINOR := 1 C_SRCS = vfio_user_pci.c vfio_user.c LIBNAME = vfio_user diff --git a/lib/vfio_user/host/spdk_vfio_user.map b/lib/vfio_user/host/spdk_vfio_user.map index f3db7619e..08e6c6390 100644 --- a/lib/vfio_user/host/spdk_vfio_user.map +++ b/lib/vfio_user/host/spdk_vfio_user.map @@ -6,6 +6,7 @@ spdk_vfio_user_get_bar_addr; spdk_vfio_user_setup; spdk_vfio_user_release; + spdk_vfio_user_dev_send_request; local: *; }; diff --git a/lib/vfio_user/host/vfio_user.c b/lib/vfio_user/host/vfio_user.c index 1667579e2..fb6d9d662 100644 --- a/lib/vfio_user/host/vfio_user.c +++ b/lib/vfio_user/host/vfio_user.c @@ -157,7 +157,7 @@ vfio_user_read(int fd, struct vfio_user_request *req) return 0; } -static int +int vfio_user_dev_send_request(struct vfio_device *dev, enum vfio_user_command command, void *arg, size_t arg_len, size_t buf_len, int *fds, int max_fds) { diff --git a/lib/vfio_user/host/vfio_user_internal.h b/lib/vfio_user/host/vfio_user_internal.h index b7f7cc779..fec747ae7 100644 --- a/lib/vfio_user/host/vfio_user_internal.h +++ b/lib/vfio_user/host/vfio_user_internal.h @@ -65,5 +65,9 @@ int vfio_user_get_dev_region_info(struct vfio_device *dev, struct vfio_region_in int vfio_user_dev_dma_map_unmap(struct vfio_device *dev, struct vfio_memory_region *mr, bool map); int vfio_user_dev_mmio_access(struct vfio_device *dev, uint32_t index, uint64_t offset, size_t len, void *buf, bool is_write); +/* For fuzzing only */ +int vfio_user_dev_send_request(struct vfio_device *dev, enum vfio_user_command command, + void *arg, size_t arg_len, size_t buf_len, int *fds, + int max_fds); #endif diff --git a/lib/vfio_user/host/vfio_user_pci.c b/lib/vfio_user/host/vfio_user_pci.c index 9ff6cf0ba..010b2924a 100644 --- a/lib/vfio_user/host/vfio_user_pci.c +++ b/lib/vfio_user/host/vfio_user_pci.c @@ -421,4 +421,13 @@ spdk_vfio_user_get_bar_addr(struct vfio_device *dev, uint32_t index, uint64_t of return NULL; } +/* For fuzzing only */ +int +spdk_vfio_user_dev_send_request(struct vfio_device *dev, enum vfio_user_command command, + void *arg, size_t arg_len, size_t buf_len, int *fds, + int max_fds) +{ + return vfio_user_dev_send_request(dev, command, arg, arg_len, buf_len, fds, max_fds); +} + SPDK_LOG_REGISTER_COMPONENT(vfio_pci)