Raul Rangel has submitted this change. ( https://review.coreboot.org/c/coreboot/+/62501 )
Change subject: soc/amd/common/vboot: Verify location of CBMEMC transfer buffer ......................................................................
soc/amd/common/vboot: Verify location of CBMEMC transfer buffer
Since we want to read the non-x86 CBMEMC from SMM we need to be stricter on where we read from. This change forces the verstage binary and x86 code to agree on the CBMEMC transfer buffer location and size.
BUG=b:221231786 TEST=Boot guybrush and verify verstage transfer buffer still ends up in cbmem
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: Ida7d50bef46f280be0db1e1f185b46abb0ae5c8f Reviewed-on: https://review.coreboot.org/c/coreboot/+/62501 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Karthik Ramasubramanian kramasub@google.com --- M src/soc/amd/common/vboot/transfer_buffer.c 1 file changed, 9 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Karthik Ramasubramanian: Looks good to me, approved
diff --git a/src/soc/amd/common/vboot/transfer_buffer.c b/src/soc/amd/common/vboot/transfer_buffer.c index 63b4f8e..e08847e 100644 --- a/src/soc/amd/common/vboot/transfer_buffer.c +++ b/src/soc/amd/common/vboot/transfer_buffer.c @@ -10,6 +10,8 @@ #include <timestamp.h> #include <2struct.h>
+DECLARE_REGION(cbmemc_transfer) + int transfer_buffer_valid(const struct transfer_info_struct *ptr) { if (ptr->magic_val == TRANSFER_MAGIC_VAL && ptr->struct_bytes == sizeof(*ptr)) @@ -85,6 +87,13 @@
cbmemc = (void *)((uintptr_t)info + info->console_offset);
+ /* Verify the cbmemc transfer buffer is where we expect it to be. */ + if ((void *)_cbmemc_transfer != (void *)cbmemc) + return; + + if (REGION_SIZE(cbmemc_transfer) != cbmemc_size) + return; + /* We need to manually initialize cbmemc so we can fill the new buffer. cbmemc_init() * will also be called later in console_hw_init(), but it will be a no-op. */ cbmemc_init();