Developers
Use Rust with CHERI
Rust and CHERI address overlapping memory-safety risks at different layers and can be combined to protect safe code, unsafe code and component boundaries.
What you’ll do
Rust and CHERI address overlapping risk at different layers. Rust prevents many memory-safety errors in safe code; CHERI enforces hardware limits across native code, foreign-function interfaces, unsafe Rust and compartment boundaries.
Before you begin
Together they can provide stronger defence for mixed-language systems than either can provide across every component alone.
Steps
1. Keep safe Rust safe
Use ownership and type-system guarantees for new code and minimise unsafe blocks.
2. Treat interfaces as boundaries
Review FFI data layout, pointer provenance, allocation ownership and capability permissions.
3. Compartmentalise
Give Rust and non-Rust components only the authority they require, especially for untrusted inputs and third-party code.
Check your result
CHERI does not make unsafe Rust safe, and Rust support varies by target, runtime and library ecosystem. Verify the current toolchain.
Record the architecture, platform, ABI, release, source revision and complete commands. A second developer should be able to reproduce the result.