Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Bounti authored Jun 4, 2024
1 parent 18bd412 commit cdce81b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion fuzzers/cva6-vcs-fuzzer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ Follow the installation instructions from the Spike GitHub repository.

* [RISC-V GNU Compiler Toolchain] (https://github.com/riscv-collab/riscv-gnu-toolchain)

With everything properly installed, please make sure to set the right environment variables in your `bashrc` or equivalent file. The fuzzer expects the following configuration in bash:

Please, find below an example of configuratio
```bash
export RISCV=$HOME/riscv
export VERDI_HOME=/usr/synopsys/verdi/U-2023.03-SP2
export VCS_HOME=/usr/synopsys/vcs/U-2023.03-SP2
export [email protected]
export LD_LIBRARY_PATH=$VERDI_HOME/share/NPI/lib/linux64
```

## Building

The build.rs script performs the following tasks:
Expand Down Expand Up @@ -58,10 +69,12 @@ for i in {1..10}; do AFL_LAUNCHER_CLIENT=$i ./cva6_vcs_fuzzer & done
The fuzzer is bootstraped using the seed files into the `seeds` folder. Feel free to customize the content of this file with any interesting seed.
When starting the fuzzer loads the initial inputs (i.e., the seeds), and only keep interesting ones in the corpus (i.e., coverage novelty).
Coverage novelty consider any changes for all supported code coverage metrics on vcs, i.e., branch, conditional, line, toggle, and FSM.

Then, starts the fuzzer loop that iteratively calls the different stages.
StdMutationalStage is responsible for generating new mutant by applying mutation to the existing testcase in the corpus.
The mutations work at the ISA level by first deserializing the binary testcase into stream of instruction, then different mutations might be applied (e.g., adding instruction, removing instruction, changing opcode, ..).
The mutation can easily be customized by changing `../../libpresifuzz_mutators/src/riscv_isa.rs`.

The generated testcase is then inserted into a template ELF file by simplify injecting the code after the `payload` label.
This template contains epilogue and prologue code.
The current version is very simple. We first init registers to some known values, and we change the `mtvec` to points to our own trap handler.
Expand All @@ -79,4 +92,4 @@ python3 ./plot.py -m branch -d ./sync
```

The `-m` option is there to provide the coverage metric that is either tgl, cond, branch, line, fsm.
The `-d` points to the directory where stats are saved.
The `-d` points to the directory where stats are saved.

0 comments on commit cdce81b

Please sign in to comment.