public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael Kubacki" <mikuback@linux.microsoft.com>
To: devel@edk2.groups.io
Cc: Bret Barkelew <bret@corthon.com>,
	Chasel Chiu <chasel.chiu@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Eric Dong <eric.dong@intel.com>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
Date: Tue, 22 Mar 2022 21:10:53 -0400	[thread overview]
Message-ID: <20220323011053.9546-1-mikuback@linux.microsoft.com> (raw)

From: Michael Kubacki <michael.kubacki@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@corthon.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@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/DxeCheckHsti.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


             reply	other threads:[~2022-03-23  1:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  1:10 Michael Kubacki [this message]
2022-03-23  6:14 ` [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures Chiu, Chasel
2022-04-01 14:12   ` [edk2-devel] " Michael Kubacki
2022-04-05  1:10     ` Michael Kubacki
2022-04-07  0:52 ` Nate DeSimone
2022-04-07  0:54 ` Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220323011053.9546-1-mikuback@linux.microsoft.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox