From 7b29691932195209d6e48ff6c392b84d8e5c2564 Mon Sep 17 00:00:00 2001 From: Chris Webb Date: Sat, 16 May 2026 14:46:07 +0000 Subject: [PATCH] vmm: return all-ones for unregistered PIO reads When reading from an unregistered PIO address, pio_read() wasn't initialising the buffer, so guests were reading stale bytes from the previous PIO 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 --- vmm/src/vm.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 3d88f3587..1a2d3e1e8 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -491,7 +491,8 @@ impl VmOps for VmOpsHandler { #[cfg(target_arch = "x86_64")] fn pio_read(&self, port: u64, data: &mut [u8]) -> result::Result<(), HypervisorVmError> { if let Err(vm_device::BusError::MissingAddressRange) = self.io_bus.read(port, data) { - info!("Guest PIO read to unregistered address 0x{port:x}"); + info!("Guest PIO read from unregistered address 0x{port:x}"); + data.fill(0xff); // 0xff is sentinel value for invalid reads } Ok(()) }