Conversation
Guest control messages currently index ports and derived queues without validating the supplied port ID. Reject unknown PORT_READY and PORT_OPEN IDs before any port or queue access so malformed guest input cannot panic the VMM or change console state. Complete driver-to-device control chains with a used length of zero because the device does not write into them. Assisted-by: Codex:gpt-5.6-sol
The control transmit path currently reads an object from the head address without validating descriptor direction, declared length, chained layout, or guest memory ranges. That can read outside the driver-declared buffer and leave unreadable elements stranded. Validate the complete readable chain, accept scatter/gather layouts totaling exactly one control message, reject writable or malformed chains, and parse through the established descriptor Reader. Return every popped chain once with no device-written bytes. Assisted-by: Codex:gpt-5.6-sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Harden virtio-console driver-to-device control handling. Reject unknown port IDs before port access, and validate the complete descriptor chain before processing a control message.
What Changed
Validation
cargo fmt -- --checkin the root, examples, and tests workspaces.cargo test --locked -p krun-devicesat each logical commit: 48/48 and 51/51 unit tests passed; doc-tests passed.cargo test --locked -p krun-devices virtio::console::device::tests: 4/4 focused tests passed.cargo clippy --locked -p krun-devices -- -D warnings.python3 .github/scripts/check-ai-trailers.py proof/upstream-main-07fd40dcf6da.Official workspace/GPU clippy was not completed locally because the host lacks
libclang.dylibandepoxy.pc. Changed-crate clippy passes.Scope Notes
libkrun/libkrunmain at07fd40dcf6da8e14dd47e16a535531f0383fe52c.Signed-off-byamendments remain required before any upstream submission.