Repository navigation
doc: state the guest kernel's 2,048-byte command-line limit - #1013
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoOct 29, 2026
Merged
Conversation
Section 5.1.2 of the architecture guide said that the complete NUL-terminated kernel command line must fit in 64 KiB. The x86 guest kernel keeps less: its COMMAND_LINE_SIZE is 2,048 bytes, which neither kernel/config-microvm nor kernel/patches/ changes, and it silently drops the text beyond it. As the machine profile appends its own tokens after the caller's, ending with the network and host filesystem bootstrap tokens, a command line between 2 KiB and 64 KiB would have booted without them, and without an error, against section 1.4.1's rule that invalid configurations are rejected, never silently adjusted (#570). #661 chose to have OpenVMM enforce the guest kernel's limit. Since its pin, one shared check rejects, before boot, an effective command line of more than 2,047 bytes or one with an embedded NUL, and a restore checks its saved command line as saved instead of rewriting it. The boot test that #570 asked for, the command-line-limit microVM scenario, came with it, and the guest's readers of /proc/cmdline already read it whole. #661 left the guide at 64 KiB for the draft #591 to update. State the rule in section 5.1.2: the effective command line must fit, with its terminating NUL, in the guest kernel's 2,048-byte COMMAND_LINE_SIZE, which leaves at most 2,047 bytes of text. The kernel would silently drop the host-owned tokens first, and an uncompressed ELF image does not declare the limit to the loader, so the machine profile applies it as a fixed part of the boot contract: it checks the effective command line, its own tokens included, and rejects one that does not fit before any processor runs. A restore, which reuses the saved string verbatim, rejects one over the limit instead of rewriting it. The loader's 64-KiB placement region in Table 2.4 is unchanged, as it was in #661. On nvx-kvm-test (Linux/KVM), nvx-mshv-test (Linux/MSHV), and nvx-whp-test (Windows/WHP), with this change and the artifacts of release v0.1.0-dev.299d0b4d9851, whose OpenVMM is the pinned bd2b27a2 and whose commit differs from this change's parent only in performance-baseline data, the command-line-limit scenario passed. In each run, the guest's /proc/cmdline held exactly 2,047 bytes ending with the last host-owned token, virtnet_gw6=fd00::a00:1, and OpenVMM refused the 2,048-byte command line before boot with "microVM kernel command line is 2048 bytes; the limit is 2047 bytes plus the terminating NUL". scripts/check_markdown_links.py passes. Fixes #570 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for this documentation-only clarification of command-line limits and their enforcement during boot and restore.
No open issues 🎉
What changed in this PR
This documentation-only PR aligns the boot protocol guide with the command-line limit already enforced by OpenVMM, completing the remaining documentation task in #570.
Changes:
- Replaces the 64-KiB limit with 2,048 bytes including the terminating NUL, allowing 2,047 bytes of text.
- Explains why the machine profile rejects oversized command lines before processors run.
- Clarifies that restore rejects oversized saved command lines rather than rewriting them.
| File | Description |
|---|---|
doc/design/5.1-boot-protocol.md |
Documents the guest kernel’s command-line limit and its enforcement during boot and restore. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-570-command-line-limit
branch
October 29, 2026 17:59
This was referenced Oct 29, 2026
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.
Fixes #570.
Section 5.1.2 of the architecture guide still said that the complete NUL-terminated kernel command line must fit in 64 KiB. The x86 guest kernel keeps 2,048 bytes, including the terminating NUL, and since #661, OpenVMM rejects before boot an effective command line that doesn't fit. This pull request states that limit in section 5.1.2, with where it comes from, why the VMM enforces it, and how a restore treats a saved command line over it. That was #570's last open task.
Based on
devat470378692. One documentation commit. No code, test, or behavior changes.Where #570 stands
check_microvm_command_line, which runs on every cold boot and restore. The current pin,bd2b27a2e, still has it.command-line-limitmicroVM scenario, in the defaulttest-microvmset./proc/cmdlineto its end if the limit rises above 4 KiBmappings::preparereads up to 4,095 bytes, and every other guest reader of/proc/cmdline(cat,read -r,std::fs::read) reads the whole file.Change
377f25eafdocdoc/design/5.1-boot-protocol.mdCOMMAND_LINE_SIZE, which allows at most 2,047 bytes of text. It says why the machine profile enforces the limit: the kernel would silently drop the host-owned tokens first, and an uncompressed ELF image doesn't declare the limit to the loader. The profile rejects an effective command line that doesn't fit before any processor runs. A restore rejects a saved command line over the limit instead of rewriting it.The text matches the pinned OpenVMM:
MICROVM_COMMAND_LINE_MAX_SIZEinopenvmm_defs/src/microvm.rsis 2,048, documented as "the x86 guest kernel'sCOMMAND_LINE_SIZE".check_microvm_command_linerefuses an embedded NUL and any text of 2,048 bytes or more. The profile runs it after it appends each of its tokens.validate_machine_contract_shapeinopenvmm_helpers/src/snapshot/microvm.rschecks a snapshot's saved command line "as saved and never rewritten to fit".The guest kernel is Linux 6.18.38, which defines
COMMAND_LINE_SIZEas 2,048 on x86.kernel/config-microvmsets no built-in command line (CONFIG_CMDLINE_BOOLis not set), and no patch underkernel/patches/changes the size, so all 2,047 bytes reach the guest.As in #661, two things are unchanged:
0x20000..0x2ffffin Table 2.4 of section 2.3.nvx-rskeeps 1,024-byte budgets for its managed launches, its sandboxes, and the share tokens ofrun's aggregate, butrunpasses a plain--cmdlineto OpenVMM without a budget of its own, so OpenVMM's check is the one that applies there.Overlap with #591
Draft #591 rewrites the same paragraph, which #661 left for it to update. This pull request makes that change on its own, so #570 can close without waiting for #591's 19 files. #591 will conflict on this paragraph when it rebases. Its version also says that launchers keep a 1,024-byte caller budget, which
nvx-rs rundoesn't enforce for a plain--cmdline, as described above.Validation
Base:
devat47037869244e754bfef5fb7e471eec3185a9a7ff. Head:377f25eaf4ca576b153ea05b38e51f8f295bb8d7, signed.At the head, on Windows:
python scripts\check_markdown_links.pypasses. No test reads section 5.1.On three remote test hosts, I ran
python3 scripts/nvx.py test-microvm --scenario command-line-limit(pythonon Windows) with the backend shown below. Each host ran this branch's tree,536e72ff2, in a fresh worktree.nvx-rs downloadinstalled the artifacts of releasev0.1.0-dev.299d0b4d9851, which CI built from299d0b4d9. That commit has the same OpenVMM pin (bd2b27a2e) and guest inputs as this head's parent; the two differ only in performance-baseline data.nvx-kvm-testnvx-mshv-testnvx-whp-testOn every host:
/proc/cmdlineheld exactly 2,047 bytes, ending with the last host-owned token,virtnet_gw6=fd00::a00:1.fatal error: microVM kernel command line is 2048 bytes; the limit is 2047 bytes plus the terminating NUL, and no guest boot marker appeared.Left to CI: the change touches only documentation, so
nvx.py classify-ci-changesselects no suite (all six outputs arefalse). That leaves the quality checks, including the Markdown link check, and the required status check.