Repository navigation
Description
On KVM, building a partition with Hyper-V enlightenments (hv_config set, from with_hv) and more than 2024 VPs panics the VM worker with an index out of bounds, in debug and release builds, after the vCPUs have already been created, where it should return a configuration error. Only the VM's configuration reaches it, before the guest runs, and only on a host whose KVM allows that many vCPUs. The limit applies to actual VPs, not to reserved socket capacity. Partitions without enlightenments, which includes NVX's microVM, are not affected, because they allocate no per-VP SynIC routes.
Reproduction
Build a ProtoPartitionConfig with hv_config: Some(..) and a topology with 2025 VPs on a KVM host that allows that many vCPUs. Expected: a configuration error. Actual: VP 2024 claims GSI 24 + 2024 = 2048 in GsiRouting::claim, which panics with "index out of bounds: the len is 2048 but the index is 2048".
Cause
KvmProtoPartition::build (vmm_core/virt_kvm/src/arch/x86_64/mod.rs) claims a SynIC route for each VP, and GsiRouting::claim (vmm_core/virt_kvm/src/gsi.rs) indexes its table with it directly. The VP count is never checked against that table:
// vmm_core/virt_kvm/src/arch/x86_64/mod.rs
if self.config.hv_config.is_some() {
// ...
for vp in self.config.processor_topology.vps() {
let index = vp.vp_index.index();
let gsi = VMBUS_BASE_GSI + index;
gsi_routing.claim(gsi);// vmm_core/virt_kvm/src/gsi.rs
const NUM_GSIS: usize = 2048;
// ...
pub fn claim(&mut self, gsi: u32) {
let gsi = gsi as usize;
assert_eq!(self.states[gsi], GsiState::Unallocated);Fix
fix.patch checks the VP count of an enlightened partition before CPUID processing and vCPU creation. If it exceeds NUM_GSIS - VMBUS_BASE_GSI (2024), the build returns the new KvmError::TooManyVps { vp_count, max }. Partitions without enlightenments behave as before. The native test synic_vp_count_respects_gsi_capacity checks 2024 (accepted) and 2025 (refused), and the KVM test build_rejects_hyperv_vp_count_beyond_synic_capacity, which needs /dev/kvm and is #[ignore]d, builds 2025 VPs. The patch makes NUM_GSIS pub(crate), and adds pal_async as a dev-dependency of virt_kvm, with the matching Cargo.lock line.
Activity
tangruize commentedon Nov 8, 2026
Proposed patch
Patch against OpenVMM 3cf58a5234ed824435825c9f87187f5129219724. Save the contents below as
fix.patchand rungit apply fix.patch.fix.patch