You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
openvmm: device I/O offset lookup overflows for a range ending at the top #1384
offset_of on a chipset device's port-I/O or MMIO region whose last byte is the address maximum (for example 2 ports at 0xfffe, or MMIO ending at u64::MAX) overflows computing the region's exclusive end. A debug build panics with "attempt to add with overflow" on the first access to the region. A release build wraps and returns None for the region's own addresses, so the device ignores accesses it owns. No device at the pin maps a region there, so this is latent. The VMM's configuration places these regions; the only one a guest can move (the PIIX4 PM block, 0x37 ports at a 64-byte-aligned base) cannot reach 0xffff, and PCI BARs are matched by BarMappings::find, which does not overflow. None of the devices that call offset_of is in NVX's microVM.
Reproduction
Map a 2-byte port region at 0xfffe and call offset_of(0xfffe). It should return Some(0); 0xfffe + 2 overflows u16 instead. The tests port_offset_of_at_top_boundary and mmio_offset_of_at_top_boundary (vmotherboard) that fix.patch adds cover both widths at the boundary.
Cause
impl_device_range!'s offset_of forms the region's exclusive end:
A region ending at the address maximum is valid, but its exclusive end does not fit the address type.
Fix
fix.patch computes addr.checked_sub(base) and accepts the address when the offset is below len, so no end address is formed. Results for every other region are unchanged. The tests check the first and last byte, the byte before the base, and a remap that moves the region down by one.
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