Skip to content

Commit 290a891

Browse files
author
Sebastian Poeplau
committed
Convert the README to Markdown
1 parent b81356d commit 290a891

File tree

1 file changed

+48
-31
lines changed

1 file changed

+48
-31
lines changed

README renamed to README.md

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
2-
3-
SymCC: efficient compiler-based symbolic execution
4-
1+
# SymCC: efficient compiler-based symbolic execution
52

63
SymCC is a compiler wrapper which embeds symbolic execution into the program
74
during compilation, and an associated run-time support library. In essence, the
@@ -12,32 +9,37 @@ run time.
129
To build the pass and the support library, make sure that LLVM 8, 9 or 10 and Z3
1310
version 4.5 or later, as well as a C++ compiler with support for C++17 are
1411
installed. (Alternatively, see below for using the provided Dockerfile.) Make
15-
sure to pull the Qsym code:
12+
sure to pull the QSYM code:
1613

14+
```
1715
$ git submodule init
1816
$ git submodule update
17+
```
1918

20-
Note that it is not necessary or recommended to build the Qsym submodule - our
19+
Note that it is not necessary or recommended to build the QSYM submodule - our
2120
build system will automatically extract the right source files and include them
2221
in the build.
2322

2423
Create a build directory somewhere, and execute the following commands inside
2524
it:
2625

26+
```
2727
$ cmake -G Ninja -DQSYM_BACKEND=ON /path/to/compiler/sources
2828
$ ninja check
29+
```
2930

3031
If LLVM is installed in a non-standard location, add the CMake parameter
31-
"-DLLVM_DIR=/path/to/llvm/cmake/module". Similarly, you can point to a
32-
non-standard Z3 installation with "-DZ3_DIR=/path/to/z3/cmake/module" (which
32+
`-DLLVM_DIR=/path/to/llvm/cmake/module`. Similarly, you can point to a
33+
non-standard Z3 installation with `-DZ3_DIR=/path/to/z3/cmake/module` (which
3334
requires Z3 to be built with CMake).
3435

35-
The main build artifact from the user's point of view is symcc, a wrapper script
36-
around clang that sets the right options to load our pass and link against the
37-
run-time library. (See below for additional C++ support.)
36+
The main build artifact from the user's point of view is `symcc`, a wrapper
37+
script around clang that sets the right options to load our pass and link
38+
against the run-time library. (See below for additional C++ support.)
3839

3940
To try the compiler, take some simple C code like the following:
4041

42+
``` c
4143
#include <stdio.h>
4244
#include <stdint.h>
4345
#include <unistd.h>
@@ -60,21 +62,28 @@ int main(int argc, char* argv[]) {
6062
printf("%d\n", foo(x, 7));
6163
return 0;
6264
}
65+
```
6366
64-
Save the code as "test.c". To compile it with symbolic execution built in, we
67+
Save the code as `test.c`. To compile it with symbolic execution built in, we
6568
call symcc as we would normally call clang:
6669
70+
```
6771
$ ./symcc test.c -o test
72+
```
6873
6974
Before starting the analysis, create a directory for the results and tell SymCC
7075
about it:
7176
77+
```
7278
$ mkdir results
7379
$ export SYMCC_OUTPUT_DIR=`pwd`/results
80+
```
7481
7582
Then run the program like any other binary, providing arbitrary input:
7683
84+
```
7785
$ echo 'aaaa' | ./test
86+
```
7887
7988
The program will execute the same computations as an uninstrumented version
8089
would, but additionally the injected code will track computations symbolically
@@ -83,71 +92,77 @@ program reads from standard input is treated as symbolic; alternatively, you can
8392
set the environment variable SYMCC_INPUT_FILE to the name of a file whose
8493
contents will be treated as symbolic when read.
8594
86-
Note that due how the Qsym backend is implemented, all input has to be available
95+
Note that due how the QSYM backend is implemented, all input has to be available
8796
from the start. In particular, when providing symbolic data on standard input
8897
interactively, you need to terminate your input by pressing Ctrl+D before the
8998
program starts to execute.
9099
91100
When execution is finished, the result directory will contain the new test cases
92101
generated during program execution. Try running the program again on one of
93-
those or combine it with a fuzzer to automate this process (see below).
102+
those or combine it with a fuzzer to automate this process (see
103+
docs/Fuzzing.txt).
94104
95105
96-
Documentation
106+
## Documentation
97107
98-
The directory "docs" contains documentation on several internal aspects of
108+
The directory [docs](docs) contains documentation on several internal aspects of
99109
SymCC, as well as building C++ code, compiling 32-bit binaries on a 64-bit host,
100110
and running SymCC with a fuzzer.
101111
102112
103-
Building a Docker image
113+
## Building a Docker image
104114
105115
If you prefer a Docker container over building SymCC natively, just tell Docker
106-
to build the image after pulling the Qsym code as above. (Be warned though: the
116+
to build the image after pulling the QSYM code as above. (Be warned though: the
107117
Docker image enables optional C++ support and builds Z3 from source, so creating
108118
the image can take quite some time!)
109119
120+
```
110121
$ git submodule init
111122
$ git submodule update
112123
$ docker build -t symcc .
113124
$ docker run -it --rm symcc
125+
```
114126
115127
This will build a Docker image and run an ephemeral container to try out SymCC.
116-
Inside the container, "symcc" is available as a drop-in replacement for "clang",
117-
using the Qsym backend; similarly, "sym++" can be used instead of "clang++". Now
128+
Inside the container, `symcc` is available as a drop-in replacement for `clang`,
129+
using the QSYM backend; similarly, `sym++` can be used instead of `clang++`. Now
118130
try something like the following inside the container:
119131
132+
```
120133
container$ cat sample.cpp
121134
(Note that "root" is the input we're looking for.)
122135
container$ sym++ -o sample sample.cpp
123136
container$ echo test | ./sample
124137
...
125138
container$ cat /tmp/output/000008-optimistic
126139
root
140+
```
127141
128-
The Docker image also has AFL and "symcc_fuzzing_helper" preinstalled, so you
129-
can use it to run SymCC with a fuzzer as described in "docs/Fuzzing.txt". (The
130-
AFL binaries are located in "/afl".)
142+
The Docker image also has AFL and `symcc_fuzzing_helper` preinstalled, so you
143+
can use it to run SymCC with a fuzzer as described in [the
144+
docs](docs/Fuzzing.txt). (The AFL binaries are located in `/afl`.)
131145
132146
While the Docker image is very convenient for _using_ SymCC, I recommend a local
133147
build outside Docker for _development_. Docker will rebuild most of the image on
134148
every change to SymCC (which is, in principle the right thing to do), whereas in
135-
many cases it is sufficient to let Ninja figure out what to rebuild (and
136-
recompile libc++ only when necessary).
149+
many cases it is sufficient to let the build system figure out what to rebuild
150+
(and recompile, e.g., libc++ only when necessary).
137151
138152
139-
Contact
153+
## Contact
140154
141155
Feel free to use GitHub issues and pull requests for improvements, bug reports,
142156
etc. Alternatively, you can send an email to Sebastian Poeplau
143157
([email protected]) and Aurélien Francillon
144158
145159
146160
147-
Reference
161+
## Reference
148162
149163
To cite SymCC in scientific work, please use the following BibTeX:
150164
165+
``` bibtex
151166
@inproceedings {poeplau2020symcc,
152167
author = {Sebastian Poeplau and Aurélien Francillon},
153168
title = {Symbolic execution with {SymCC}: Don't execute, compile!},
@@ -158,9 +173,10 @@ To cite SymCC in scientific work, please use the following BibTeX:
158173
publisher = {{USENIX} Association},
159174
month = August,
160175
}
176+
```
161177

162178

163-
License
179+
## License
164180

165181
SymCC is free software: you can redistribute it and/or modify it under the terms
166182
of the GNU General Public License as published by the Free Software Foundation,
@@ -176,6 +192,7 @@ SymCC. If not, see <https://www.gnu.org/licenses/>.
176192
The following pieces of software have additional or alternate copyrights,
177193
licenses, and/or restrictions:
178194

179-
Program Directory
180-
------- ---------
181-
QSYM runtime/qsym_backend/qsym
195+
| Program | Directory |
196+
| --- | --- |
197+
| QSYM | `runtime/qsym_backend/qsym` |
198+

0 commit comments

Comments
 (0)