Skip to content

Extract QEMU/virtiofsd logic into bcvk-qemu crate#215

Merged
cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters:qemu-internals-crates
Feb 27, 2026
Merged

Extract QEMU/virtiofsd logic into bcvk-qemu crate#215
cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters:qemu-internals-crates

Conversation

@cgwalters
Copy link
Collaborator

Right now we have this unfortunate duality in that for ephemeral we directly spawn qemu, but obviously the libvirt verb defers all that to libvirt.

There are other use cases that effectively want to directly control qemu, and while there are certainly other Rust libraries wrapping qemu, ours is okay.

This makes our internals a crate that could be used as a git dependency (no intention to publish to crates.io).

The kit crate now re-exports from bcvk-qemu to maintain backward compatibility. A QemuConfigExt trait bridges kit's Format type with bcvk-qemu's DiskFormat.

Tested by patching bootc PR #2018 to use bcvk-qemu via [patch.crates-io], which builds successfully and uses spawn_virtiofsd_async() for the anaconda test infrastructure.

Assisted-by: OpenCode (claude-opus-4-5-20250114)

Right now we have this unfortunate duality in that for `ephemeral`
we directly spawn qemu, but obviously the `libvirt` verb defers
all that to libvirt.

There are other use cases that effectively want to directly
control qemu, and while there are certainly *other* Rust
libraries wrapping qemu, ours is okay.

This makes our internals a crate that could be used as
a `git` dependency (no intention to publish to crates.io).

The kit crate now re-exports from bcvk-qemu to maintain backward
compatibility. A QemuConfigExt trait bridges kit's Format type with
bcvk-qemu's DiskFormat.

Tested by patching bootc PR #2018 to use bcvk-qemu via [patch.crates-io],
which builds successfully and uses spawn_virtiofsd_async() for the
anaconda test infrastructure.

Assisted-by: OpenCode (claude-opus-4-5-20250114)
Signed-off-by: Colin Walters <walters@verbum.org>
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the project by extracting QEMU and virtiofsd logic into a new bcvk-qemu crate, improving modularity and reusability. The new crate is well-structured, and the kit crate is adapted cleanly. However, a security audit identified potential injection vulnerabilities where untrusted input (from CLI arguments or the guest VM) is used to construct QEMU command-line arguments or systemd notifications without proper escaping or sanitization. Specifically, unescaped commas in QEMU arguments can lead to option injection, and unescaped newlines in VSOCK data can lead to notification spoofing, which are critical for robust isolation between the host and the guest VM. Additionally, there is a suggestion for improvement regarding socket handling in the vsock implementation.

Copy link
Contributor

@ckyrouac ckyrouac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick read through looking for anything obviously wrong or malicious. LGTM

@cgwalters cgwalters merged commit 7187771 into bootc-dev:main Feb 27, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants