2016-10-07 18:34:42 +00:00
|
|
|
# base-libfuzzer
|
|
|
|
> Abstract base image for libfuzzer builders.
|
|
|
|
|
2016-10-26 15:28:38 +00:00
|
|
|
`docker run -ti <image_name> <command> <arguments>`
|
|
|
|
|
2016-11-11 23:25:37 +00:00
|
|
|
# Supported Commands
|
2016-10-07 18:34:42 +00:00
|
|
|
|
2016-10-26 15:28:38 +00:00
|
|
|
| Command | Description |
|
|
|
|
|---------|-------------|
|
|
|
|
| `compile` (default) | build all fuzzers
|
|
|
|
| `reproduce <fuzzer_name> <fuzzer_options>` | build all fuzzers and run specified one with `/testcase` content.
|
|
|
|
| `run <fuzzer_name> <fuzzer_options...>` | build all fuzzers and run specified one with given options.
|
|
|
|
| `test` | build all fuzzers and run each one for a little while to verify it is working correctly.
|
|
|
|
| `/bin/bash` | drop into shell, execute `compile` script to start build.
|
2016-10-07 18:34:42 +00:00
|
|
|
|
2016-10-13 21:02:19 +00:00
|
|
|
# Image Files Layout
|
|
|
|
|
2016-11-18 19:16:38 +00:00
|
|
|
|
2016-10-13 21:02:19 +00:00
|
|
|
| Location | Description |
|
|
|
|
| -------- | ---------- |
|
2016-11-18 19:16:38 +00:00
|
|
|
| `/out/` (`$OUT`) | build artifacts should be copied here |
|
|
|
|
| `/src/` (`$SRC`) | place to checkout source files |
|
|
|
|
| `/work/`(`$WORK`) | used to store intermediate files |
|
2016-10-17 21:32:10 +00:00
|
|
|
| `/usr/lib/libfuzzer.a` | libfuzzer static library |
|
2016-10-13 21:02:19 +00:00
|
|
|
|
2016-11-18 19:16:38 +00:00
|
|
|
While files layout is fixed within a container, `$SRC`, `$OUT`, `$WORK` are
|
|
|
|
provided to be able to write retargetable scripts.
|
|
|
|
|
|
|
|
|
|
|
|
## Compiler Flags
|
2016-10-13 21:02:19 +00:00
|
|
|
|
2016-10-25 23:36:29 +00:00
|
|
|
You *must* use special compiler flags to build your target and fuzzers.
|
2016-10-13 21:02:19 +00:00
|
|
|
These flags are provided in following environment variables:
|
|
|
|
|
|
|
|
| Env Variable | Description
|
|
|
|
| ------------- | --------
|
|
|
|
| `$CC` | The C compiler binary.
|
|
|
|
| `$CXX`, `$CCC` | The C++ compiler binary.
|
|
|
|
| `$CFLAGS` | C compiler flags.
|
|
|
|
| `$CXXFLAGS` | C++ compiler flags.
|
|
|
|
|
|
|
|
Many well-crafted build scripts will automatically use these variables. If not,
|
|
|
|
passing them manually to a build tool might be required.
|
|
|
|
|
2016-11-18 19:16:38 +00:00
|
|
|
|
2016-10-07 18:34:42 +00:00
|
|
|
# Child Image Interface
|
|
|
|
|
2016-10-18 22:37:23 +00:00
|
|
|
## Sources
|
2016-10-07 18:34:42 +00:00
|
|
|
|
2016-10-18 22:37:23 +00:00
|
|
|
Child image has to checkout all sources it needs to compile fuzzers into
|
2016-11-18 19:16:38 +00:00
|
|
|
`$SRC` directory. When the image is executed, a directory could be mounted
|
2016-10-18 22:37:23 +00:00
|
|
|
on top of these with local checkouts using
|
2016-10-25 23:36:29 +00:00
|
|
|
`docker run -v $HOME/my_target:/src/my_target ...`.
|
2016-10-07 18:34:42 +00:00
|
|
|
|
2016-10-18 22:37:23 +00:00
|
|
|
## Other Required Files
|
2016-10-10 20:21:45 +00:00
|
|
|
|
2016-10-18 22:37:23 +00:00
|
|
|
Following files have to be added by child images:
|
2016-10-10 20:21:45 +00:00
|
|
|
|
2016-10-18 22:37:23 +00:00
|
|
|
| File Location | Description |
|
|
|
|
| ------------- | ----------- |
|
2016-11-18 19:16:38 +00:00
|
|
|
| `$SRC/build.sh` | build script to build the target and its fuzzers |
|