Skip to content

Commit 8cdbf43

Browse files
Spellcheck README
1 parent 4c8a808 commit 8cdbf43

File tree

1 file changed

+43
-29
lines changed

1 file changed

+43
-29
lines changed

README.md

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@ PolyTracker can be used in conjunction with [PolyFile](https://github.com/trailo
1212
## Quickstart
1313

1414
PolyTracker is controlled via a Python script called `polytracker`. You can install it by running
15+
1516
```
1617
pip3 install polytracker
1718
```
19+
1820
PolyTracker requires a very particular system environment to run, so almost all users are likely to run it
1921
in a virtualized environment. Luckily, `polytracker` makes this easy. All you need to do is have `docker` installed,
2022
then run:
23+
2124
```
2225
polytracker docker pull
2326
```
27+
2428
and
29+
2530
```
2631
polytracker docker run
2732
```
33+
2834
The latter command will mount the current working directory into the PolyTracker Docker container,
2935
and allow you to build and run instrumented programs.
3036

@@ -33,15 +39,17 @@ Docker container—has a variety of commands, both for instrumenting programs as
3339
resulting artifacts. For example, you can explore the dataflows in the execution, reconstruct the
3440
instrumented program's control flow graph, and even extract a context free grammar matching the
3541
inputs accepted by the program. You can explore these commands by running
42+
3643
```
3744
polytracker --help
3845
```
3946

40-
## Instrumenting a simple C/C++ program
47+
## Instrumenting a simple C/C++ program
4148

4249
The following assumes you are working inside of the Docker container.
4350

44-
If you have a C target, you can instrument it by invoking the C compiler and passing the `--instrument-target` before your cflags
51+
If you have a C target, you can instrument it by invoking the C compiler and passing the `--instrument-target` before your cflags
52+
4553
```
4654
${CC} --instrument-target -g -o my_target my_target.c
4755
```
@@ -52,54 +60,61 @@ Repeat the same steps above for a cxx file by invoking `${CXX}` instead of `${CC
5260

5361
PolyTracker has only been tested on x86\_64 Linux. (Notably, the [DataFlow Sanitizer](https://clang.llvm.org/docs/DataFlowSanitizer.html) that PolyTracker builds upon _does not_ work on macOS.)
5462

55-
PolyTracker depends on [gllvm](https://github.com/SRI-CSL/gllvm) to create whole program bitcode archives and to extract bitcode from targets.
63+
PolyTracker depends on [gllvm](https://github.com/SRI-CSL/gllvm) to create whole program bitcode archives and to extract bitcode from targets.
5664

57-
PolyTracker depends on python3.7+
65+
PolyTracker depends on python3.7+
5866

5967
The following tools and libraries are required to run PolyTracker:
68+
6069
* LLVM version 7 or 7.1; other later versions may work but have not been tested. The builds in the official Ubuntu Bionic repository appear to be broken; we suggest building LLVM from source or installing it from the official LLVM repositories
6170

6271
## Manually building the examples
6372

6473
Check out this Git repository. From the root, build the base PolyTracker Docker image:
74+
6575
```
6676
docker build -t trailofbits/polytracker .
6777
```
6878

6979
This will create a Docker container with PolyTracker built, and the `CC` environment variable set to `polybuild`. Simply add the code to be instrumented to this container, and as long as its build process honors the `CC` environment variable, the resulting binary will be instrumented.
7080

7181
For a demo of PolyTracker running on the [MuPDF](https://mupdf.com/) parser run this command:
82+
7283
```
7384
docker build -t trailofbits/polytracker-demo -f examples/pdf/Dockerfile-mupdf.demo .
7485
```
7586

76-
`Mutool_track` will be build in `/polytracker/the_klondike/mupdf/build/debug`. Running `mutool_track` will output `polytracker.json` which contains the information provided by the taint analysis. Its reccomended to use this json with [PolyFile](https://www.github.com/trailofbits/PolyFile).
87+
`Mutool_track` will be build in `/polytracker/the_klondike/mupdf/build/debug`. Running `mutool_track` will output `polytracker.json` which contains the information provided by the taint analysis. Its recommended to use this json with [PolyFile](https://www.github.com/trailofbits/PolyFile).
7788

78-
For a demo of PolyTracker running on Poppler utils version 0.84.0 run this command:
89+
For a demo of PolyTracker running on Poppler utils version 0.84.0 run this command:
7990

8091
```
8192
docker build -t trailofbits/polytracker-demo -f examples/pdf/Dockerfile-poppler.demo .
8293
```
8394

84-
All the poppler utils will be located in `/polytracker/the_klondike/poppler-0.84.0/build/utils`.
95+
All the poppler utils will be located in `/polytracker/the_klondike/poppler-0.84.0/build/utils`.
8596

8697
```
8798
cd /polytracker/the_klondike/poppler-0.84.0/build/utils
8899
POLYPATH=some_pdf.pdf ./pdfinfo_track some_pdf.pdf
89100
```
90101

91-
## Building PolyTracker from Source
102+
## Building PolyTracker from Source
92103

93104
The following tools are required to build PolyTracker:
105+
94106
* [CMake](https://cmake.org)
95107
* [Ninja](https://ninja-build.org) (`ninja-build` on Ubuntu)
96108
* Python 3.7 and `pip`, for testing purposes (`apt-get -y install python3.7 python3-pip`)
97109

98110
First, make sure that the LLVM 7 binaries have priority in your `PATH`, _e.g._,
111+
99112
```
100113
export PATH="/usr/lib/llvm-7/bin:${PATH}"
101114
```
115+
102116
Next, from the root directory of this repository, run
117+
103118
```
104119
mkdir build && cd build
105120
cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. && ninja install
@@ -124,7 +139,7 @@ git clone --recursive git://git.ghostscript.com/mupdf.git
124139
cd mupdf
125140
git submodule update --init
126141
make -j10 HAVE_X11=no HAVE_GLUT=no prefix=./bin install
127-
```
142+
```
128143

129144
Or if you would like to build the debug version, as we do in our Dockerfile:
130145

@@ -138,12 +153,11 @@ get-bc -b target
138153
${CC}/{CXX} --instrument-bitcode target.bc -o target_track --libs <any libs go here>
139154
```
140155

141-
If you aren't sure about what libraries you might need to link for a complex target, the enviornment variable `WLLVM_ARTIFACT_STORE` sets a directory that contains a mainfest that logs all build commands and artifacts used. You should be able to rebuild the target completely using information in the mantifest and the artifacts.
142-
156+
If you aren't sure about what libraries you might need to link for a complex target, the environment variable `WLLVM_ARTIFACT_STORE` sets a directory that contains a manifest that logs all build commands and artifacts used. You should be able to rebuild the target completely using information in the manifest and the artifacts.
143157

144-
## Environment Variables
158+
## Environment Variables
145159

146-
PolyTracker accepts configuration paramters in the form of environment variables to avoid recompiling target programs. The current environment variables PolyTracker supports is:
160+
PolyTracker accepts configuration parameters in the form of environment variables to avoid recompiling target programs. The current environment variables PolyTracker supports is:
147161

148162
```
149163
POLYPATH: The path to the file to mark as tainted
@@ -156,12 +170,12 @@ POLYEND: End offset to track
156170
157171
POLYOUTPUT: Provides a path/prefix to output polytracker information too
158172
159-
POLYCONFIG: Provides a path to a JSON file specifying setings
173+
POLYCONFIG: Provides a path to a JSON file specifying settings
160174
161-
WLLVM_ARTIFACT_STORE: Provides a path to an exisiting directory to store artifact/manifest for all build targets
175+
WLLVM_ARTIFACT_STORE: Provides a path to an existing directory to store artifact/manifest for all build targets
162176
```
163177

164-
## Configuration Files
178+
## Configuration Files
165179

166180
Rather than setting environment variables on every run, you can make a configuration file.
167181

@@ -172,9 +186,9 @@ Example:
172186
"POLYEND": 3,
173187
"POLYTTL": 16
174188
}
175-
```
189+
```
176190

177-
Polytracker will search for config files in the following way:
191+
Polytracker will search for config files in the following way:
178192
1. If POLYCONFIG is specified, it will grab it from there
179193
2. Checks current directory there is a polytracker_config.json
180194
3. Checks the .config directory under the users home ("~/.config/polytracker/polytracker_config.json")
@@ -187,7 +201,7 @@ be thrown.
187201

188202
The PolyTracker instrumentation looks for the `POLYPATH` environment variable to specify which input file's bytes are meant to be tracked. (Note: PolyTracker can in fact track multiple input files—and really any file-like stream such as network sockets—however, we have thus far only exposed the capability to specify a single file. This will be improved in a future release.)
189203

190-
The instrumented software will write its output to `polytracker_process_sets.json` and
204+
The instrumented software will write its output to `polytracker_process_sets.json` and
191205
`polytracker_forest.bin` in the current directory.
192206

193207
For example, with our instrumented version of MuPDF, run
@@ -198,36 +212,36 @@ On program exit, those artifacts will be created in the current directory.
198212
These artifacts can be inspected and manipulated by the `polytracker` tool on the host system.
199213
The artifacts are documented [here.](docs/ARTIFACTS.md)
200214

201-
The optional `POLYTRACE` enviornment variable can be set to `POLYTRACE=1` to produce a basic-block
215+
The optional `POLYTRACE` environment variable can be set to `POLYTRACE=1` to produce a basic-block
202216
level trace of the program. This trace data will be included in the output JSON file under the
203217
"`trace`" key.
204218

205-
## Creating custom ignore lists from pre-built libraries
219+
## Creating custom ignore lists from pre-built libraries
206220

207221
Attempting to build large software projects can be time consuming, especially older/unsupported ones.
208222
It's even more time consuming to try and modify the build system such that it supports changes, like dfsan's/our instrumentation.
209223

210224
There is a script located in `polytracker/scripts` that you can run on any ELF library and it will output a list of functions to ignore.
211-
We use this when we do not want to track information going through a specific library like libpng, or other sub components of a program. The `Dockerfile-listgen.demo` exists to build common open source libraries so we can create these lists.
212-
213-
This script is a slightly tweaked version of what DataFlowSanitizer has, which focuses on ignoring system libraries. The original script can be found in `dfsan_rt`.
225+
We use this when we do not want to track information going through a specific library like libpng, or other sub components of a program. The `Dockerfile-listgen.demo` exists to build common open source libraries so we can create these lists.
226+
227+
This script is a slightly tweaked version of what DataFlowSanitizer has, which focuses on ignoring system libraries. The original script can be found in `dfsan_rt`.
214228

215229
## Current Status and Known Issues
216230

217231
Taints will not propagate through dynamically loaded libraries unless
218232
those libraries were compiled from source using PolyTracker, _or_
219233
there is specific support for the library calls implemented in
220234
PolyTracker. There _is_ currently support for propagating taint
221-
throught the majority of uninstrumented C standard library calls.
235+
through the majority of uninstrumented C standard library calls.
222236
To be clear, programs that use uninstrumented functions will still run normally,
223237
however, operations performed by unsupported library calls will not
224238
propagate taint. We are currently working on adding robust support for
225239
C++ programs, but currently the best results will be from C programs.
226240

227-
Snapshotting is currently deprecated and not supported in the latest version.
241+
Snapshotting is currently deprecated and not supported in the latest version.
228242

229-
If there are issues with Docker please do a system prune and build with --no-cache for both PolyTracker
230-
and whatever demo you are trying to run.
243+
If there are issues with Docker please do a system prune and build with --no-cache for both PolyTracker
244+
and whatever demo you are trying to run.
231245

232246
The worst case performance of PolyTracker is exercised when a single
233247
byte in memory is simultaneously tainted by a large number of input
@@ -242,7 +256,7 @@ This research was developed by [Trail of
242256
Bits](https://www.trailofbits.com/) with funding from the Defense
243257
Advanced Research Projects Agency (DARPA) under the SafeDocs program
244258
as a subcontractor to [Galois](https://galois.com). It is licensed
245-
under the [Apache 2.0 lisense](LICENSE). © 2019, Trail of Bits.
259+
under the [Apache 2.0 license](LICENSE). © 2019, Trail of Bits.
246260

247261
## Maintainers
248262
[Carson Harmon](https://github.com/notBD)<br />

0 commit comments

Comments
 (0)