coconut-svsm / svsm

COCONUT-SVSM
MIT License
96 stars 40 forks source link

main branch is failing to boot: "memory fault: GPA 0x0 size 0x1000 flags 0x8" #311

Closed cclaudio closed 3 months ago

cclaudio commented 4 months ago
[SVSM] Brought 3 AP(s) online
[SVSM] Launching request-processing task on CPU 3
[SVSM] FW Meta Data
[SVSM]   CPUID Page   : 0x0080e000
[SVSM]   Secrets Page : 0x0080d000
[SVSM]   CAA Page     : 0x0080f000
[SVSM]   Pre-Validated Region 0x0000000000800000-0x0000000000809000
[SVSM]   Pre-Validated Region 0x000000000080a000-0x000000000080d000
[SVSM]   Pre-Validated Region 0x0000000000810000-0x0000000000820000
[SVSM] Validating 0x0000000000800000-0x0000000000809000
[SVSM] Validating 0x000000000080a000-0x0000000000820000
[SVSM] Flash region 0 at 0x00000000ffc00000 size 000000000000400000
[SVSM] [CPU 0] Virtual memory pages used: 0 * 4K, 0 * 2M
[SVSM] VMSA PA: 0x8000f2e000
[SVSM] Launching Firmware
[SVSM] Launching request-processing task on CPU 0
qemu-system-x86_64: warning: memory fault: GPA 0x0 size 0x1000 flags 0x8

It looks like this regression was added in the commit d22a17add22c65356e0144b8ccf86452b828f362. Could someone with more experience in the igvmbuilder help with this?

cclaudio commented 3 months ago

From @tlendacky: The following patch to Qemu works around the issue, but I'm unsure if this is a proper fix. The error can either be in Qemu or the IGVM creation process.

diff --git a/backends/igvm.c b/backends/igvm.c
index df663b300b..1923d31ad6 100644
--- a/backends/igvm.c
+++ b/backends/igvm.c
@@ -675,7 +675,7 @@ void igvm_process(ConfidentialGuestSupport *cgs)
       * to reduce the number of memory regions we create. Make sure the 
last group is
       * processed with this call.
       */
-    process_mem_page(cgs, i, NULL);
+    process_mem_page(cgs, i - 1, NULL);

      QTAILQ_FOREACH(parameter, &parameter_data, next)
      {
roy-hopkins commented 3 months ago

As your workaround shows, the problem is in the QEMU handling of combining IGVM pages in to memory regions in igvm.c. This has actually been fixed but the svsm-igvm coconut QEMU branch has not yet pulled in the required fixes. I'll work on getting this updated.

roy-hopkins commented 3 months ago

I've created a PR to update the coconut QEMU svsm-igvm branch: https://github.com/coconut-svsm/qemu/pull/6. This should fix this issue.

joergroedel commented 3 months ago

I updated the svsm-igvm branch in the COCONUT QEMU repository with the changes from @roy-hopkins. Can you please test if the new branch fixes your issues?

cclaudio commented 3 months ago

I tested the updated qemu/svsm-igvm branch. The IGVM fixes worked for me. Thank you @roy-hopkins and @joergroedel !!

Closing this issue