@@ -4,19 +4,20 @@ Fuzz tests generate a ton of random parameter arguments to the program and then
4
4
5
5
## How does it work?
6
6
7
- Typically, Travis CI will run ` travis-fuzz.sh ` on one of the environments the automated tests are configured for.
8
- This is the most time-consuming component of the continuous integration workflow, so it is recommended that you detect
9
- issues locally, and Travis merely acts as a sanity check. Fuzzing is further only effective with
10
- a lot of CPU time, indicating that if crash scenarios are discovered on Travis with its low
11
- runtime constraints, the crash is caused relatively easily.
7
+ Typically, Travis CI will run ` travis-fuzz.sh ` on one of the environments the automated tests are
8
+ configured for. This is the most time-consuming component of the continuous integration workflow,
9
+ so it is recommended that you detect issues locally, and Travis merely acts as a sanity check.
10
+ Fuzzing is further only effective with a lot of CPU time, indicating that if crash scenarios are
11
+ discovered on Travis with its low runtime constraints, the crash is caused relatively easily.
12
12
13
13
## How do I run fuzz tests locally?
14
14
15
- You typically won't need to run the entire combination of different fuzzing tools. For local execution, ` honggfuzz `
16
- should be more than sufficient.
15
+ We support multiple fuzzing engines such as ` honggfuzz ` , ` libFuzzer ` and ` AFL ` . You typically won't
16
+ need to run the entire suite of different fuzzing tools. For local execution, ` honggfuzz ` should be
17
+ more than sufficient.
17
18
18
19
### Setup
19
-
20
+ #### Honggfuzz
20
21
To install ` honggfuzz ` , simply run
21
22
22
23
``` shell
@@ -31,9 +32,18 @@ cargo update -p honggfuzz --precise "0.5.52"
31
32
cargo install --force honggfuzz --version " 0.5.52"
32
33
```
33
34
35
+ #### cargo-fuzz / libFuzzer
36
+ To install ` cargo-fuzz ` , simply run
37
+
38
+ ``` shell
39
+ cargo update
40
+ cargo install --force cargo-fuzz
41
+ ```
42
+
34
43
### Execution
35
44
36
- To run the Hongg fuzzer, do
45
+ #### Honggfuzz
46
+ To run fuzzing using ` honggfuzz ` , do
37
47
38
48
``` shell
39
49
export CPU_COUNT=1 # replace as needed
@@ -46,6 +56,25 @@ cargo hfuzz run $TARGET
46
56
47
57
(Or, for a prettier output, replace the last line with ` cargo --color always hfuzz run $TARGET ` .)
48
58
59
+ #### cargo-fuzz / libFuzzer
60
+ To run fuzzing using ` cargo-fuzz / libFuzzer ` , run
61
+
62
+ ``` shell
63
+ rustup install nightly # Note: libFuzzer requires a nightly version of rust.
64
+ cargo +nightly fuzz run --features " libfuzzer_fuzz" msg_ping_target
65
+ ```
66
+ Note: If you encounter a ` SIGKILL ` during run/build check for OOM in kernel logs and consider
67
+ increasing RAM size for VM.
68
+
69
+ If you wish to just generate fuzzing binary executables for ` libFuzzer ` and not run them:
70
+ ``` shell
71
+ cargo +nightly fuzz build --features " libfuzzer_fuzz" msg_ping_target
72
+ # Generates binary artifact in path ./target/aarch64-unknown-linux-gnu/release/msg_ping_target
73
+ # Exact path depends on your system architecture.
74
+ ```
75
+ You can upload the build artifact generated above to ` ClusterFuzz ` for distributed fuzzing.
76
+
77
+ ### List Fuzzing Targets
49
78
To see a list of available fuzzing targets, run:
50
79
51
80
``` shell
@@ -54,7 +83,8 @@ ls ./src/bin/
54
83
55
84
## A fuzz test failed on Travis, what do I do?
56
85
57
- You're trying to create a PR, but need to find the underlying cause of that pesky fuzz failure blocking the merge?
86
+ You're trying to create a PR, but need to find the underlying cause of that pesky fuzz failure
87
+ blocking the merge?
58
88
59
89
Worry not, for this is easily traced.
60
90
0 commit comments