From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.3715.1647997903954483748 for ; Tue, 22 Mar 2022 18:11:44 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=MgWiqhzH; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [47.202.59.224]) by linux.microsoft.com (Postfix) with ESMTPSA id 8C7B320DE4A1; Tue, 22 Mar 2022 18:11:42 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8C7B320DE4A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1647997903; bh=UNKbe8eU2Qq5xOiSIPxl8NTlfQtej0dslmhQinYv7Bc=; h=From:To:Cc:Subject:Date:From; b=MgWiqhzHHEG7c4+bdmCtFHjCMyYxdu9eUZkrQGlioSenup/G45Shpp7mPYwETtUlV T3A3EdQFKz9swEfr0bfi+2HTQbz1wINYfsFsWoFw7XgRhNX1dqCyw+qHrdjhNn2Kow SM3/RRUHr2ttcWpZEM+8aallZY+yMMNle/bkKPwM= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Bret Barkelew , Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures Date: Tue, 22 Mar 2022 21:10:53 -0400 Message-Id: <20220323011053.9546-1-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3612 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 Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki --- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHst= i.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/TestPointChe= ckLib/DxeCheckHsti.c index 7756369ae17b..f2f3fa83a57c 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChe= ckHsti.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChe= ckHsti.c @@ -40,6 +40,16 @@ DumpHsti ( DEBUG ((DEBUG_INFO, " SecurityFeaturesSize - 0x%08x\n", Hsti->= SecurityFeaturesSize)); =20 SecurityFeatures =3D (UINT8 *) (Hsti + 1); + + if (Hsti->Role =3D=3D PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) { + DEBUG ((DEBUG_INFO, " SecurityFeaturesRequired - ")); + for (Index =3D 0; Index < Hsti->SecurityFeaturesSize; Index++) { + DEBUG ((DEBUG_INFO, "%02x ", SecurityFeatures[Index])); + } + DEBUG ((DEBUG_INFO, "\n")); + SecurityFeatures =3D (UINT8 *) (SecurityFeatures + Hsti->SecurityFea= turesSize); + } + DEBUG ((DEBUG_INFO, " SecurityFeaturesImplemented - ")); for (Index =3D 0; Index < Hsti->SecurityFeaturesSize; Index++) { DEBUG ((DEBUG_INFO, "%02x ", SecurityFeatures[Index])); @@ -81,7 +91,7 @@ TestPointCheckHsti ( EFI_STATUS Status; UINTN Index; BOOLEAN Result; - =20 + Result =3D TRUE; DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckHsti - Enter\n")); for (Index =3D 0; Index < sizeof(mRole)/sizeof(mRole[0]); Index++) { --=20 2.28.0.windows.1