Spdk/test/app/fuzz/vhost_fuzz
Jim Harris d132ee3531 build: use DEPDIRS variables to build SPDK_LIB_LIST
All of our Makefiles duplicate huge lists of libraries
in SPDK_LIB_LIST.  We have a very precise and accurate
accounting of the library dependencies in
mk/spdk.lib_deps.mk which can be used to generate
the full list if the app specifies the modules and
subsystem libraries it wishes to link.

I did a first pass through all of the existing
Makefiles to take advantage of this new functionality.
There may be more optimizations we can make later but
don't want to hold up this patch for all of them.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Icdaf6f749a6908df2c2ce2db22631a4af4ff3a9e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5553
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-12-18 09:40:01 +00:00
..
.gitignore test: add a fuzzer for the vhost API 2019-07-08 09:18:19 +00:00
example.json test: add a fuzzer for the vhost API 2019-07-08 09:18:19 +00:00
Makefile build: use DEPDIRS variables to build SPDK_LIB_LIST 2020-12-18 09:40:01 +00:00
README.md doc: Fix Markdown MD032 linter warnings 2020-02-06 09:46:06 +00:00
vhost_fuzz_rpc.c lib/jsonrpc: Add a new API to send response for writing bool result. 2020-11-16 15:08:47 +00:00
vhost_fuzz.c lib/event: support ABI compatibility for spdk_app_opts. 2020-12-16 08:40:14 +00:00
vhost_fuzz.h test: add a fuzzer for the vhost API 2019-07-08 09:18:19 +00:00

Overview

This application is intended to fuzz test the SPDK vhost target by supplying malformed or invalid requests across a unix domain socket. This fuzzer currently supports fuzzing both vhost block and vhost scsi devices. When fuzzing a vhost scsi device, users can select whether to fuzz the scsi I/O queue or the scsi admin queue. Please see the NVMe fuzzer readme for information on how output is generated, debugging procedures, and the JSON format expected when supplying preconstructed values to the fuzzer.

Request Types

Like the NVMe fuzzer, there is an example json file showing the types of requests that the application accepts. Since the vhost application accepts both vhost block and vhost scsi commands, there are three distinct object types that can be passed in to the application.

  1. vhost_blk_cmd
  2. vhost_scsi_cmd
  3. vhost_scsi_mgmt_cmd

Each one of these objects contains distinct data types and they should not be used interchangeably.

All three of the data types begin with three iovec structures describing the request, data, and response memory locations. By default, these values are overwritten by the application even when supplied as part of a json file. This is because the request and resp data pointers are intended to point to portions of the data structure.

If you want to override these iovec values using a json file, you can specify the -k option. In most cases, this will just result in the application failing all I/O immediately since the request will no longer point to a valid memory location.

It is possible to supply all three types of requests in a single array to the application. They will be parsed and submitted to the proper block devices.

RPC

The vhost fuzzer differs from the NVMe fuzzer in that it expects devices to be configured via rpc. The fuzzer should always be started with the --wait-for-rpc argument. Please see below for an example of starting the fuzzer.

./test/app/fuzz/vhost_fuzz/vhost_fuzz -t 30 --wait-for-rpc &
./scripts/rpc.py fuzz_vhost_create_dev -s ./Vhost.1 -b -V
./scripts/rpc.py fuzz_vhost_create_dev -s ./naa.VhostScsi0.1 -l -V
./scripts/rpc.py framework_start_init