Skip to content

nvx: sandbox provision records a --cmdline or a .vmdk image that every start refuses #2159

In review

Description

Area

area: nvx

What is this bug about?

Trigger: nvx sandbox provision with options that the checks of a launch refuse, such as:

  • a --cmdline token that the sandbox profile owns, such as nvx_foo=1;
  • a --cmdline that hides from Linux the tokens that OpenVMM appends, such as a"b, with an unclosed double quote, or x -- y;
  • a --cmdline that exceeds the kernel command line's 1024-byte x86 budget;
  • a --layer image or --scratch path whose name ends in .vmdk, which OpenVMM would open with its VMDK backend rather than as a raw image.

Observed: provision exits 0 and writes config.json. Every later nvx sandbox start of the state directory then fails, before it launches OpenVMM, with one of:

error[unsupported]: disk paths ending in .vmdk are unsupported, since OpenVMM would not attach them as raw images: %TEMP%\nvx-provision-repro\distro.vmdk
error[unsupported]: nvx_foo is owned by the sandbox profile
error[unsupported]: sandbox kernel command line hides the tokens that OpenVMM appends to it
error[unsupported]: sandbox kernel command line exceeds its 1024-byte x86 budget; use shorter arguments and kernel parameters

Expected: provision refuses those options with the same errors before it records anything, as run does: nvx sandbox run with the same options fails at once with exactly these errors. The crate's README says that run "launches the VM that a provision and a start of its options would launch".

Cause: lifecycle::provision checks the images with check_images and writes the record of serialize_launch, which checks it only with Config::check and VmConfig::check (L438-L443). VmConfig::check checks the configuration's fields; it neither renders OpenVMM's arguments nor reads the kernel command line as Linux does. The checks that refuse the options above run only in a launch:

  • start runs the CLI's check_command_line on the recorded configuration (L142-L143), which refuses the tokens that the sandbox profile or --mount owns, a line over the 1024-byte budget, a conflict with the root's boot tokens, and a user part that hides the appended tokens from Linux.
  • vm::create then renders OpenVMM's arguments, for a cold start and for a restore, through VmConfig::device_arguments, which refuses a .vmdk image with reject_container_backend (L1169-L1190).

run applies both before it launches (start.rs#L717-L724: check_command_line(&config, &vm_config) and VmConfig::check_command_line); provision applies neither. check_images, which provision does apply, refuses .vhd, .vhdx, .vmgs, and .iso paths but not .vmdk, which only the launch's rendering refuses.

Why is this bug relevant?

Impact: A sandbox provisioned this way can never start: every start fails, and recovery takes deprovision and a new provision. The failure surfaces only at the first start, which a managed lifecycle may run much later, or from another process, than the provision that accepted the options. This is the failure class of #733, #756, and #2139.

Severity: Low. start's errors name the cause, no VM launches, and there is no data loss and no security impact.

Workaround: Check the options with nvx sandbox run --dry-run first, which refuses them once the artifacts are installed (it reports a missing artifact first), or deprovision and provision again with options that run accepts.

Regression: Not determined.

Suspected fix: Have provision refuse what every start of the recorded configuration refuses, as run does, before it writes config.json: run the CLI's check_command_line and VmConfig::check_command_line on the record, for instance where serialize_launch checks it, which run shares, so that run and provision refuse the same options through one path. A sandbox that snapshot restore provisions starts with a restore, so its check should refuse what its restore refuses, and no more.

How is this bug reproducible?

  1. From an NVX checkout, build the CLI and install the release artifacts, which start needs to reach its checks (provision needs none):

    cargo build --release --locked --features cli --manifest-path nvx/Cargo.toml
    nvx\target\release\nvx.exe download --hypervisor whp
  2. Provision, start, and dry-run one sandbox for each trigger, with a fake distro layer whose manifest matches it:

    $nvx = (Resolve-Path nvx\target\release\nvx.exe).Path
    $dir = (New-Item -ItemType Directory -Force (Join-Path $env:TEMP 'nvx-provision-repro')).FullName
    # A distro layer and its manifest, and a scratch image: provision checks the
    # layer's SHA-256 against its manifest, not its content.
    foreach ($name in 'distro.erofs', 'distro.vmdk') {
        [IO.File]::WriteAllText("$dir\$name", 'distro')
        $sha = (Get-FileHash -Algorithm SHA256 "$dir\$name").Hash.ToLower()
        [IO.File]::WriteAllText("$dir\$name.manifest.json",
            "{`"format`": 1, `"artifact`": `"$name`", `"artifact_sha256`": `"$sha`", `"packages`": []}")
    }
    $scratch = [IO.File]::Create("$dir\scratch.ext4"); $scratch.SetLength(64MB); $scratch.Close()
    $uuid = '11111111-1111-1111-1111-111111111111'
    $cases = @(
        @{ image = 'distro.vmdk'; cmdline = $null },
        @{ image = 'distro.erofs'; cmdline = 'nvx_foo=1' },
        @{ image = 'distro.erofs'; cmdline = 'a"b' },
        @{ image = 'distro.erofs'; cmdline = 'x -- y' },
        @{ image = 'distro.erofs'; cmdline = 'k=' + 'v' * 1100 }
    )
    $index = 0
    foreach ($case in $cases) {
        $index++
        $options = @('--layer', "distro,$dir\$($case.image),$uuid", '--scratch', "$dir\scratch.ext4",
            '--hypervisor', 'whp')
        if ($null -ne $case.cmdline) { $options += @('--cmdline', $case.cmdline) }
        "--- case ${index}: $($case.image), --cmdline $($case.cmdline -replace '(?<=^k=v{8})v+', '...')"
        & $nvx sandbox provision --state-dir "$dir\state-$index" @options 2>&1; "provision: exit $LASTEXITCODE"
        & $nvx sandbox start --state-dir "$dir\state-$index" 2>&1; "start: exit $LASTEXITCODE"
        & $nvx sandbox run --dry-run @options 2>&1; "run --dry-run: exit $LASTEXITCODE"
    }

    Output, with the temporary directory shortened to %TEMP%:

    --- case 1: distro.vmdk, --cmdline
    provision: exit 0
    error[unsupported]: disk paths ending in .vmdk are unsupported, since OpenVMM would not attach them as raw images: %TEMP%\nvx-provision-repro\distro.vmdk
    start: exit 1
    error[unsupported]: disk paths ending in .vmdk are unsupported, since OpenVMM would not attach them as raw images: %TEMP%\nvx-provision-repro\distro.vmdk
    run --dry-run: exit 1
    --- case 2: distro.erofs, --cmdline nvx_foo=1
    provision: exit 0
    error[unsupported]: nvx_foo is owned by the sandbox profile
    start: exit 1
    error[unsupported]: nvx_foo is owned by the sandbox profile
    run --dry-run: exit 1
    --- case 3: distro.erofs, --cmdline a"b
    provision: exit 0
    error[unsupported]: sandbox kernel command line hides the tokens that OpenVMM appends to it
    start: exit 1
    error[unsupported]: sandbox kernel command line hides the tokens that OpenVMM appends to it
    run --dry-run: exit 1
    --- case 4: distro.erofs, --cmdline x -- y
    provision: exit 0
    error[unsupported]: sandbox kernel command line hides the tokens that OpenVMM appends to it
    start: exit 1
    error[unsupported]: sandbox kernel command line hides the tokens that OpenVMM appends to it
    run --dry-run: exit 1
    --- case 5: distro.erofs, --cmdline k=vvvvvvvv...
    provision: exit 0
    error[unsupported]: sandbox kernel command line exceeds its 1024-byte x86 budget; use shorter arguments and kernel parameters
    start: exit 1
    error[unsupported]: sandbox kernel command line exceeds its 1024-byte x86 budget; use shorter arguments and kernel parameters
    run --dry-run: exit 1
    

    A second start of each state directory fails the same way. As a control, run --dry-run with distro.erofs and no --cmdline prints OpenVMM's command and exits 0.

Frequency: always.
NVX revision or release: a66ba5946c4, the current dev, with the artifacts of its release v0.1.0-dev.a66ba5946c47.
Host OS: Windows 11 Enterprise 10.0.26300, Rust 1.97.1.
Backend: WHP selected; no VM launches, since every refusal precedes OpenVMM.
Host type: n/a; a local workstation, and no VM runs.
Guest: n/a.

Validation limits: reproduced on Windows only. The code path, the CLI's sandbox lifecycle and VmConfig's rendering, is the same on Linux, which was not run. Other refusals that a launch applies and provision skips, such as the Windows command-line limit that VmConfig::check_command_line checks with a reserve, were not exercised.

Activity

  1. added
    confirmed
    bug-hunt
    on Nov 25, 2026
  2. added
    area: nvx
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area: nvxbug-huntconfirmed

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions