[edk2-devel] [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures

Nate DeSimone nathaniel.l.desimone at intel.com
Thu Apr 7 00:52:47 UTC 2022


Reviewed-by: Nate DeSimone <nathaniel.l.desimone at intel.com>

-----Original Message-----
From: mikuback at linux.microsoft.com <mikuback at linux.microsoft.com> 
Sent: Tuesday, March 22, 2022 6:11 PM
To: devel at edk2.groups.io
Cc: Bret Barkelew <bret at corthon.com>; Chiu, Chasel <chasel.chiu at intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone at intel.com>; Gao, Liming <gaoliming at byosoft.com.cn>; Dong, Eric <eric.dong at intel.com>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures

From: Michael Kubacki <michael.kubacki at microsoft.com>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3612

Printing corruption can occur if the DumpHsti helper function encounters a structure from the IHV (i.e. one that contains the 'Required' field).

Co-authored-by: Bret Barkelew <bret at corthon.com>
Cc: Chasel Chiu <chasel.chiu at intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Eric Dong <eric.dong at intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki at microsoft.com>
---
 Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c
index 7756369ae17b..f2f3fa83a57c 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckHsti.c
@@ -40,6 +40,16 @@ DumpHsti (
   DEBUG ((DEBUG_INFO, "  SecurityFeaturesSize        - 0x%08x\n", Hsti->SecurityFeaturesSize));
 
   SecurityFeatures = (UINT8 *) (Hsti + 1);
+
+  if (Hsti->Role == PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) {
+    DEBUG ((DEBUG_INFO, "  SecurityFeaturesRequired    - "));
+    for (Index = 0; Index < Hsti->SecurityFeaturesSize; Index++) {
+      DEBUG ((DEBUG_INFO, "%02x ", SecurityFeatures[Index]));
+    }
+    DEBUG ((DEBUG_INFO, "\n"));
+    SecurityFeatures = (UINT8 *) (SecurityFeatures + 
+ Hsti->SecurityFeaturesSize);  }
+
   DEBUG ((DEBUG_INFO, "  SecurityFeaturesImplemented - "));
   for (Index = 0; Index < Hsti->SecurityFeaturesSize; Index++) {
     DEBUG ((DEBUG_INFO, "%02x ", SecurityFeatures[Index])); @@ -81,7 +91,7 @@ TestPointCheckHsti (
   EFI_STATUS  Status;
   UINTN       Index;
   BOOLEAN     Result;
-  
+
   Result = TRUE;
   DEBUG ((DEBUG_INFO, "==== TestPointCheckHsti - Enter\n"));
   for (Index = 0; Index < sizeof(mRole)/sizeof(mRole[0]); Index++) {
--
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88487): https://edk2.groups.io/g/devel/message/88487
Mute This Topic: https://groups.io/mt/89966782/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list