* [edk2-devel] [PATCH v3 0/3] MdeModulePkg: ImagePropertiesRecordLib Fixes
@ 2024-03-29 20:21 Oliver Smith-Denny
2024-03-30 0:06 ` Michael D Kinney
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Smith-Denny @ 2024-03-29 20:21 UTC (permalink / raw)
To: devel; +Cc: Liming Gao, Leif Lindholm, Ard Biesheuvel, Sami Mujawar,
Taylor Beebe
ImagePropertiesRecordLib is currently creating Image Records that
are not accurate. It is setting the CodeSegmentSize to be the size
of the raw data in the image file, however, when the image is
loaded into memory, the raw data size is aligned to the
section alignment. This caused the memory attributes table to
have incorrect entries for systems, like ARM64, where the section
alignment is not 4k for all modules.
In fixing this, I noticed that MemoryProtection.c is using its own
version of image record creation where this logic was actually
correct. ImagePropertiesRecordLib was created to consolidate the
logic around creating and managing image records, so this patchset
also updates MemoryProtection.c to use ImagePropertiesRecordsLib
after making a few small adjustments to ensure the same functionality
is present.
This patchset was tested on ArmVirtQemu to ensure that all image
records were the same before and after this, other than fixing
the CodeSegmentSize.
v3:
- Fix merge conflict in MemoryProtection.c
v2:
- Align VirtualSize instead of SizeOfRawData
Github PR: https://github.com/tianocore/edk2/pull/5504
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Taylor Beebe <taylor.d.beebe@gmail.com>
Oliver Smith-Denny (3):
MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for
CodeSize
MdeModulePkg: ImagePropertiesRecordLib: Consolidate Usage
MdeModulePkg: MemoryProtection: Use ImageRecordPropertiesLib
Oliver Smith-Denny (3):
MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for
CodeSize
MdeModulePkg: ImagePropertiesRecordLib: Consolidate Usage
MdeModulePkg: MemoryProtection: Use ImageRecordPropertiesLib
MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 241 +++-----------------
MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c | 86 +++++--
2 files changed, 94 insertions(+), 233 deletions(-)
--
2.40.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117239): https://edk2.groups.io/g/devel/message/117239
Mute This Topic: https://groups.io/mt/105223002/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH v3 0/3] MdeModulePkg: ImagePropertiesRecordLib Fixes
[not found] <17C155D00B87C04B.23967@groups.io>
@ 2024-03-29 20:24 ` Oliver Smith-Denny
0 siblings, 0 replies; 3+ messages in thread
From: Oliver Smith-Denny @ 2024-03-29 20:24 UTC (permalink / raw)
To: devel, Michael Kinney
Cc: Liming Gao, Leif Lindholm, Ard Biesheuvel, Sami Mujawar,
Taylor Beebe
Sorry Mike, I realized I missed you on the cover letter email. I have
the CI PR up (the commit messages there don't have the RBs/AB) and I
made sure it passed all gates.
Thanks for getting this merged.
Oliver
On 3/29/2024 1:21 PM, Oliver Smith-Denny wrote:
> ImagePropertiesRecordLib is currently creating Image Records that
> are not accurate. It is setting the CodeSegmentSize to be the size
> of the raw data in the image file, however, when the image is
> loaded into memory, the raw data size is aligned to the
> section alignment. This caused the memory attributes table to
> have incorrect entries for systems, like ARM64, where the section
> alignment is not 4k for all modules.
>
> In fixing this, I noticed that MemoryProtection.c is using its own
> version of image record creation where this logic was actually
> correct. ImagePropertiesRecordLib was created to consolidate the
> logic around creating and managing image records, so this patchset
> also updates MemoryProtection.c to use ImagePropertiesRecordsLib
> after making a few small adjustments to ensure the same functionality
> is present.
>
> This patchset was tested on ArmVirtQemu to ensure that all image
> records were the same before and after this, other than fixing
> the CodeSegmentSize.
>
> v3:
> - Fix merge conflict in MemoryProtection.c
>
> v2:
> - Align VirtualSize instead of SizeOfRawData
>
> Github PR: https://github.com/tianocore/edk2/pull/5504
>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Taylor Beebe <taylor.d.beebe@gmail.com>
>
> Oliver Smith-Denny (3):
> MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for
> CodeSize
> MdeModulePkg: ImagePropertiesRecordLib: Consolidate Usage
> MdeModulePkg: MemoryProtection: Use ImageRecordPropertiesLib
>
> Oliver Smith-Denny (3):
> MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for
> CodeSize
> MdeModulePkg: ImagePropertiesRecordLib: Consolidate Usage
> MdeModulePkg: MemoryProtection: Use ImageRecordPropertiesLib
>
> MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 241 +++-----------------
> MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c | 86 +++++--
> 2 files changed, 94 insertions(+), 233 deletions(-)
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117244): https://edk2.groups.io/g/devel/message/117244
Mute This Topic: https://groups.io/mt/105223002/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH v3 0/3] MdeModulePkg: ImagePropertiesRecordLib Fixes
2024-03-29 20:21 Oliver Smith-Denny
@ 2024-03-30 0:06 ` Michael D Kinney
0 siblings, 0 replies; 3+ messages in thread
From: Michael D Kinney @ 2024-03-30 0:06 UTC (permalink / raw)
To: devel@edk2.groups.io, osde@linux.microsoft.com
Cc: Liming Gao, Leif Lindholm, Ard Biesheuvel, Sami Mujawar,
Taylor Beebe, Kinney, Michael D
Merged: https://github.com/tianocore/edk2/pull/5505
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Oliver
> Smith-Denny
> Sent: Friday, March 29, 2024 1:21 PM
> To: devel@edk2.groups.io
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Leif Lindholm
> <quic_llindhol@quicinc.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> Sami Mujawar <sami.mujawar@arm.com>; Taylor Beebe
> <taylor.d.beebe@gmail.com>
> Subject: [edk2-devel] [PATCH v3 0/3] MdeModulePkg: ImagePropertiesRecordLib
> Fixes
>
> ImagePropertiesRecordLib is currently creating Image Records that
> are not accurate. It is setting the CodeSegmentSize to be the size
> of the raw data in the image file, however, when the image is
> loaded into memory, the raw data size is aligned to the
> section alignment. This caused the memory attributes table to
> have incorrect entries for systems, like ARM64, where the section
> alignment is not 4k for all modules.
>
> In fixing this, I noticed that MemoryProtection.c is using its own
> version of image record creation where this logic was actually
> correct. ImagePropertiesRecordLib was created to consolidate the
> logic around creating and managing image records, so this patchset
> also updates MemoryProtection.c to use ImagePropertiesRecordsLib
> after making a few small adjustments to ensure the same functionality
> is present.
>
> This patchset was tested on ArmVirtQemu to ensure that all image
> records were the same before and after this, other than fixing
> the CodeSegmentSize.
>
> v3:
> - Fix merge conflict in MemoryProtection.c
>
> v2:
> - Align VirtualSize instead of SizeOfRawData
>
> Github PR: https://github.com/tianocore/edk2/pull/5504
>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Taylor Beebe <taylor.d.beebe@gmail.com>
>
> Oliver Smith-Denny (3):
> MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for
> CodeSize
> MdeModulePkg: ImagePropertiesRecordLib: Consolidate Usage
> MdeModulePkg: MemoryProtection: Use ImageRecordPropertiesLib
>
> Oliver Smith-Denny (3):
> MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for
> CodeSize
> MdeModulePkg: ImagePropertiesRecordLib: Consolidate Usage
> MdeModulePkg: MemoryProtection: Use ImageRecordPropertiesLib
>
> MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c |
> 241 +++-----------------
> MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c |
> 86 +++++--
> 2 files changed, 94 insertions(+), 233 deletions(-)
>
> --
> 2.40.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#117239): https://edk2.groups.io/g/devel/message/117239
> Mute This Topic: https://groups.io/mt/105223002/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117246): https://edk2.groups.io/g/devel/message/117246
Mute This Topic: https://groups.io/mt/105223002/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-30 0:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <17C155D00B87C04B.23967@groups.io>
2024-03-29 20:24 ` [edk2-devel] [PATCH v3 0/3] MdeModulePkg: ImagePropertiesRecordLib Fixes Oliver Smith-Denny
2024-03-29 20:21 Oliver Smith-Denny
2024-03-30 0:06 ` Michael D Kinney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox