Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
sydbox: The ☮ther SⒶndbøx
Introduction
sydbox has been the default sandbox of Exherbo GNU/Linux distribution for
over a decade. We use it to provide a restricted environment under which package
builds run with controlled access to file system and network resources.
Exherbo package description format, currently exheres-0, uses a shell
function called esandbox to interact with sydbox. See the Sandboxing
section of Exheres for
Smarties
for more information.
History
sydbox-0is aptracebased sandbox.sydbox-1is aptrace+seccompbased sandbox.sydbox-2is aseccomp+seccomp-unotifybased sandbox.sydbox-3is a rewrite ofsydbox-2in Rust and it's what you are looking at.
This codebase has a history of over a decade and up to this point we have used
C11 as our implementation language for various reasons. With sydbox-3 we are
moving forwards one step and writing the sandbox from scratch using Rust
programming language with the only !Rust dependency being libseccomp.
Although we inherit many ideas and design decisions from the old codebase, we
also don't shy away from radically changing the internal implementation making
it much simpler, idiomatic, and less prone to bugs.
Security
This is a tricky area. The main advantage sydbox brings to the table is that
it requires no elevated privileges: no root access or ptrace capabilities are
needed. This makes sydbox very easy to set up and use. Moreover, sydbox
allows the user to configure the sandbox dynamically from within the sandbox,
and lock it as necessary afterwards. This comes at a cost though. sydbox makes
use of SECCOMP_USER_NOTIF_FLAG_CONTINUE to resume system calls after
dereferencing pointer arguments, and hence the sandbox is vulnerable to TOCTOU
attacks. This is something we accept and live with. That said sydbox takes
some mild precautions to make TOCTOU attacks less likely such as disallowing
system calls which can access remote process memory such as ptrace and
process_vm_writev, and disallowing write access to /proc/${pid}/mem.
This makes the attack vectors much harder to realize.
ChangeLog
3.0.0-alpha.2
- When run without arguments,
sydboxnow drops into user's current running shell allowlisting theHOMEdirectory. - Document the CLI option
-p,--profileand addnoipv4andnoipv6profiles in addition thepaludisprofile. These profiles may be stacked by specifying more than one-parguments. - Use a Seccomp
BPFfilter rather than aNotifyfilter for fakeroot mode. - Improve logging to achieve consistency. We have a very simple Logger which logs
to standard error in format
JSONlines. There are some common keysidis alwayssyd,lgives theLog::Levelas an integer whereby the lower the value of the integer the more severe is the log condition.tgives a UNIX time stamp in seconds, andctxhas short context on the log entry. Errors are represented with theerrkey, and system call names are given with thesyskey. - The
--profile <profile-name>and--config @<profile-name>is now supported.Paludisuses the former so it is important for compatibility. The profile file is no longer installed under${sharedir}/sydboxwhere{sharedir}is usually/usr/shareand is kept as a static array in the program itself. In the future whensydbox-3has an exheres we can improve on this but for now this gets us going. - The
setuidsystem call is now allowed in the sandbox. - Use
snmallocas the global allocator for improved performance.
3.0.0-alpha.1
-
New: Added
core/allowlist/successful_bind.- Utilizes
getsocknamehook,pidfd_getfd, andprocess_vm_writevfor complete emulation. - Features a
TTLof 3 mins for tracking addresses to manage zero port arguments inbind()system calls.
- Utilizes
-
Improved: Refined read, write, network/{bind,connect} sandboxing.
- Simpler implementation, yet compatible with
Paludisviaesandbox. - No per-process sandboxing or process tree tracking; uses
/proc/$pid/cwdwhen required. - Single set of sandbox rules with configurations pushed upfront.
- API Change: Replaced
allow,denymodes with simpleron/offtoggle. core/sandbox/networkcan be set tobindorconnectfor selective sandboxing.- Rule matching favors the latest rule for configuration stacking.
- Streamlined
core/trace/magic_lock:execdue to lack of parent/child tracking.
- Simpler implementation, yet compatible with
-
New: Introduced
seccompprocess supervision.- Implemented primarily in
syd::hookandsyd::remote. - Derived from the
greenhookcrate, but with a deny-by-defaultseccomppolicy. - Allowlisted system calls maintained in
syd::config(currently immutable by users). - Notable system calls like
ptrace,process_vm_writev, andio-uringare disabled to counteractTOCTOUvulnerabilities.
- Implemented primarily in
.. vim: set spell spelllang=en tw=80 : ..




