mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-22 07:51:16 +00:00
Uses of the old ApiRequest enum conflated two different concerns: identifying an API request endpoint, and storing data for an API request. This led to ApiRequest values being passed around with junk data just to communicate a request type, which forced all API request body types to implement Default, which in some cases doesn't make any sense — what's the "default" path for a vhost-user socket? The nonsensical Default values have led to tests relying on being able to use nonsensical data, which is an impediment to adding better validation for these types. Rather than having API request types be represented by an enum, which has to carry associated body data everywhere it's used, it makes more sense to represent API request types as trait objects. These can have an associated type for the type of the request body, and this makes it possible to pass API request types and data around as siblings in a type-safe way without forcing them into a single value even where it doesn't make sense. Trait objects also give us dynamic dispatch, which lets us get rid of several large match blocks. To keep it possible to fuzz the HTTP API, all the Vmm methods called by the HTTP API are pulled out into a trait, so the fuzzer can provide its own stub implementation of the VMM. Signed-off-by: Alyssa Ross <hi@alyssa.is>
140 lines
2.4 KiB
TOML
140 lines
2.4 KiB
TOML
[package]
|
|
name = "cloud-hypervisor-fuzz"
|
|
version = "0.0.0"
|
|
authors = ["Automatically generated"]
|
|
publish = false
|
|
edition = "2021"
|
|
|
|
[package.metadata]
|
|
cargo-fuzz = true
|
|
|
|
[features]
|
|
igvm = []
|
|
|
|
[dependencies]
|
|
block = { path = "../block" }
|
|
devices = { path = "../devices" }
|
|
epoll = "4.3.1"
|
|
libc = "0.2.152"
|
|
libfuzzer-sys = "0.4.7"
|
|
linux-loader = { version = "0.10.0", features = ["elf", "bzimage", "pe"] }
|
|
micro_http = { git = "https://github.com/firecracker-microvm/micro-http", branch = "main" }
|
|
net_util = { path = "../net_util" }
|
|
once_cell = "1.19.0"
|
|
seccompiler = "0.4.0"
|
|
virtio-devices = { path = "../virtio-devices" }
|
|
virtio-queue = "0.10.0"
|
|
vmm = { path = "../vmm" }
|
|
vmm-sys-util = "0.11.2"
|
|
vm-memory = "0.13.1"
|
|
vm-migration = { path = "../vm-migration" }
|
|
vm-device = { path = "../vm-device" }
|
|
vm-virtio = { path = "../vm-virtio" }
|
|
|
|
[dependencies.cloud-hypervisor]
|
|
path = ".."
|
|
|
|
[patch.crates-io]
|
|
kvm-bindings = { git = "https://github.com/cloud-hypervisor/kvm-bindings", branch = "ch-v0.6.0-tdx" }
|
|
versionize_derive = { git = "https://github.com/cloud-hypervisor/versionize_derive", branch = "ch" }
|
|
|
|
# Prevent this from interfering with workspaces
|
|
[workspace]
|
|
members = ["."]
|
|
|
|
[[bin]]
|
|
name = "balloon"
|
|
path = "fuzz_targets/balloon.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "block"
|
|
path = "fuzz_targets/block.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "cmos"
|
|
path = "fuzz_targets/cmos.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "console"
|
|
path = "fuzz_targets/console.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "http_api"
|
|
path = "fuzz_targets/http_api.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "iommu"
|
|
path = "fuzz_targets/iommu.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "linux_loader"
|
|
path = "fuzz_targets/linux_loader.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "linux_loader_cmdline"
|
|
path = "fuzz_targets/linux_loader_cmdline.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "mem"
|
|
path = "fuzz_targets/mem.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "net"
|
|
path = "fuzz_targets/net.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "pmem"
|
|
path = "fuzz_targets/pmem.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "qcow"
|
|
path = "fuzz_targets/qcow.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "rng"
|
|
path = "fuzz_targets/rng.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "serial"
|
|
path = "fuzz_targets/serial.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "vhdx"
|
|
path = "fuzz_targets/vhdx.rs"
|
|
test = false
|
|
doc = false
|
|
|
|
[[bin]]
|
|
name = "watchdog"
|
|
path = "fuzz_targets/watchdog.rs"
|
|
test = false
|
|
doc = false
|