firecracker-microvm/firecracker · error
slot range should be valid
Error message
slot range should be valid
What it means
Error "slot range should be valid" thrown in firecracker-microvm/firecracker.
Source
Thrown at src/vmm/src/vstate/memory.rs:635
Ok(())
}
pub(crate) fn slot_cnt(&self) -> u32 {
u32::try_from(u64_to_usize(self.len()) / self.slot_size).unwrap()
}
pub(crate) fn mem_slot(&self, slot: u32) -> GuestMemorySlot<'_> {
assert!(slot >= self.slot_from && slot < self.slot_from + self.slot_cnt());
let offset = ((slot - self.slot_from) as u64) * (self.slot_size as u64);
GuestMemorySlot {
slot,
guest_addr: self.start_addr().unchecked_add(offset),
slice: self
.inner
.get_slice(MemoryRegionAddress(offset), self.slot_size)
.expect("slot range should be valid"),
}
}
/// Returns a snapshot of the slots and their state at the time of calling
///
/// Note: to avoid TOCTOU races use only within VMM thread.
pub(crate) fn slots(&self) -> impl Iterator<Item = (GuestMemorySlot<'_>, bool)> {
self.plugged
.lock()
.unwrap()
.iter()
.enumerate()
.map(|(i, b)| {
(
self.mem_slot(self.slot_from + u32::try_from(i).unwrap()),
*b,
)
})View on GitHub (pinned to 9384f395f5)
Solutions
- Ensure the memory slot's guest range is valid and backed by the region before registering it with KVM.
- Check the memory-region construction for overlapping or empty slot ranges.
When it happens
Trigger: Thrown at src/vmm/src/vstate/memory.rs:635 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of firecracker-microvm/firecracker@9384f395f5 (2026-08-19).
Data as JSON: /api/errors/7ffcd71c2211d474.
Report an issue: GitHub.