Files
cloud-hypervisor/vmm
Muminul Islam f6ed896f68 vmm: gate reserve_bootloader_regions on KVM hypervisor type
The reserve_bootloader_regions() call allocates RAM regions at
KVM-specific addresses (0xffc00000 for stage0, 0xfffffffff000
for VMSA) that are only needed by the KVM SEV-SNP boot path.

The existing #[cfg(all(feature = "kvm", feature = "sev_snp"))]
compile-time guard is insufficient when both 'mshv' and 'kvm'
features are enabled in the same binary. The runtime check only
verified sev_snp_enabled() but not the hypervisor type, causing
these KVM-specific memory regions to be allocated on MSHV.

On MSHV, these spurious RAM mappings at high addresses interfere
with the hypervisor's address space layout. When the guest kernel
subsequently accesses MMIO regions (e.g., IOAPIC at 0xFEC00000),
MSHV incorrectly reports HVMSG_UNACCEPTED_GPA instead of routing
the access through MMIO emulation, crashing the guest.

Add a runtime hypervisor type check to ensure these regions are
only reserved when running on KVM.

Assisted-by: Claude:Opus-4.6

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-30 10:39:28 +00:00
..