public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
@ 2022-03-23  1:10 Michael Kubacki
  2022-03-23  6:14 ` Chiu, Chasel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Kubacki @ 2022-03-23  1:10 UTC (permalink / raw)
  To: devel; +Cc: Bret Barkelew, Chasel Chiu, Nate DeSimone, Liming Gao, Eric Dong

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
  2022-03-23  1:10 [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures Michael Kubacki
@ 2022-03-23  6:14 ` Chiu, Chasel
  2022-04-01 14:12   ` [edk2-devel] " Michael Kubacki
  2022-04-07  0:52 ` Nate DeSimone
  2022-04-07  0:54 ` Nate DeSimone
  2 siblings, 1 reply; 6+ messages in thread
From: Chiu, Chasel @ 2022-03-23  6:14 UTC (permalink / raw)
  To: mikuback@linux.microsoft.com, devel@edk2.groups.io
  Cc: Bret Barkelew, Desimone, Nathaniel L, Gao, Liming, Dong, Eric


Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>


> -----Original Message-----
> From: mikuback@linux.microsoft.com <mikuback@linux.microsoft.com>
> Sent: Wednesday, March 23, 2022 9:11 AM
> To: devel@edk2.groups.io
> Cc: Bret Barkelew <bret@corthon.com>; Chiu, Chasel
> <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
> Subject: [edk2-platforms][PATCH v1 1/1]
> MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
> 
> 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/DxeCheckH
> sti.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
> kHsti.c
> b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
> kHsti.c
> index 7756369ae17b..f2f3fa83a57c 100644
> ---
> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
> kHsti.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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
  2022-03-23  6:14 ` Chiu, Chasel
@ 2022-04-01 14:12   ` Michael Kubacki
  2022-04-05  1:10     ` Michael Kubacki
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Kubacki @ 2022-04-01 14:12 UTC (permalink / raw)
  To: devel, chasel.chiu
  Cc: Bret Barkelew, Desimone, Nathaniel L, Gao, Liming, Dong, Eric

Thanks for the review.

Can you please merge this soon if there are no concerns?

On 3/23/2022 2:14 AM, Chiu, Chasel wrote:
> 
> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
> 
> 
>> -----Original Message-----
>> From: mikuback@linux.microsoft.com <mikuback@linux.microsoft.com>
>> Sent: Wednesday, March 23, 2022 9:11 AM
>> To: devel@edk2.groups.io
>> Cc: Bret Barkelew <bret@corthon.com>; Chiu, Chasel
>> <chasel.chiu@intel.com>; Desimone, Nathaniel L
>> <nathaniel.l.desimone@intel.com>; Gao, Liming
>> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
>> Subject: [edk2-platforms][PATCH v1 1/1]
>> MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
>>
>> 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/DxeCheckH
>> sti.c | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git
>> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
>> kHsti.c
>> b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
>> kHsti.c
>> index 7756369ae17b..f2f3fa83a57c 100644
>> ---
>> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
>> kHsti.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
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
  2022-04-01 14:12   ` [edk2-devel] " Michael Kubacki
@ 2022-04-05  1:10     ` Michael Kubacki
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Kubacki @ 2022-04-05  1:10 UTC (permalink / raw)
  To: devel, chasel.chiu
  Cc: Bret Barkelew, Desimone, Nathaniel L, Gao, Liming, Dong, Eric

Just another reminder to please merge this patch if there is no further 
feedback.

Thanks,
Michael

On 4/1/2022 10:12 AM, Michael Kubacki wrote:
> Thanks for the review.
> 
> Can you please merge this soon if there are no concerns?
> 
> On 3/23/2022 2:14 AM, Chiu, Chasel wrote:
>>
>> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
>>
>>
>>> -----Original Message-----
>>> From: mikuback@linux.microsoft.com <mikuback@linux.microsoft.com>
>>> Sent: Wednesday, March 23, 2022 9:11 AM
>>> To: devel@edk2.groups.io
>>> Cc: Bret Barkelew <bret@corthon.com>; Chiu, Chasel
>>> <chasel.chiu@intel.com>; Desimone, Nathaniel L
>>> <nathaniel.l.desimone@intel.com>; Gao, Liming
>>> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
>>> Subject: [edk2-platforms][PATCH v1 1/1]
>>> MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
>>>
>>> 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/DxeCheckH
>>> sti.c | 12 +++++++++++-
>>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git
>>> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
>>> kHsti.c
>>> b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
>>> kHsti.c
>>> index 7756369ae17b..f2f3fa83a57c 100644
>>> ---
>>> a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChec
>>> kHsti.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
>>
>>
>>
>> 
>>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
  2022-03-23  1:10 [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures Michael Kubacki
  2022-03-23  6:14 ` Chiu, Chasel
@ 2022-04-07  0:52 ` Nate DeSimone
  2022-04-07  0:54 ` Nate DeSimone
  2 siblings, 0 replies; 6+ messages in thread
From: Nate DeSimone @ 2022-04-07  0:52 UTC (permalink / raw)
  To: mikuback@linux.microsoft.com, devel@edk2.groups.io
  Cc: Bret Barkelew, Chiu, Chasel, Gao, Liming, Dong, Eric

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

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

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/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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures
  2022-03-23  1:10 [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures Michael Kubacki
  2022-03-23  6:14 ` Chiu, Chasel
  2022-04-07  0:52 ` Nate DeSimone
@ 2022-04-07  0:54 ` Nate DeSimone
  2 siblings, 0 replies; 6+ messages in thread
From: Nate DeSimone @ 2022-04-07  0:54 UTC (permalink / raw)
  To: mikuback@linux.microsoft.com, devel@edk2.groups.io
  Cc: Bret Barkelew, Chiu, Chasel, Gao, Liming, Dong, Eric

Pushed: https://github.com/tianocore/edk2-platforms/commit/170f455

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

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/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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-07  0:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-23  1:10 [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures Michael Kubacki
2022-03-23  6:14 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox