Skip to main content

Bubblewrap

Simple Story

The special examination room has new features against cheating. One of them sets out the worksheets before the pupil comes in.

Some worksheets are there to read but not to change. Worksheets not meant for the pupil are not in the room at all: not forbidden, but absent. Nobody uses this room yet when the teacher picks up the rule sheet for each question. This page tells how an earlier version of the room worked.

Who is who

Historical design

Where this page names a Phobos layer or script, it describes the scripts Ares used to bundle, which it no longer ships. Current Phobos works differently; see the Phobos documentation.

What it is​

Bubblewrap (bwrap) is an unprivileged sandboxing tool. It uses Linux namespaces to give a process a different view of the system, most importantly a mount namespace, in which the visible file system is assembled from scratch.

It needs no root, which is what makes it usable on an ordinary continuous integration (CI) runner.

How Phobos uses it​

phobos-filesystem.sh builds the argument list from the policy:

ArgumentEffect
--ro-bind <path> <path>the path is visible but read-only
--bind <path> <path>the path is visible and writable
--tmpfs <path>the path is replaced by an empty temporary filesystem, hiding what was there

The three map onto the file policy: readable paths are bound read-only, writable paths are bound writable, and hidden paths get a tmpfs over them.

This is interception at the kernel level and an allow list of paths, applied by a wrapper process that execs the build command inside the namespace it has just built.

Further reading​