Skip to contentSkip to conversation

x86/loader: Don't update kernel header for CoCo VMs

PATCH In review Xiaoyao Li 2 participants 2 messages Aug 14, 2025

lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

PATCH 1/1 x86/loader: Don't update kernel header for CoCo VMs

Update the header makes it different from the original kernel that user provides via "-kernel", which leads to a different hash and breaks the attestation, e.g., for TDX.

We already skip it for SEV VMs. Instead of adding another check of is_tdx_vm() to cover the TDX case, check machine->cgs to cover all the confidential computing case for x86.

---
 hw/i386/x86-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/x86-common.c +1 -1
index b1b5f11e7396..7512be64d67b 100644
@@ -952,7 +952,7 @@ void x86_load_linux(X86MachineState *x86ms,
      * kernel on the other side of the fw_cfg interface matches the hash of the
      * file the user passed in.
      */
-    if (!sev_enabled() && protocol > 0) {
+    if (!MACHINE(x86ms)->cgs && protocol > 0) {
         memcpy(setup, header, MIN(sizeof(header), setup_size));
     }
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Xiaoyao Li

Update the header makes it different from the original kernel that user provides via "-kernel", which leads to a different hash and breaks the attestation, e.g., for TDX.

We already skip it for SEV VMs. Instead of adding another check of is_tdx_vm() to cover the TDX case, check machine->cgs to cover all the confidential computing case for x86.

Applied for 10.2, thanks!

Paolo

Quoted 16 lines
  hw/i386/x86-common.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/x86-common.c +1 -1
index b1b5f11e7396..7512be64d67b 100644
@@ -952,7 +952,7 @@ void x86_load_linux(X86MachineState *x86ms,
       * kernel on the other side of the fw_cfg interface matches the hash of the
       * file the user passed in.
       */
-    if (!sev_enabled() && protocol > 0) {
+    if (!MACHINE(x86ms)->cgs && protocol > 0) {
          memcpy(setup, header, MIN(sizeof(header), setup_size));
      }