xref: /cloud-hypervisor/docs/fuzzing.md (revision f7f2f25a574b1b2dba22c094fc8226d404157d15)
1# Fuzzing in Cloud Hypervisor
2
3Cloud Hypervisor uses [cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz) for fuzzing individual components.
4
5The fuzzers are are in the `fuzz/fuzz_targets` directory
6
7## Preparation
8
9Switch to nightly:
10
11````
12rustup override set nightly
13````
14
15Install `cargo fuzz`:
16
17```
18cargo install cargo-fuzz
19```
20
21## Running the fuzzers
22
23e.g. To run the `block` fuzzer using all available CPUs:
24
25```
26cargo fuzz run block -j `nproc`
27```
28
29## Adding a new fuzzer
30
31```
32cargo fuzz add <new_fuzzer>
33```
34
35Inspiration for fuzzers can be found in [crosvm](https://chromium.googlesource.com/chromiumos/platform/crosvm/+/refs/heads/master/fuzz/)
36