vmm: return all-ones for unregistered MMIO reads

When reading from an unregistered MMIO address, mmio_read() wasn't
initialising the buffer, so guests were reading stale bytes from the
previous MMIO transaction rather than all 0xff bytes like master abort
on real hardware.

Fill data with 0xff on invalid reads.

Correct 'read to unregistered address' info message to 'read from
unregistered address' while we're touching this block.

Signed-off-by: Chris Webb <chris@arachsys.com>
This commit is contained in:
Chris Webb
2026-05-16 14:46:07 +00:00
committed by Rob Bradford
parent fba55b3d9f
commit 4091e965b8

View File

@@ -467,7 +467,8 @@ impl VmOps for VmOpsHandler {
fn mmio_read(&self, gpa: u64, data: &mut [u8]) -> result::Result<(), HypervisorVmError> {
if let Err(vm_device::BusError::MissingAddressRange) = self.mmio_bus.read(gpa, data) {
info!("Guest MMIO read to unregistered address 0x{gpa:x}");
info!("Guest MMIO read from unregistered address 0x{gpa:x}");
data.fill(0xff); // 0xff is sentinel value for invalid reads
}
Ok(())
}