*

Quick hack: Experiments with crosvm

Tomeu Vizoso avatar

Posted on 09/11/2017 by Tomeu Vizoso

Share this post:

Last week I played a bit with crosvm, a KVM monitor used within Chromium OS for application isolation. My goal is to learn more about the current limits of virtualization for isolating applications in mainline. Two of crosvm's defining characteristics is that it's written in Rust for increased security, and that uses namespaces extensively to reduce the attack surface of the monitor itself.

It was quite easy to get it running outside Chromium OS (have been testing with Fedora 26), with the only complication being that minijail isn't widely packaged in distros. In the instructions below we hack around the issue with linker environment variables so we don't have to install it properly. Instructions are in form of shell commands for illustrative purposes only.

Build kernel:

    $ cd ~/src
    $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
    $ cd linux
    $ git checkout v4.12
    $ make x86_64_defconfig
    $ make bzImage
    $ cd .. 

Build minijail:

    $ git clone https://android.googlesource.com/platform/external/minijail
    $ cd minijail
    $ make
    $ cd .. 

Build crosvm:

    $ git clone https://chromium.googlesource.com/a/chromiumos/platform/crosvm
    $ cd crosvm
    $ LIBRARY_PATH=~/src/minijail cargo build 

Generate rootfs:

    $ cd ~/src/crosvm
    $ dd if=/dev/zero of=rootfs.ext4 bs=1K count=1M
    $ mkfs.ext4 rootfs.ext4
    $ mkdir rootfs/
    $ sudo mount rootfs.ext4 rootfs/
    $ debootstrap testing rootfs/
    $ sudo umount rootfs/

Run crosvm:

    $ LD_LIBRARY_PATH=~/src/minijail ./target/debug/crosvm run -r rootfs.ext4 --seccomp-policy-dir=./seccomp/x86_64/ ~/src/linux/arch/x86/boot/compressed/vmlinux.bin

The work ahead includes figuring out the best way for Wayland clients in the guest interact with the compositor in the host, and also for guests to make efficient use of the GPU.

 

Original post

Comments (0)


Add a Comment






Allowed tags: <b><i><br>Add a new comment:


Latest Blog Posts

An overview of the Panfrost driver

13/03/2019

During the past few months significant progress has been made on the Open Source Arm Mali GPU driver front, culminating in the Panfrost…

Quick hack: Raspberry Pi meets Linux kernel mainline

12/03/2019

With just a few simple steps, you can compile and boot a Raspberry Pi using the Linux kernel mainline source code. Here's how.

News from the Debian Cloud Team

05/03/2019

Since the last Debian release, a number of changes have been made in the Debian Cloud Team, both on the technical & organisational level…

Panfrost update: A new kernel driver

04/03/2019

Following two months of work to develop a new kernel driver for Midgard and Bifrost GPUs, the kernel side of Panfrost is now in a form close…

Modern USB gadget on Linux & how to integrate it with systemd (Part 1)

18/02/2019

A look at how to implement USB gadget devices on Linux machines which have the necessary UDC hardware, automate the manual configfs process…

FOSDEM 2019 - Recorded presentations (videos)

15/02/2019

From the latest on Open Source projects Zink (OpenGL on Vulkan) and VirGL (virtual 3D GPU for QEMU), to a state of the union on GStreamer…

Open Since 2005 logo

We use cookies on this website to ensure that you get the best experience. By continuing to use this website you are consenting to the use of these cookies. To find out more please follow this link.

Collabora Ltd © 2005-2019. All rights reserved. Website sitemap.