From: Achin Gupta <achin.gu...@arm.com> This patch skips zero sized sections in the StMM SP image e.g. .reloc since there is no point in attempting to change their permissions.
Signed-off-by: Achin Gupta <achin.gu...@arm.com> Signed-off-by: Nishant Sharma <nishant.sha...@arm.com> --- StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c index 5c6bd0e1d7d2..891e79b32b6f 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/SetPermissions.c @@ -2,7 +2,7 @@ Locate, get and update PE/COFF permissions during Standalone MM Foundation Entry point on ARM platforms. -Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.<BR> +Copyright (c) 2017 - 2023, Arm Ltd. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -118,6 +118,22 @@ UpdateMmFoundationPeCoffPermissions ( ImageContext->ImageAddress, SectionHeader.PointerToRawData )); + DEBUG (( + DEBUG_INFO, + "%a: Section %d of image at 0x%lx has %d bytes size\n", + __func__, Index, + ImageContext->ImageAddress, + SectionHeader.Misc.VirtualSize + )); + + // Skip sections with a size of 0 + if (SectionHeader.Misc.VirtualSize == 0) { + DEBUG (( + DEBUG_INFO, + "%a: Skipping section %a \n", __func__, SectionHeader.Name + )); + continue; + } // // If the section is marked as XN then remove the X attribute. Furthermore, -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106803): https://edk2.groups.io/g/devel/message/106803 Mute This Topic: https://groups.io/mt/100079883/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-