@@ -75,18 +75,15 @@ Re-compile the application by running the build script.
7575
7676## Obtain a Corpus
7777
78- The fuzzer will take input from the `corpus` directory in the project directory, so
79- we'll create that directory and add some sample certificate files in DER format as
80- our input corpus.
81-
82- ```sh
83- mkdir corpus
84- curl -L -o corpus/0 https://github.com/dvyukov/go-fuzz-corpus/raw/master/x509/certificate/corpus/0
85- curl -L -o corpus/1 https://github.com/dvyukov/go-fuzz-corpus/raw/master/x509/certificate/corpus/1
86- curl -L -o corpus/2 https://github.com/dvyukov/go-fuzz-corpus/raw/master/x509/certificate/corpus/2
87- curl -L -o corpus/3 https://github.com/dvyukov/go-fuzz-corpus/raw/master/x509/certificate/corpus/3
78+ The fuzzer will take input from the `corpus` directory located under `edk2-uefi`:
79+
80+ ```python
81+ @tsffs.corpus_directory = SIM_lookup_file("%simics%/../corpus")
8882```
8983
84+ In ` build.sh ` we have already created that directory and added some sample
85+ certificate files in DER format as our input corpus.
86+
9087## Configuring the Fuzzer
9188
9289Even though we loaded the fuzzer module, it didn't run previously because we did not
@@ -95,14 +92,14 @@ script, we'll add each of the following lines.
9592
9693First, we need to create an actual ` tsffs ` object to instantiate the fuzzer.
9794
98- ``` simics
95+ ``` python
9996load- module tsffs # You should already have this
10097init- tsffs
10198```
10299
103100Next, we'll set the log level to maximum for demonstration purposes:
104101
105- ``` simics
102+ ``` python
106103tsffs.log- level 4
107104```
108105
@@ -111,7 +108,7 @@ into our UEFI application. This is the default, so these calls can be skipped in
111108usage unless you want to change the defaults, they are just provided here for
112109completeness.
113110
114- ``` simics
111+ ``` python
115112@tsffs.start_on_harness = True
116113@tsffs.stop_on_harness = True
117114```
@@ -121,24 +118,28 @@ fuzz for. In our case, these are timeouts (we'll set the timeout to 3 seconds) t
121118hangs, and CPU exceptions. we'll enable exceptions 13 for general protection fault and
12211914 for page faults to detect out of bounds reads and writes.
123120
124- ``` simics
121+ ``` python
125122@tsffs.timeout = 3.0
126123@tsffs.exceptions = [13, 14]
127124```
128125
129- We'll tell the fuzzer where to take its corpus and save its solutions. The fuzzer will
130- take its corpus from the ` corpus ` directory and save solutions to the ` solutions `
131- directory in the project by default, so this call can be skipped in real usage unless
132- you want to change the defaults.
126+ By default, TSFFS expects the ` corpus ` and ` solutions ` directories to be located within
127+ the Simics project directory.
128+
129+ However, Since our fuzzer is configured to read its corpus from the ` ../corpus `
130+ directory (relative to the ` project ` directory), we must explicitly specify the
131+ correct path using the following configuration:
133132
134- ``` simics
135- @tsffs.corpus_directory = SIM_lookup_file("%simics%/corpus")
133+ ``` python
134+ # project/../corpus
135+ @tsffs.corpus_directory = SIM_lookup_file("%simics%/../corpus")
136+ # set solutions directory (default location, explicitly defined for clarity)
136137@tsffs.solutions_directory = SIM_lookup_file("%simics%/solutions")
137138```
138139
139140We'll also * delete* the following code from the ` run.simics ` script:
140141
141- ``` simics
142+ ``` python
142143script- branch {
143144 bp.time.wait- for seconds = 30
144145 quit 0
0 commit comments