How to use CAmkES VMM with Linux

From Secure OS Wiki
Jump to navigation Jump to search

SeL4 can run in hypervisor mode with the VMM and guest OS running in the kernel and isolated from each other.[1][2] Camkes is the component framework for seL4 and Genode is considering embedding a Camkes component as a Genode component.[3] Here are some instructions for setting up a camkes vmm with linux. For more details, you can see the repo at reference 1[4]. I think there could be more info at https://docs.sel4.systems/projects/camkes-vm/.

1. Create a directory for the project.

   mkdir camkes_vm_examples
   cd camkes_vm_examples

2. Open a container.

   container

3. Fetch the project sources and check that VT-x is enabled, KVM is installed[5], and nested virtualization is enabled. You'll need to create a new username and password for libvert along the way[6][7]. [correct procedure?]

   repo init -u https://github.com/seL4/camkes-vm-examples-manifest.git
   repo sync
   sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virt-viewer    
   sudo saslpasswd2 -a libvirt <yournewusername>
   sudo adduser `id -un` libvirt

4. From the project root create a new folder to compile the project.

   mkdir build_vm
   cd build_vm

5. Invoke CMake using the shell script wrapper `init-build.sh` located in the root directory, passing the application you wish to compile as a command-line argument. If no application is passed the optiplex9020 app will be built by default. The applications are cma34cr_centos, cma34cr_ubuntu, minimal, optiplex9020, and zmq_samples.

   sudo ../init-build.sh -DCAMKES_VM_APP=<APPLICATION_NAME>

6. Invoke ninja to compile the example vm application

   sudo ninja

7. To simulate the camkes vm in qemu[8], enter:

   sudo ./simulate --machine q35,accel=kvm,kernel-irqchip=split --mem-size 2G --extra-cpu-opts "+vmx" --extra-qemu-args="-enable-kvm -device intel-iommu,intremap=off -net nic,model=e1000 -net tap,script=no,ifname=tap0"

8. To run on x86_64 hardware instead[9], enter:

   qemu-system-x86_64 -machine q35,accel=kvm,kernel-irqchip=split -cpu Nehalem,+vme,+pdpe1gb,-xsave,-xsaveopt,-xsavec,-fsgsbase,-invpcid,enforce,+vmx -nographic -serial mon:stdio -m size=2G -enable-kvm -device intel-iommu,intremap=off -net nic,model=e1000 -net tap,script=no,ifname=tap0 -kernel images/kernel-x86_64-pc99 -initrd images/capdl-loader-image-x86_64-pc99

References[edit | edit source]