2020-07-16 14:44:36 +00:00
|
|
|
# Fuzzing in Cloud Hypervisor
|
|
|
|
|
|
|
|
Cloud Hypervisor uses [cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz) for fuzzing individual components.
|
|
|
|
|
2024-06-07 15:48:53 +00:00
|
|
|
The fuzzers are in the `fuzz/fuzz_targets` directory
|
2020-07-16 14:44:36 +00:00
|
|
|
|
|
|
|
## Preparation
|
|
|
|
|
|
|
|
Switch to nightly:
|
|
|
|
|
|
|
|
````
|
|
|
|
rustup override set nightly
|
|
|
|
````
|
|
|
|
|
|
|
|
Install `cargo fuzz`:
|
|
|
|
|
|
|
|
```
|
|
|
|
cargo install cargo-fuzz
|
|
|
|
```
|
|
|
|
|
|
|
|
## Running the fuzzers
|
|
|
|
|
2021-08-04 20:46:42 +00:00
|
|
|
e.g. To run the `block` fuzzer using all available CPUs:
|
2020-07-16 14:44:36 +00:00
|
|
|
|
|
|
|
```
|
2021-08-04 20:46:42 +00:00
|
|
|
cargo fuzz run block -j `nproc`
|
2020-07-16 14:44:36 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Adding a new fuzzer
|
|
|
|
|
|
|
|
```
|
|
|
|
cargo fuzz add <new_fuzzer>
|
|
|
|
```
|
|
|
|
|
2021-08-04 20:46:42 +00:00
|
|
|
Inspiration for fuzzers can be found in [crosvm](https://chromium.googlesource.com/chromiumos/platform/crosvm/+/refs/heads/master/fuzz/)
|