Skip to contentSkip to conversation

x86/tboot: include all valid frame table entries in S3 integrity check

PATCH In review Jan Beulich 2 participants 3 messages May 19, 2021 – May 31, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/tboot: include all valid frame table entries in S3 integrity check

The difference of two pdx_to_page() return values is a number of pages, not the number of bytes covered by the corresponding frame table entries.

Fixes 3cb68d2b59ab ("tboot: fix S3 issue for Intel Trusted Execution Technology.")
xen/arch/x86/tboot.c +4 -4
@@ -323,12 +323,12 @@ static void tboot_gen_frametable_integri
         if ( nidx >= max_idx )
             break;
         vmac_update((uint8_t *)pdx_to_page(sidx * PDX_GROUP_COUNT),
-                       pdx_to_page(eidx * PDX_GROUP_COUNT)
-                       - pdx_to_page(sidx * PDX_GROUP_COUNT), &ctx);
+                    (eidx - sidx) * PDX_GROUP_COUNT * sizeof(*frame_table),
+                    &ctx);
     }
     vmac_update((uint8_t *)pdx_to_page(sidx * PDX_GROUP_COUNT),
-                   pdx_to_page(max_pdx - 1) + 1
-                   - pdx_to_page(sidx * PDX_GROUP_COUNT), &ctx);
+                (max_pdx - sidx * PDX_GROUP_COUNT) * sizeof(*frame_table),
+                &ctx);
 
     *mac = vmac(NULL, 0, nonce, NULL, &ctx);
 
#1 lore raw

Ping: [PATCH] x86/tboot: include all valid frame table entries in S3 integrity check

Quoted 26 lines · Jan Beulich

The difference of two pdx_to_page() return values is a number of pages, not the number of bytes covered by the corresponding frame table entries.

Fixes 3cb68d2b59ab ("tboot: fix S3 issue for Intel Trusted Execution Technology.")
xen/arch/x86/tboot.c +4 -4
@@ -323,12 +323,12 @@ static void tboot_gen_frametable_integri
         if ( nidx >= max_idx )
             break;
         vmac_update((uint8_t *)pdx_to_page(sidx * PDX_GROUP_COUNT),
-                       pdx_to_page(eidx * PDX_GROUP_COUNT)
-                       - pdx_to_page(sidx * PDX_GROUP_COUNT), &ctx);
+                    (eidx - sidx) * PDX_GROUP_COUNT * sizeof(*frame_table),
+                    &ctx);
     }
     vmac_update((uint8_t *)pdx_to_page(sidx * PDX_GROUP_COUNT),
-                   pdx_to_page(max_pdx - 1) + 1
-                   - pdx_to_page(sidx * PDX_GROUP_COUNT), &ctx);
+                (max_pdx - sidx * PDX_GROUP_COUNT) * sizeof(*frame_table),
+                &ctx);
 
     *mac = vmac(NULL, 0, nonce, NULL, &ctx);