Building the S2E platform manually
The simplest way to build S2E is to use the s2e-env tool. It is the preferred method for development. See Using
s2e-env for instructions. However, some build features are not exposed by s2e-env and you will have
to run them manually.
Note
S2E builds and runs on Ubuntu 22.04 LTS and Debian 11/12 (64-bit). Earlier versions may still work, but we do not support them anymore.
Building in a container
You can create a self-contained container image that lets you analyze any supported binary. S2E builds and runs its container images with rootless Podman.
Host requirements
Install the podman and uidmap packages together with their recommended packages. Rootless containers need some
of the recommended packages, such as passt or slirp4netns for network access and dbus-user-session for the
session bus. Log out and log in again after the installation, so that the session bus is available. Your user must also
have a subordinate UID and GID range in /etc/subuid and /etc/subgid. useradd creates one by default.
sudo apt-get install podman uidmap
On Debian 12, Podman uses the slow vfs storage driver by default. Add the following to
~/.config/containers/storage.conf to use the kernel’s overlay driver instead, then run podman system reset.
This command deletes all existing Podman images and containers.
[storage]
driver = "overlay"
Note
Environments built with Docker are not supported. Delete their build folders, stamps and images, or create a fresh environment.
Building the demo image
The following command builds the demo image.
# Checkout S2E sources (using Google Repo)
# S2EDIR must be in your home folder (e.g., /home/user/s2e)
cd $S2EDIR
repo init -u https://github.com/s2e/manifest.git
repo sync
# Create a build directory
mkdir build && cd build
# Build the container image
make -f $S2EDIR/Makefile.container demo
You can then run it as follows:
podman run --rm -ti -w $(pwd) -v $HOME:$HOME cyberhaven/s2e-demo /demo/run.sh /demo/CADET_00001
This command starts the s2e-demo container and creates an S2E environment in $(pwd)/s2e-demo. It then downloads a
VM image and creates a default S2E configuration suitable for running the specified binary. Once configuration is done,
the container starts S2E.
The S2E environment in $(pwd)/s2e-demo is persistent. It is not kept in the container. You may run the container
multiple times without losing the previous settings. This is possible by mounting your home folder in the container.
In rootless Podman, container root is the calling user, so the files that the container creates belong to you. The
image expects rootless Podman. With Docker, these files would belong to the host’s root user.
You may specify any binary you want and are not restricted to binaries stored inside the container. You just need to
mount the folder that contains it using the -v option.
Building S2E manually
In addition to using the s2e-env tool, you can also build S2E manually.
Required packages
You must install a few packages in order to build S2E manually. Instead of giving you a list that will get out-of-date very quickly, we will give you some pointers that should be always up-to-date:
The packages for the build toolchain and S2E dependencies can be found in the S2E Dockerfile.
The packages required to build the guest images can be found here.
Checking out S2E
The S2E source code can be obtained from the S2E git repository using the following commands. Here $S2EDIR is the
directory that will hold both the S2E source and build directories.
cd $S2EDIR
repo init -u https://github.com/s2e/manifest.git
repo sync
This will set up the S2E repositories in $S2EDIR.
In order to contribute to S2E (e.g., submit new features or report bugs), please see here.
Building
The S2E Makefile can be run as follows:
mkdir $S2EDIR/build
cd $S2EDIR/build
make -f $S2EDIR/Makefile install
# Go make some coffee, this will take some time (approx. 60 mins on a 4-core machine)
By default, the make command compiles and installs S2E in release mode to $S2EDIR/build/opt. To change this
location, set the S2E_PREFIX environment variable when running make.
To compile S2E in debug mode, use make install-debug.
Note that the Makefile automatically uses the maximum number of available processors in order to speed up compilation.
Updating
You can use the same Makefile to recompile S2E either when changing it yourself or when pulling new versions through
repo sync. Note that the Makefile will not automatically reconfigure the packages; for deep changes you might need
to either start from scratch by issuing make clean or to force the reconfiguration of specific modules by deleting
the corresponding files from the stamps subdirectory.
Building the documentation
The S2E documentation is written in reStructuredText format. HTML documentation can be built as follows:
$ sudo apt-get install linkchecker
$ pip install sphinx_rtd_theme
$ cd $S2EDIR/s2e/docs/sphinx
$ ./build.sh
The documentation will be located in $S2EDIR/s2e/docs/sphinx/build/html/index.html.