No description
Find a file
Alexandre Courbot eb9e563e4d virtio: vhost: user: allow listener to yield resources for parent process
A listener is responsible for managing and cleaning up its own
resources, but this can cause problems when jailing device processes.

Typically, the listener is created in the parent thread and then passed
to the device thread so the device thread does not require the
capabilities to allocate the listener's resources. However, when cleanup
time comes, the listener in the child is still responsible for
destroying the resources created by the parent, which may require extra
capabilities. For instance, for a vhost-user socket the listener is
expected to remove the socket file, but we don't necessarily want the
child to be able to remove files from the filesystem...

Fix this by adding a new method, take_parent_process_resources(), that
can be called prior to creating the child process by the parent in order
to obtain the resources that the parent needs to cleanup when the child
process exits. The resources are presented in the form of an opaque box
and must be kept by the parent until the child process exits. After
that, dropping the box will free the resources that we don't want the
child to clean up.

If we are not creating a child process, then the method is simply not
called and the listener will cleanup the resources itself.

BUG=b:218223240
TEST=vhost-user console device gets properly cleaned up.

Change-Id: I7b8c4b700a868f4fd100c45f0e577fddfe8bb216
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762972
Reviewed-by: Morg <morg@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-07-22 04:57:58 +00:00
.cargo crosvm: Fix cross-compile in dev container 2022-07-19 17:07:49 +00:00
.devcontainer crosvm: Fix cross-compile in dev container 2022-07-19 17:07:49 +00:00
.github Reland "github: Minimize dependencies for document generation" 2022-04-12 22:30:10 +00:00
aarch64 vmwdt: Add memory mapped watchdog backend driver 2022-07-21 14:07:11 +00:00
acpi_tables doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
anti_tamper crosvm: upstream windows src 2022-07-19 20:58:59 +00:00
arch devices: add pflash to provide NVRAM for OVMF 2022-07-21 23:17:32 +00:00
argh_helpers crosvm: move run command to argh 2022-06-13 23:55:20 +00:00
base main: restore --syslog-tag functionality 2022-07-16 03:17:26 +00:00
bin Deprecate old dev tooling scripts 2021-11-02 22:23:03 +00:00
bit_field crosvm: migrate to Rust 2021 edition 2022-03-09 01:16:03 +00:00
broker_ipc broker_ipc: fix child process logging init order. 2022-06-23 17:04:27 +00:00
ci/kokoro ci: skip choco checksum 2022-07-13 17:21:48 +00:00
common audio_streams: Upstream to support Windows 2022-07-15 20:33:15 +00:00
cros_async cros_async: Fix windows timer flake 2022-07-07 22:23:08 +00:00
crosvm-fuzz devices: virtio: disallow modification of ready queues 2022-07-01 06:03:56 +00:00
crosvm_control crosvm_control: Expose USB_CONTROL_MAX_PORTS 2022-07-13 03:01:24 +00:00
crosvm_plugin Rust 1.60 clippy fixes 2022-04-11 20:40:36 +00:00
devices virtio: vhost: user: allow listener to yield resources for parent process 2022-07-22 04:57:58 +00:00
disk disk: upstream windows support 2022-05-19 18:25:30 +00:00
docs/book docs: Fix link to building_crosvm.md 2022-07-22 01:52:58 +00:00
fuse doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
gpu_display gpu_display: fix overflow in EventDevice 2022-07-22 04:48:28 +00:00
hypervisor hypervisor: x86: remove apic_base and interrupt_bitmap from Sregs 2022-07-07 23:24:09 +00:00
infra infra: Add cros_workon flow to chromeos builder 2022-07-21 18:35:51 +00:00
integration_tests tools: Add crosvm-direct support for run_tests 2022-06-22 21:51:53 +00:00
io_uring base: remove WatchingEvents in favor of EventType 2022-06-06 17:07:33 +00:00
kernel_cmdline crosvm: migrate to Rust 2021 edition 2022-03-09 01:16:03 +00:00
kernel_loader kernel_loader: load ELF kernels at the right paddr 2022-06-23 22:30:37 +00:00
kvm base: clarify SharedMemory API 2022-06-01 03:55:47 +00:00
kvm_sys crosvm: Enable windows tests for a few crates 2022-06-07 14:37:43 +00:00
libcras_stub crosvm: migrate to Rust 2021 edition 2022-03-09 01:16:03 +00:00
linux_input_sys doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
logo README: Use PNG logo image 2021-10-29 01:56:23 +00:00
media libva: use slice rather than Vec for attributes 2022-07-15 17:41:15 +00:00
metrics crosvm: Fix drift 2022-07-21 23:13:18 +00:00
net_sys doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
net_util crosvm: Fix drift 2022-07-21 23:13:18 +00:00
power_monitor crosvm: build/test few more crates on windows 2022-06-22 00:48:23 +00:00
protos doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
qcow_utils doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
resources resources: implement Debug for AddressRange 2022-07-01 01:11:15 +00:00
rutabaga_gfx wl: allocate dma-bufs in process 2022-07-22 02:28:09 +00:00
seccomp wl: allocate dma-bufs in process 2022-07-22 02:28:09 +00:00
serde_keyvalue serde_keyvalue: parse hex, octal, and binary nums 2022-06-02 22:03:20 +00:00
src devices: add pflash to provide NVRAM for OVMF 2022-07-21 23:17:32 +00:00
system_api_stub crosvm: migrate to Rust 2021 edition 2022-03-09 01:16:03 +00:00
tests tests: disable plugin_hint test 2022-07-15 17:35:52 +00:00
third_party virtio: vhost: user: allow listener to yield resources for parent process 2022-07-22 04:57:58 +00:00
tools tools/cl: add prompt to set upstream branch if missing 2022-07-21 21:51:48 +00:00
tpm2 doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
tpm2-sys doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
tracing tracing: Add noop tracing 2022-06-16 21:13:55 +00:00
tube_transporter Cargo: bump all rand dependencies to 0.8 2022-06-30 23:22:37 +00:00
usb_sys doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
usb_util doc: add a top-level comment to all crates 2022-05-06 20:46:57 +00:00
vfio_sys Revert "direct_irq: Add support for host wakeup capable IRQs" 2022-05-19 14:28:46 +00:00
vhost crosvm: enable windows tests for vhost crate 2022-06-07 20:46:28 +00:00
virtio_sys virtio: create a DeviceType wrapper enum 2022-05-10 21:00:07 +00:00
vm_control wl: allocate dma-bufs in process 2022-07-22 02:28:09 +00:00
vm_memory vm_memory: move udmabuf support to vm_memory 2022-07-01 05:29:23 +00:00
win_audio crosvm: Fix drift 2022-07-21 23:13:18 +00:00
win_util crosvm: Fix drift 2022-07-21 23:13:18 +00:00
x86_64 devices: add pflash to provide NVRAM for OVMF 2022-07-21 23:17:32 +00:00
.dockerignore add docker supported builds and tests 2019-05-15 13:36:19 -07:00
.gitignore infra: Initial setup of linux pre/post-submit builders 2022-05-24 23:13:13 +00:00
.gitmodules Switch to submodules based workflow 2021-08-05 18:32:32 +00:00
.rustfmt.toml rustfmt, win_util: update to 2021 edition 2022-05-31 23:35:02 +00:00
ARCHITECTURE.md base: replace PollToken with EventToken tree-wide 2022-06-02 22:30:38 +00:00
Cargo.toml windows: adjust import paths and Cargo.toml deps 2022-07-21 17:19:50 +00:00
CONTRIBUTING.md crosvm: Make commands work. 2022-07-22 02:05:48 +00:00
LICENSE add LICENSE and README 2017-04-17 14:06:21 -07:00
navbar.md docs: Use mdformat to format markdown files 2022-01-27 21:29:11 +00:00
OWNERS OWNERS: Add comments 2022-07-05 10:34:14 +00:00
PRESUBMIT.cfg Switch main crosvm repo 2022-07-14 17:58:26 +00:00
README.chromeos.md Add documentation for ChromeOS workflows 2022-04-18 19:05:49 +00:00
README.md Switch main crosvm repo 2022-07-14 17:58:26 +00:00
run_tests Deprecate old dev tooling scripts 2021-11-02 22:23:03 +00:00
rust-toolchain Upgrade rust toolchain version to 1.58.1 2022-02-04 02:20:36 +00:00
setup_cros_cargo.sh Deprecate old dev tooling scripts 2021-11-02 22:23:03 +00:00
test_all Deprecate old dev tooling scripts 2021-11-02 22:23:03 +00:00
unblocked_terms.txt unblocked_terms.txt: clean up trivial cases 2021-04-26 20:32:38 +00:00

crosvm - The Chrome OS Virtual Machine Monitor

crosvm is a virtual machine monitor (VMM) based on Linuxs KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the Chrome OS platform. Compared to QEMU, crosvm doesnt emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.

crosvm is currently used to run Linux/Android guests on Chrome OS devices.

Logo