You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
openvmm: a microVM network prefix of 0 or over 32 panics config validation #1372
A VM worker whose launch message carries a microVM network identity with an IPv4 prefix of 0 or above 32 panics in validate_machine_config in a debug build (the dev profile aborts). A release build does not panic: it derives a wrong netmask (255.255.255.255 for /0, 128.0.0.0 for /33) and accepts a command line whose virtnet_mask= matches it. Prefixes /31 and /32 are accepted too. Only a launch message that OpenVMM's controller did not build can carry such a prefix: the CLI and the snapshot restore both parse the identity with MicrovmNetworkConfig's FromStr, which accepts only /1 to /30.
Reproduction
Build a microVM Config with the virtio-net device and an identity parsed from 10.0.0.2/24, set prefix_length = 0, and call validate_machine_config. It should return an error; in a debug build it panics with "attempt to shift left with overflow" in MicrovmNetworkConfig::netmask. With 33 it panics with "attempt to subtract with overflow".
Cause
MicrovmNetworkConfig derives MeshPayload, so the worker receives prefix_length unchecked. validate_machine_config calls validate_microvm_command_line, which builds the expected tokens with command_line_fragment_with, which calls netmask(). Nothing checks the prefix first:
fix.patch adds validate_microvm_network_prefix, which validate_machine_config calls before the command-line check. It rejects a prefix outside 1..=30, the range the CLI parser accepts. The patch leaves netmask unchanged: checked arithmetic there would still let the worker accept an identity with no valid prefix. The test a_network_prefix_outside_1_to_30_is_rejected_before_the_command_line checks that 0, 31, 32, 33 and 255 are rejected and that every parsed /1 to /30 identity passes.
Activity
tangruize commentedon Nov 8, 2026
Proposed patch
Patch against OpenVMM 3cf58a5234ed824435825c9f87187f5129219724. Save the contents below as
fix.patchand rungit apply fix.patch.fix.patchopenvmm: pin the refusal of a decoded network prefix outside /1 to /30
microVM: refuse a decoded network prefix outside /1 to /30
openvmm: pin the refusal of non-derived network identities