From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id C01E8D806D5 for ; Mon, 11 Mar 2024 21:29:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=CAx0sdI4Gs+LIU0/2e6VKhiUkYtLuqqqVj57CbVlKf4=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1710192567; v=1; b=tnHhpF5/76HuDwx5aJYhkUnfzr3basgLqL2y6G3dwB5XXssDqWofDdOX/SI9Cb7S0UBzC0nR gNsfYovaJHm6BNaZd28f+BD1j1GyULuyIpCH+J4VbSNsEkpHCkEfKCZXmJqJNr+lx0jlWdtJWKq O2rOiTZrAJmyoaHn5G73frE5B/s4VqiFpdlWHJEYxcEE6d9ENEGi0z9mLaiWPsTYMLfS4uFtd6j vsWgTfGmfS41cj4aXQOwa38NGDUIEjZD8ofgeGK7S+KPmqJs6h1VGcKkSbXLAZfTNxmcrAtsh8l fabaE2AC/KUJarRiThgi3XD6f698fNRt+FP4Z/ugbS7Og== X-Received: by 127.0.0.2 with SMTP id FFt5YY7687511x86UhJCubJq; Mon, 11 Mar 2024 14:29:27 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.5294.1710192566893190386 for ; Mon, 11 Mar 2024 14:29:26 -0700 X-Received: from OSD-Desktop.redmond.corp.microsoft.com (unknown [131.107.160.171]) by linux.microsoft.com (Postfix) with ESMTPSA id 4268E20B74C0; Mon, 11 Mar 2024 14:29:26 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4268E20B74C0 From: "Oliver Smith-Denny" To: devel@edk2.groups.io Cc: Liming Gao , Leif Lindholm , Ard Biesheuvel , Sami Mujawar , Taylor Beebe Subject: [edk2-devel] [PATCH v2 0/3] MdeModulePkg: ImagePropertiesRecordLib Fixes Date: Mon, 11 Mar 2024 14:29:21 -0700 Message-Id: <20240311212924.11633-1-osde@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 11 Mar 2024 14:29:26 -0700 Reply-To: devel@edk2.groups.io,osde@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: PUj8QJbwiK3lbqEY8427ujIgx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="tnHhpF5/"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=none) 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. v2: - Align VirtualSize instead of SizeOfRawData Github PR: https://github.com/tianocore/edk2/pull/5402 Cc: Liming Gao Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Taylor Beebe 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(-) --=20 2.40.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116657): https://edk2.groups.io/g/devel/message/116657 Mute This Topic: https://groups.io/mt/104873191/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-