Skip to content

microVM: reconcile the 64-KiB command-line limit with the guest kernel's limit #570

Closed

Description

Summary

Section 5.1.2 of the architecture guide in doc/design/ limits the complete NUL-terminated kernel command line to 64 KiB, and OpenVMM enforces exactly that limit. The NVX guest kernel parses less: x86 Linux's COMMAND_LINE_SIZE is 2,048 bytes, as scripts/nvx_tools/sandbox.py also assumes, and neither kernel/config-microvm nor kernel/patches/ changes it. The VMM cannot read the kernel's limit from the uncompressed ELF image either.

OpenVMM can therefore accept a command line between 2 KiB and 64 KiB that the guest kernel truncates, and it reports no error. The machine profile appends its own tokens last (device discovery, nvx_control_tty=hvc2, and the network and host filesystem bootstrap tokens), so they are the first to be lost. This contradicts the rule that invalid configurations are rejected, never silently adjusted (section 1.4.1).

This is a gap in the architecture guide rather than an implementation deviation. Found while auditing the implementation against the guide.

Where it applies

Options

  • State the guest kernel's limit in section 5.1.2, and have OpenVMM reject an effective command line that exceeds it.
  • Raise the guest kernel's command-line size with a kernel patch, so that the 64-KiB contract holds end to end.

Tasks

  • Choose an option and update section 5.1.2 of the architecture guide.
  • Implement it in nanvix/openvmm, and promote the pin, or in kernel/patches/.
  • Add a boot test with a command line near the limit that checks that the last machine-profile token reaches the guest.
  • If the guest kernel's limit rises above 4 KiB, make the managed agent read /proc/cmdline to its end within the new limit. The C agent and its Rust port in Port the managed agent to Rust #531 (mappings::prepare) read at most 4,095 bytes, so the agent would miss a later nvx_maps= token and refuse MAPS (#531 review).

Activity

  1. esaurez commented on Oct 20, 2026

    @esaurez
    Contributor

    #622 (A4) delivers this: OpenVMM rejects a kernel command line over 2,048 bytes, including the terminating NUL, which matches the guest kernel. #591 replaces the 64 KiB statement in section 5.1.2. Tracked under #535.

  2. esaurez commented on Oct 23, 2026

    @esaurez
    Contributor

    The VMM part landed in #661: OpenVMM refuses an effective command line over 2,047 bytes. Once #591 merges with the Section 5.1.2 update, this can close.

  3. ppenna commented on Oct 29, 2026

    @ppenna
    ContributorAuthor

    All four tasks are done on dev:

    Task Status
    Choose an option and update section 5.1.2 #661 took the first option, and #1013 states the guest kernel's 2,048-byte COMMAND_LINE_SIZE in section 5.1.2.
    Implement it in OpenVMM and promote the pin Done in #661. The current pin, bd2b27a2e, refuses before boot an effective command line over 2,047 bytes, both on a cold boot and on a restore.
    Add a boot test near the limit Done in #661: the command-line-limit microVM scenario, in the default test-microvm set.
    Make the managed agent read /proc/cmdline to its end above 4 KiB Not needed: the limit stays at 2,048 bytes.

    I re-ran the scenario at dev 8f3a840f6 on three test VMs; the later 270820dcd adds only performance baselines. nvx-rs was built at that commit, and the OpenVMM and guest artifacts came from release v0.1.0-dev.17fb8404d575, which has the same OpenVMM pin, kernel, and guest init. I also passed nvx-rs run a plain --cmdline over the limit. That path has no launcher budget, so OpenVMM's check is the only guard.

    Host profile Backend command-line-limit nvx-rs run over the limit
    nvx-kvm-test KVM Passed Refused before boot, exit 1
    nvx-mshv-test MSHV Passed Refused before boot, exit 1
    nvx-whp-test WHP Passed Refused before boot, exit 1

    On every host:

    • The guest's /proc/cmdline held exactly 2,047 bytes, ending with the machine profile's last token, virtnet_gw6=fd00::a00:1.
    • OpenVMM refused a 2,048-byte command line before boot with microVM kernel command line is 2048 bytes; the limit is 2047 bytes plus the terminating NUL.
    • No run fell back to a host CPU profile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions