* [PATCH] MdeModulePkg/Core: Fix incorrect memory map generated in a rare case
@ 2017-12-18 8:39 Jian J Wang
2017-12-19 3:50 ` Yao, Jiewen
0 siblings, 1 reply; 2+ messages in thread
From: Jian J Wang @ 2017-12-18 8:39 UTC (permalink / raw)
To: edk2-devel; +Cc: Star Zeng, Eric Dong, Jiewen Yao
The root cause is that mImagePropertiesPrivateData.CodeSegmentCountMax was
not updated with correct value due to the fact that SortImageRecord() called
before might change the content of current ImageRecord. This will in turn
cause incorrect memory map entries generated in SplitTable().
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c | 4 ++--
MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c b/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c
index 75d9b14c1f..a84507df95 100644
--- a/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c
@@ -1229,12 +1229,12 @@ InsertImageRecord (
InsertTailList (&mImagePropertiesPrivateData.ImageRecordList, &ImageRecord->Link);
mImagePropertiesPrivateData.ImageRecordCount++;
- SortImageRecord ();
-
if (mImagePropertiesPrivateData.CodeSegmentCountMax < ImageRecord->CodeSegmentCount) {
mImagePropertiesPrivateData.CodeSegmentCountMax = ImageRecord->CodeSegmentCount;
}
+ SortImageRecord ();
+
Finish:
return ;
}
diff --git a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
index e3c505ef18..36ccf65fa3 100644
--- a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
@@ -1214,12 +1214,12 @@ SmmInsertImageRecord (
InsertTailList (&mImagePropertiesPrivateData.ImageRecordList, &ImageRecord->Link);
mImagePropertiesPrivateData.ImageRecordCount++;
- SortImageRecord ();
-
if (mImagePropertiesPrivateData.CodeSegmentCountMax < ImageRecord->CodeSegmentCount) {
mImagePropertiesPrivateData.CodeSegmentCountMax = ImageRecord->CodeSegmentCount;
}
+ SortImageRecord ();
+
Finish:
return ;
}
--
2.15.1.windows.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MdeModulePkg/Core: Fix incorrect memory map generated in a rare case
2017-12-18 8:39 [PATCH] MdeModulePkg/Core: Fix incorrect memory map generated in a rare case Jian J Wang
@ 2017-12-19 3:50 ` Yao, Jiewen
0 siblings, 0 replies; 2+ messages in thread
From: Yao, Jiewen @ 2017-12-19 3:50 UTC (permalink / raw)
To: Wang, Jian J, edk2-devel@lists.01.org; +Cc: Zeng, Star, Dong, Eric
Reviewed-by: Jiewen.yao@intel.com
> -----Original Message-----
> From: Wang, Jian J
> Sent: Monday, December 18, 2017 4:40 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] MdeModulePkg/Core: Fix incorrect memory map generated in
> a rare case
>
> The root cause is that mImagePropertiesPrivateData.CodeSegmentCountMax
> was
> not updated with correct value due to the fact that SortImageRecord() called
> before might change the content of current ImageRecord. This will in turn
> cause incorrect memory map entries generated in SplitTable().
>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
> ---
> MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c | 4 ++--
> MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c
> b/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c
> index 75d9b14c1f..a84507df95 100644
> --- a/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c
> +++ b/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c
> @@ -1229,12 +1229,12 @@ InsertImageRecord (
> InsertTailList (&mImagePropertiesPrivateData.ImageRecordList,
> &ImageRecord->Link);
> mImagePropertiesPrivateData.ImageRecordCount++;
>
> - SortImageRecord ();
> -
> if (mImagePropertiesPrivateData.CodeSegmentCountMax <
> ImageRecord->CodeSegmentCount) {
> mImagePropertiesPrivateData.CodeSegmentCountMax =
> ImageRecord->CodeSegmentCount;
> }
>
> + SortImageRecord ();
> +
> Finish:
> return ;
> }
> diff --git a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
> b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
> index e3c505ef18..36ccf65fa3 100644
> --- a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
> +++ b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
> @@ -1214,12 +1214,12 @@ SmmInsertImageRecord (
> InsertTailList (&mImagePropertiesPrivateData.ImageRecordList,
> &ImageRecord->Link);
> mImagePropertiesPrivateData.ImageRecordCount++;
>
> - SortImageRecord ();
> -
> if (mImagePropertiesPrivateData.CodeSegmentCountMax <
> ImageRecord->CodeSegmentCount) {
> mImagePropertiesPrivateData.CodeSegmentCountMax =
> ImageRecord->CodeSegmentCount;
> }
>
> + SortImageRecord ();
> +
> Finish:
> return ;
> }
> --
> 2.15.1.windows.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-19 3:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-18 8:39 [PATCH] MdeModulePkg/Core: Fix incorrect memory map generated in a rare case Jian J Wang
2017-12-19 3:50 ` Yao, Jiewen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox