mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: cpu: Warn if the guest is trying to access unregistered IO ranges
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
7f2ee1f984
commit
e5ce6dc43c
@@ -321,7 +321,11 @@ impl Vcpu {
|
||||
Ok(run) => match run {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
VmExit::IoIn(addr, data) => {
|
||||
self.io_bus.read(u64::from(addr), data);
|
||||
if let Err(e) = self.io_bus.read(u64::from(addr), data) {
|
||||
if let devices::BusError::MissingAddressRange = e {
|
||||
warn!("Guest PIO read to unregistered address 0x{:x}", addr);
|
||||
}
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
@@ -329,15 +333,27 @@ impl Vcpu {
|
||||
if addr == DEBUG_IOPORT && data.len() == 1 {
|
||||
self.log_debug_ioport(data[0]);
|
||||
}
|
||||
self.io_bus.write(u64::from(addr), data);
|
||||
if let Err(e) = self.io_bus.write(u64::from(addr), data) {
|
||||
if let devices::BusError::MissingAddressRange = e {
|
||||
warn!("Guest PIO write to unregistered address 0x{:x}", addr);
|
||||
}
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
VmExit::MmioRead(addr, data) => {
|
||||
self.mmio_bus.read(addr as u64, data);
|
||||
if let Err(e) = self.mmio_bus.read(addr as u64, data) {
|
||||
if let devices::BusError::MissingAddressRange = e {
|
||||
warn!("Guest MMIO read to unregistered address 0x{:x}", addr);
|
||||
}
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
VmExit::MmioWrite(addr, data) => {
|
||||
self.mmio_bus.write(addr as u64, data);
|
||||
if let Err(e) = self.mmio_bus.write(addr as u64, data) {
|
||||
if let devices::BusError::MissingAddressRange = e {
|
||||
warn!("Guest MMIO write to unregistered address 0x{:x}", addr);
|
||||
}
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
|
||||
Reference in New Issue
Block a user