[edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data


Isaac Oram
 

Pushed as 436a8612ae..ea2a520c83

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Oram, Isaac W
Sent: Friday, August 5, 2022 1:30 PM
To: mikuback@...; devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Gao, Liming <gaoliming@...>; Dong, Eric <eric.dong@...>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data

Reviewed-by: Isaac Oram <isaac.w.oram@...>

-----Original Message-----
From: mikuback@... <mikuback@...>
Sent: Friday, August 5, 2022 10:16 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Oram, Isaac W <isaac.w.oram@...>; Gao, Liming <gaoliming@...>; Dong, Eric <eric.dong@...>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data

From: Michael Kubacki <michael.kubacki@...>

DumpMemoryTypeInfoSummary() is used to dump information about the MemoryTypeInformation HOB. The dump function currently modifies the data which can corrupt the data for later HOB consumers in the DXE phase.

This change makes DumpMemoryTypeInfoSummary() treat the data as read-only.

Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Isaac Oram <isaac.w.oram@...>
Cc: Liming Gao <gaoliming@...>
Cc: Eric Dong <eric.dong@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
index 9ee9dd252c7e..a30b69dd787c 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckMemoryTypeInformation.c
@@ -22,8 +22,8 @@ ShortNameOfMemoryType(

VOID
DumpMemoryTypeInfoSummary (
- IN EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
- IN EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
+ IN CONST EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
+ IN CONST EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
)
{
UINTN Index;
@@ -83,7 +83,6 @@ DumpMemoryTypeInfoSummary (
}

if (Next != Previous) {
- PreviousMemoryTypeInformation[Index].NumberOfPages = Next;
MemoryTypeInformationModified = TRUE;
}

@@ -110,7 +109,7 @@ TestPointCheckMemoryTypeInformation (
VOID *CurrentMemoryTypeInformation;
VOID *PreviousMemoryTypeInformation;
VOID *VariableMemoryTypeInformation;
-
+
DEBUG ((DEBUG_INFO, "==== TestPointCheckMemoryTypeInformation - Enter\n"));
CurrentMemoryTypeInformation = NULL;
PreviousMemoryTypeInformation = NULL;
--
2.28.0.windows.1


Isaac Oram
 

Reviewed-by: Isaac Oram <isaac.w.oram@...>

-----Original Message-----
From: mikuback@... <mikuback@...>
Sent: Friday, August 5, 2022 10:16 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Oram, Isaac W <isaac.w.oram@...>; Gao, Liming <gaoliming@...>; Dong, Eric <eric.dong@...>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data

From: Michael Kubacki <michael.kubacki@...>

DumpMemoryTypeInfoSummary() is used to dump information about the MemoryTypeInformation HOB. The dump function currently modifies the data which can corrupt the data for later HOB consumers in the DXE phase.

This change makes DumpMemoryTypeInfoSummary() treat the data as read-only.

Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Isaac Oram <isaac.w.oram@...>
Cc: Liming Gao <gaoliming@...>
Cc: Eric Dong <eric.dong@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
index 9ee9dd252c7e..a30b69dd787c 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckMemoryTypeInformation.c
@@ -22,8 +22,8 @@ ShortNameOfMemoryType(

VOID
DumpMemoryTypeInfoSummary (
- IN EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
- IN EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
+ IN CONST EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
+ IN CONST EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
)
{
UINTN Index;
@@ -83,7 +83,6 @@ DumpMemoryTypeInfoSummary (
}

if (Next != Previous) {
- PreviousMemoryTypeInformation[Index].NumberOfPages = Next;
MemoryTypeInformationModified = TRUE;
}

@@ -110,7 +109,7 @@ TestPointCheckMemoryTypeInformation (
VOID *CurrentMemoryTypeInformation;
VOID *PreviousMemoryTypeInformation;
VOID *VariableMemoryTypeInformation;
-
+
DEBUG ((DEBUG_INFO, "==== TestPointCheckMemoryTypeInformation - Enter\n"));
CurrentMemoryTypeInformation = NULL;
PreviousMemoryTypeInformation = NULL;
--
2.28.0.windows.1


Michael Kubacki
 

From: Michael Kubacki <michael.kubacki@...>

DumpMemoryTypeInfoSummary() is used to dump information about the
MemoryTypeInformation HOB. The dump function currently modifies the
data which can corrupt the data for later HOB consumers in the DXE
phase.

This change makes DumpMemoryTypeInfoSummary() treat the data as
read-only.

Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Isaac Oram <isaac.w.oram@...>
Cc: Liming Gao <gaoliming@...>
Cc: Eric Dong <eric.dong@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMem=
oryTypeInformation.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib=
/DxeCheckMemoryTypeInformation.c b/Platform/Intel/MinPlatformPkg/Test/Lib=
rary/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
index 9ee9dd252c7e..a30b69dd787c 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChe=
ckMemoryTypeInformation.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChe=
ckMemoryTypeInformation.c
@@ -22,8 +22,8 @@ ShortNameOfMemoryType(
=20
VOID
DumpMemoryTypeInfoSummary (
- IN EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
- IN EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
+ IN CONST EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation,
+ IN CONST EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation
)
{
UINTN Index;
@@ -83,7 +83,6 @@ DumpMemoryTypeInfoSummary (
}
=20
if (Next !=3D Previous) {
- PreviousMemoryTypeInformation[Index].NumberOfPages =3D Next;
MemoryTypeInformationModified =3D TRUE;
}
=20
@@ -110,7 +109,7 @@ TestPointCheckMemoryTypeInformation (
VOID *CurrentMemoryTypeInformation;
VOID *PreviousMemoryTypeInformation;
VOID *VariableMemoryTypeInformation;
- =20
+
DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckMemoryTypeInformation =
- Enter\n"));
CurrentMemoryTypeInformation =3D NULL;
PreviousMemoryTypeInformation =3D NULL;
--=20
2.28.0.windows.1