Repository navigation
Description
Restoring a microVM snapshot whose host CPU profile sets CPUID bits that profile derivation always clears gives the restored guest those bits: most importantly VMX (CPUID.1:ECX[5]), or SVM on AMD, although nested_virt is false. Only a crafted or tampered snapshot reaches this: a host profile (<vendor>.host.v<n>) is a document the snapshot itself carries, and the profiles OpenVMM derives follow the policy. Cold boot is not affected. On a KVM host with nested virtualization enabled (KVM's default; without it, the restore's support check refuses the profile), the guest can then enable VMX or SVM and reach KVM's nested-virtualization code, host attack surface that nested_virt false is meant to keep closed. OpenVMM's KVM backend also saves no nested state, so a later snapshot of a VP running a nested guest is not faithful.
Reproduction
On an Intel KVM host with nested virtualization enabled, derive the host's profile (derive_host_profile), set CPUID.1:ECX bit 5 (VMX) in its document, decode it with host_profile_for_restore and the document's own digest, and build a one-VP time-ABI partition from it with nested_virt false. Expected: the profile is refused. Actual: VMX is in the effective CPUID, the support check passes, and a real-mode guest reads VMX with CPUID, sets CR4.VMXE and reads IA32_VMX_BASIC without a #GP. The derived profile itself gives a guest without VMX. SVM on AMD was not reproduced.
Cause
host_profile_for_restore (vmm_core/cpu_profile/src/catalog.rs) accepts any host profile that decodes (which checks its structure and the CPU time bits) and matches the recorded id and digest, and whoever crafts the snapshot can recompute the digest:
// vmm_core/cpu_profile/src/catalog.rs
if canonical::sha256(document).as_slice() != sha256 {
// ...
}
let profile = CpuProfile::decode(document)?;
if profile.id() != id || profile.generation().name != HOST_GENERATION {
// ...
}
Ok(profile)Nothing compares the profile's CPUID with the derivation's policy (apply_policy in derive.rs). On KVM, a time-ABI partition's CPUID is the profile's effective CPUID, and the VMX or SVM strip that new_partition adds for !nested_virt reaches only partitions without a time ABI.
Fix
fix.patch adds a module, cpu_profile::policy, that states the derivation's policy once: the per-register rules (POLICY_RULES), the features cleared without their XSAVE state, the XSAVE allowance, PSFD's rule and the data leaves. derive.rs applies those rules, and CpuProfile::effective_cpuid first checks the profile against them (policy_violation), so derivation and the check cannot drift apart. Every effective CPUID is built there, on cold boot and on restore, for every backend, and a profile outside the policy fails the VM worker's load with E_PROFILE_DIGEST ("CPU profile intel.host.v1 is outside the derivation's CPUID policy: ..."). The tests in policy.rs check that every pinned profile and every profile derived from a recorded host follows the policy, that flipping any rule bit breaks it, and that a restored profile with VMX, SVM or a time bit set is refused. One consequence needs a decision: when the policy changes, host-profile snapshots made under the old policy can no longer be restored. Pinned profiles are not affected.
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 policy check of a restored host CPU profile