diff --git a/td-shim/src/bin/td-shim/shim_info.rs b/td-shim/src/bin/td-shim/shim_info.rs index 30e10686..b3e1c55a 100644 --- a/td-shim/src/bin/td-shim/shim_info.rs +++ b/td-shim/src/bin/td-shim/shim_info.rs @@ -7,7 +7,9 @@ use core::mem::size_of; use core::str::FromStr; use log::error; use scroll::{Pread, Pwrite}; -use td_layout::build_time::{TD_SHIM_FIRMWARE_BASE, TD_SHIM_FIRMWARE_SIZE}; +use td_layout::build_time::{ + TD_SHIM_FIRMWARE_BASE, TD_SHIM_FIRMWARE_SIZE, TD_SHIM_LARGE_PAYLOAD_SIZE, +}; use td_layout::memslice; use td_shim::speculation_barrier; use td_shim::{ @@ -35,7 +37,8 @@ impl BootTimeStatic { // Validate the metadata and get the basic infomation from // it if any pub fn new() -> Option { - let metadata_offset = unsafe { *((u32::MAX - TDX_METADATA_OFFSET + 1) as *const u32) }; + let metadata_offset = unsafe { *((u32::MAX - TDX_METADATA_OFFSET + 1) as *const u32) } + - TD_SHIM_LARGE_PAYLOAD_SIZE; if metadata_offset >= TD_SHIM_FIRMWARE_SIZE || metadata_offset < size_of::() as u32 || metadata_offset > TD_SHIM_FIRMWARE_SIZE - size_of::() as u32