Commit graph

16 commits

Author SHA1 Message Date
Zach Reizner
e0983c7625 add plugin_proto crate
This module defines the protocol shared between the crosvm plugin
process and main crosvm process.

TEST=cargo build --features plugin
BUG=chromium:800626
CQ-DEPEND=CL:892048

Change-Id: I5dfbe845644b7489f1918cecfcc07f28a223aa42
Reviewed-on: https://chromium-review.googlesource.com/869355
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-01-30 17:47:17 -08:00
Dylan Reid
76968703ad Add qcow support crate
QCOW2 files will be used to store the VM's data on ChromeOS. Add
support for basic reading and writing of qcow files.

CQ-DEPEND=CL:872451
BUG=none
TEST=qcow unit tests and use "qemu-image check" to verify generated qcow
files.

Change-Id: I4b9e77e58edca69f894ede19e79ebd2cd7b2623e
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/862628
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2018-01-19 23:29:52 -08:00
Zach Reizner
d42e493143 sys_util: add memfd seal support to SharedMemory
Getting and settings seals is useful to ensure the size of files
underlying memory mappings doesn't shrink, which can trigger a SIGBUS on
access to the truncated pages.

This also bumps the libc version to get MFD_ALLOW_SEALING.

TEST=cargo test
BUG=None
CQ-DEPEND=CL:850535

Change-Id: Ifbe1ec2c47d3d5c51b63472f545acc10d3c8eed2
Reviewed-on: https://chromium-review.googlesource.com/849488
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-01-05 14:28:44 -08:00
Dylan Reid
939d58827e Make the main crosvm project a workspace
Making the project a workspace allows running all local libs unit tests
from the main build.

Change-Id: Ib531dd10c21f324c7d25af69ad12b95c7bc8f3bc
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/759597
Reviewed-by: Zach Reizner <zachr@chromium.org>
2017-11-20 18:13:46 -08:00
Stephen Barber
7a2fec4596 crosvm: bump libc version to 0.2.32
Uprev to 0.2.32 for getgrnam_r.

BUG=none
TEST=./build_test
CQ-DEPEND=CL:734622

Change-Id: I4bc924633b179258c815eaf38f25e7e53d3f0fa5
Reviewed-on: https://chromium-review.googlesource.com/733729
Commit-Ready: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2017-10-25 19:30:15 -07:00
Dylan Reid
d169a8d9ed Move crosvm/hw to a new devices module
Moving the devices to their own module makes it easier to add tests that
use them.

Change-Id: I61bfef4037d16b20145b5fddce604835cdc4f67b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/706559
Reviewed-by: Zach Reizner <zachr@chromium.org>
2017-10-09 17:39:05 -07:00
Dylan Reid
94bf1bf6b4 Move vm_control to a top-level crate
Break out vm_control to a crate that will be able to used by more
modules. Having vm_control usable from outside crosvm makes it possible
to move the devices out of crosvm in a later commit.

Change-Id: I1f060700ed49b5d77519d55efa2430490d521256
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/706558
Reviewed-by: Zach Reizner <zachr@chromium.org>
2017-10-09 17:39:04 -07:00
Zach Reizner
ab839e293d fix dependency versions and add Cargo.lock
To ensure dependencies don't accidentally get updated, their versions are
fixed using the equals constraint. The Cargo.lock file is also checked in
so that the registry won't need to be downloaded by cargo.

These changes are needed so that the crosvm ebuild will not need to
download anything outside of its list of source packages.

TEST=./build_test
BUG=None

Change-Id: Iae8472de77e3589a453685717b26fb1ceb44e257
Reviewed-on: https://chromium-review.googlesource.com/674092
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2017-09-20 03:39:24 -07:00
Zach Reizner
1ea2f8ec34 crosvm: bump libc version to 0.2.29
This is so future changes can use getresuid/setresuid and similar
syscalls.

BUG=chromium:738638
TEST=./build_test

Change-Id: I47765fa1f45c549d8e148d02655dd61993a10f58
Reviewed-on: https://chromium-review.googlesource.com/655143
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2017-09-07 21:21:25 -07:00
Zach Reizner
efe957849b crosvm: argument parsing without clap
This removes the clap dependency by replacing that functionality with a
custom written parser. Binary size is reduced by about 60% in optimized
and stripped mode.

TEST=cargo run -- run -h
BUG=None

Change-Id: I2eaf6fcff121ab16613c444693d95fdf3ad04da3
Reviewed-on: https://chromium-review.googlesource.com/636011
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2017-09-02 00:18:25 -07:00
Zach Reizner
3cbded2c51 fix armv7a and aarch64 build errors and warnings
BUG=None
TEST=cargo build --target=armv7a-cros-linux-gnueabi &&
     cargo build --target=aarch64-cros-linux-gnu

Change-Id: I954c152f3c8086e24c4809dd5aabb5043fdd63af
Reviewed-on: https://chromium-review.googlesource.com/644408
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2017-09-01 12:39:18 -07:00
Zach Reizner
29ad3c7d0f crosvm: refactor and expand vm control socket IPC
This CL adds VM request capabilities to the control socket. These
requests include the basic exit as well as the essential ioeventfd and
irqfd requests. For virtio wayland, the register/unregister device
memory request was added.

TEST=cargo test
BUG=chromium:738638

Change-Id: I0cbf62d85a299cf454bcf6924a4e1d52d5b7183f
Reviewed-on: https://chromium-review.googlesource.com/602593
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2017-08-25 19:54:11 -07:00
Stephen Barber
2cfc2056aa crosvm: add vhost_net virtio device
vhost_net is an in-kernel implementation of a virtio_net device. This device
implementation is responsible only for negotiating features and setting up
vhost_net to point to the virtqueues in the guest.

Signed-off-by: Stephen Barber <smbarber@chromium.org>

BUG=chromium:738639
TEST=boot with networking enabled and ping host

Change-Id: I9192765b9348528a8a7a7f273e9522c2373d22fb
Reviewed-on: https://chromium-review.googlesource.com/538106
Commit-Ready: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2017-07-20 03:05:17 -07:00
Zach Reizner
f651357433 crosvm: use sys_util::clone_process to create proxy device
The `clone_process` function was created to safely encapsulate
fork/clone usage for the proxy device. This patch changes proxy device
to do utilize that.

TEST=cargo run -- -u <other crosvm args>...
BUG=None

Change-Id: I2d9f1794be61be31f3aae21037c7df14b7691172
Reviewed-on: https://chromium-review.googlesource.com/518935
Commit-Ready: Stephen Barber <smbarber@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2017-07-13 11:44:36 -07:00
Dylan Reid
61edbbff53 crosvm: Put block device process in a minijail
Run with the new seccomp filter and drop all capabilities.  In addition enter a
new user, mount, network, and ipc namespace.  Leave the mount namespace empty
after pivot-rooting to an empty directory.

Change-Id: Iee583cf260ede8ca13f005836684eb80c2c3ac3e
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/515603
2017-07-06 21:13:55 -07:00
Zach Reizner
639d96775c crosvm: Add crosvm main program
This program is used to boot a 64-bit kernel elf. It has support for
basic devices that are exposed to the kernel, including a block device.

TEST=cargo test;
     cargo run -- -m 512 -c 4 -d rootfs.squashfs -u -p "init=/bin/bash" vmlinux
BUG=chromium:712319

Change-Id: I25a8349a4624d8643fefe2ad70e517fe03b16b8c
Reviewed-on: https://chromium-review.googlesource.com/514417
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2017-07-05 21:54:52 -07:00