Development Tools and SDK Setup
The Cheri team provide a tool called Cheribuild, this is a Python script that does a lot of the heavy lifting to help get the Cheri SDK and build tools setup on a Linux machine, for this testing I am using an Ubuntu 18.04 server.
https://github.com/CTSRD-CHERI/cheribuild
A quick note on SDK Architecture
The script provides several different architectures to choose from, it depends on what your end device may look like but build tools support cross compiling into all of these.
- riscv64
- mips64
- aarch64
- Morello (Software implementation of Morello board)
Each of these will usually provide 3 different options, these specify the level of Cheri implementation with these builds. I will use riscv64 as an example but each of the other archtectures have these three options apart from Morello which only has hybrid and purecap.
riscv64:
This is the native implementation of the emulator without Cheri support so standard applications for this architecture should run as normal.
riscv64-hybrid:
Adds Cheri support to the kernel, some of the apps support Cheri. Cheri capabilities can be used with __capability annotation.
riscv64-purecap
Adds Cheri support to the kernel and all userspace programs are built with Cheri support.
CheriBSD
The creators of Cheri have also created CheriBSD which is a modified version of FreeBSD, this provides testers with a fully fledged operating systems for testing and well as support for native Cheri C/C++ code.
https://github.com/CTSRD-CHERI/cheribsd
https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/cheribsd.html
https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/cheri-qemu.html
Setting up the CheriBSD QEMU Virtual Machine:
Cheribuild makes it easy to get up and running with a Cheri QEMU VM running your chosen architecture version
After getting all the dependencies installed as listing in the project README I ran the below command to create and run a VM which runs the hybrid version of the RISCV architecture. This will allow me to test both standard and Cheri implementations.
https://github.com/CTSRD-CHERI/cheribuild/blob/master/README.md
cheribuild.py –include-dependencies run-riscv64-hybrid
This may take a few hours to complete the first build but once complete I am presented with a login prompt for the CheriBSD operating system. We can now use this to test some proof of concept examples.
The next post will cover some of the proof of concept examples to show the virtual machine is running as expected.