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
Commit bec7094
Browse filesBrowse the repository at this point in the historyBrowse files
microVM: reject explicit host-loopback access on a /30 IPv4 network
With explicit --host-loopback allow, Consomme presents host peers, such
as the host clients of the guest's published listeners and of
host-loopback forwards, at synthetic addresses inside the guest's
subnet, allocated downward from its last usable address, so that the
guest answers them from its own address through its NIC. A /30 IPv4
network holds only the gateway and the guest, so the allocation finds
no address, and Consomme presents IPv4 host peers at the gateway
instead. TCP still works, but the guest's UDP replies to host clients
over 127.0.0.1 do not return through the published port, so the
bidirectional access that the option promises silently loses IPv4 UDP.
OpenVMM accepted the combination at launch without an error or a
warning, and at run time only logged a rate-limited warning that its
address pool was exhausted, both at a cold boot with --net and at a
restore that installs a new policy on a NIC template captured on a /30,
although invalid configurations are to be refused, never silently
adjusted.
Refuse explicit --host-loopback allow on an IPv4 network whose prefix
is longer than /29 where the options bind their network policy to an
identity, in microvm_egress_policy. Option validation calls it with the
identity of --net before OpenVMM opens host resources, and the launch
calls it with the snapshot's identity at a restore, before any vCPU
runs; a check in validate_microvm_options alone would miss the restore,
whose identity --net cannot name. The error names the option and the
rule, and microvm_egress_policy now returns anyhow::Result, as its
callers do. The IPv6 subnet of a /30, a /126, keeps an address for host
peers, but its IPv4 peers would still have none. Every other policy on
a /30, private-network ingress without explicit host loopback included,
presents no host peer at a synthetic address and stays accepted.
Consomme's fallback to the gateway when its pool runs out stays, for
its other users and for more host peers than a subnet has addresses.
Unit tests check that a /30 refuses explicit host loopback alone, with
egress denied, with private-network ingress, and with a UDP forward,
both in option validation and when the policy is bound; that a /29
accepts it; that a /30 accepts every other policy; and that a NIC
template captured on a /30 refuses it at a restore with
--restore-network-policy but takes other policies. The help of
--host-loopback, the CLI reference, and the Consomme reference state
the rule.
See microsoft/nvx#553.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
"--host-loopback allow requires an IPv4 network of /{MICROVM_HOST_LOOPBACK_MAX_PREFIX_LENGTH} or larger: a /{} holds only the gateway and the guest, and leaves no address at which to present host peers to the guest",
1464
+
network.prefix_length
1465
+
);
1466
+
Ok(policy)
1448
1467
}
1449
1468
1450
1469
/// Returns the publication of the guest's listeners to the host's private
0 commit comments