Skip to content

virtio/console: backport control validation to governed v1.19.4 - #4

Merged
dills122 merged 4 commits into
capsule/upstream-v1.19.4-r3from
codex/governed-console-control-validation-v1.19.4
Aug 5, 2026
Merged

dills122 merged 4 commits into
capsule/upstream-v1.19.4-r3from
codex/governed-console-control-validation-v1.19.4

Conversation

@dills122

@dills122 dills122 commented Aug 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Backport the two separately retained virtio-console control-message fixes from the fork's upstream-oriented main line to a fresh governed v1.19.4 candidate.

  • reject unknown PORT_READY and PORT_OPEN IDs before port or derived queue access;
  • read exact eight-byte control payloads through the descriptor-chain Reader, accepting valid scatter/gather and rejecting malformed, writable, unreadable, short, or trailing data;
  • complete every popped control transmit chain exactly once with used length zero;
  • preserve the governed line's duplicate-start and shutdown/output behavior.

The source fixes are fork main commits eef8449c7438636139ff7fce553816e49ddc25d7 and 69e4fa9af5b9f37ffa23ba7bb87929a73ee0daf8 from #3. The backport commits are separate because v1.19.4 predates the current console refactor.

Governance

This PR also repairs the fork branch model exposed by the earlier merge:

  • preserve original governed merge 4ea8d1de861ed1c0636fc800b6da8fb71a086aa5 under locked capsule/baseline-v1.19.4-r1;
  • leave historical governed head cf0333cdba478cc34a8570a65b38412da7fd3ecc locked;
  • target this PR to fresh candidate capsule/upstream-v1.19.4-r3;
  • route governed CI by versioned branch prefix and retain the upstream integration/guest-test exclusion;
  • update restoration mutations and exact test counts for the new queue-path tests.

Fork main remains upstream-oriented integration state. A merge there does not adopt bytes into Capsule; future adoption requires a separate governed backport.

While @dills122 is the only qualified maintainer, the mutable r3 target requires a pull request, green checks, resolved conversations, administrator enforcement, no force-push, no deletion, evidence/settings readback, and maintainer self-review, but GitHub requires zero approving reviews and does not require most-recent-push or CODEOWNER approval. External approval enforcement may be enabled when a second qualified maintainer is available. This does not waive DCO acceptance, later independent product-admission review, or final upstream-submission authorization.

Validation

  • cargo test -p krun-devices virtio::console::device::tests --locked -- --nocapture — 5 passed
  • governance/capsule-v1.19.4/scripts/verify-governed.sh — PASS
    • 53 default console/device tests
    • 4 bounded console coverage tests
    • 55 blk tests
    • Clippy with the single retained deprecation allowance
    • 25 shutdown and 25 queued-backpressure repetitions
    • AddressSanitizer PASS on local macOS arm64
    • 5 raw-FD and 4 console restoration mutations caught
  • /opt/homebrew/bin/python3.12 .github/scripts/check-ai-trailers.py cf0333c — PASS
  • workflow YAML parse and PATCH_QUEUE.json parse — PASS
  • fixed upstream ./run.sh test --test-case multiport-console --keep-all — OK - 1/1 passed on macOS 26.5.2 arm64/HVF; retained at /tmp/libkrun-tests.18jnmpKrYQ3T
  • governance-only single-maintainer follow-up: full local governed verifier, AI-trailer check, and git show --check — PASS;
  • exact-head governed pull-request run 31021879532 and push run 31021880674 — PASS; formatting, AI trailers, code quality, cross-compilation, and Linux x86_64 unit tests also pass;
  • Linux arm64 unit-test job in run 31021879591 remains queued for runner capacity, leaving GitHub merge state UNSTABLE without a test failure.

The governed library gate itself executed no guest. The separate fixed guest regression is bounded functional evidence only; it does not admit a backend, runtime, profile, release, or product path.

Review holds

  • Keep this PR draft pending maintainer self-review and an explicit human DCO decision.
  • The three functional commits and the governance-only follow-up intentionally have no Signed-off-by trailer. A human must review the result and explicitly accept DCO responsibility before merge.
  • After acceptance, lock the resulting r3 head and make r3 the fork default.

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
Preserve the original v1.19.4 patch-queue merge under an immutable baseline ref and route later governed updates through fresh versioned targets. Treat fork main as upstream-oriented integration state and require separate backports for Capsule adoption.

Update workflow routing, corpus counts, and restoration mutations for the console control validation backport.

Assisted-by: Codex:gpt-5.6-sol
Assisted-by: Codex:gpt-5.6-sol
@dills122
dills122 marked this pull request as ready for review August 5, 2026 16:05
@dills122
dills122 merged commit 7432eda into capsule/upstream-v1.19.4-r3 Aug 5, 2026
15 of 16 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.

1 participant