Developers

Build compartments

A CHERI compartment is a software boundary with deliberately limited authority, explicit entry points and carefully designed data and capability exchange.

For
Developers, engineering managers and educators
Last reviewed
2026-08-05
Review cycle
Review every 6 months

What you’ll do

A compartment is a software boundary with deliberately limited authority. Building one means choosing a component, defining the capabilities it receives, creating a narrow call interface and deciding how faults are handled.

Before you begin

Compartmentalisation can limit the blast radius of a vulnerable parser, driver or third-party library even when that component still contains bugs.

Steps

1. Choose a boundary

Select a component with meaningful risk and a manageable interface, not an arbitrary source-code directory.

2. Minimise authority

Pass only the memory, operations and services required for each call; avoid ambient access.

3. Handle failure

Define timeouts, restart, state recovery, logging and the effect of a compartment fault on the wider service.

Check your result

A compartment is only as strong as its entry points, delegated capabilities and shared state. Performance and assurance depend on the implementation.

Record the architecture, platform, ABI, release, source revision and complete commands. A second developer should be able to reproduce the result.

Useful references

Continue

Wrap one untrusted-input component, document its authority before and after, then test invalid calls and recovery paths.

Understand the compartment model