firecracker-microvm/firecracker · error
caddr should be within the region
Error message
caddr should be within the region
What it means
Error "caddr should be within the region" thrown in firecracker-microvm/firecracker.
Source
Thrown at src/vmm/src/vstate/memory.rs:610
slot_size,
region_type: state.region_type,
slot_from,
plugged: Mutex::new(BitVec::from_iter(state.plugged.iter())),
})
}
/// Check whether the given guest address range falls within plugged slots.
pub(crate) fn check_range_plugged(
&self,
caddr: MemoryRegionAddress,
len: usize,
) -> Result<(), GuestMemoryError> {
// caddr is guaranteed to be within the region by the caller
// (try_for_each_region_in_range validates this).
let from = self
.start_addr()
.checked_add(caddr.raw_value())
.expect("caddr should be within the region");
if self
.slots_intersecting_range(from, len)
.any(|(_, plugged)| !plugged)
{
return Err(GuestMemoryError::HostAddressNotAvailable);
}
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);
View on GitHub (pinned to 9384f395f5)
Solutions
- Ensure the guest physical address being accessed lies within the memory region it is looked up in.
- Validate addresses from the guest before translating them to host addresses.
When it happens
Trigger: Thrown at src/vmm/src/vstate/memory.rs:610 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/589b95a405346a5e.
Report an issue: GitHub.