From 50241f94d975cd55a569584b43d38f33a48db0e5 Mon Sep 17 00:00:00 2001 From: Jinank Jain Date: Mon, 5 Feb 2024 16:34:22 +0530 Subject: [PATCH] hypervisor: mshv: Add support to handle unaccepted GPA Unaccepted GPA is usually thrown by Microsoft hypervisor in case of mismatch between GPA and GVA mappings. This is a fatal message from the hypervisor perspective so we would need to error out from the vcpu run loop. Along with add some debug message to identify the broken mapping between GVA and GPA. Signed-off-by: Jinank Jain Signed-off-by: Muminul Islam --- hypervisor/src/mshv/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index 575a653b4..16e59ffee 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -597,6 +597,17 @@ impl cpu::Vcpu for MshvVcpu { Ok(cpu::VmExit::Ignore) } + hv_message_type_HVMSG_UNACCEPTED_GPA => { + let info = x.to_memory_info().unwrap(); + let gva = info.guest_virtual_address; + let gpa = info.guest_physical_address; + + Err(cpu::HypervisorCpuError::RunVcpu(anyhow!( + "Unhandled VCPU exit: Unaccepted GPA({:x}) found at GVA({:x})", + gpa, + gva, + ))) + } hv_message_type_HVMSG_X64_CPUID_INTERCEPT => { let info = x.to_cpuid_info().unwrap(); debug!("cpuid eax: {:x}", { info.rax });