From: "Taylor Beebe" <taylor.d.beebe@gmail.com>
To: devel@edk2.groups.io, gaoliming@byosoft.com.cn,
'Ard Biesheuvel' <ardb@kernel.org>
Cc: 'Andrew Fish' <afish@apple.com>,
'Ard Biesheuvel' <ardb+tianocore@kernel.org>,
'Dandan Bi' <dandan.bi@intel.com>,
'Eric Dong' <eric.dong@intel.com>,
'Gerd Hoffmann' <kraxel@redhat.com>,
'Guo Dong' <guo.dong@intel.com>, 'Gua Guo' <gua.guo@intel.com>,
'James Lu' <james.lu@intel.com>,
'Jian J Wang' <jian.j.wang@intel.com>,
'Jiewen Yao' <jiewen.yao@intel.com>,
'Jordan Justen' <jordan.l.justen@intel.com>,
'Leif Lindholm' <quic_llindhol@quicinc.com>,
'Rahul Kumar' <rahul1.kumar@intel.com>,
'Ray Ni' <ray.ni@intel.com>,
'Sami Mujawar' <sami.mujawar@arm.com>,
'Sean Rhodes' <sean@starlabs.systems>
Subject: Re: 回复: [edk2-devel] [PATCH v4 00/14] Add ImagePropertiesRecordLib and Fix MAT Bugs
Date: Sun, 8 Oct 2023 12:20:48 -0700 [thread overview]
Message-ID: <c08705a8-66fe-48fe-985a-5b4870b2c6f6@gmail.com> (raw)
In-Reply-To: <081601d9f8e3$2ac79d90$8056d8b0$@byosoft.com.cn>
[-- Attachment #1: Type: text/plain, Size: 4659 bytes --]
On 10/6/2023 10:57 PM, gaoliming via groups.io wrote:
> Taylor:
> I agree to add new ImagePropertiesRecordLib library for DxeCore and SmmCore. The impact is that platform needs to update their DSC with new library.
>
> Frankly, I have not understood MAT code in detail. So, I have no comments on this part.
>
> Last, what test have been done to verify the current functionality?
TLDR: Patch 8 adds the unit test which invokes the lions share of the
new library. The remaining functional changes were tested by output
comparison.
To provide context on how best to review this series, where the
functional changes are, and how they were validated, here's a breakdown
of each patch:
Patch 1: Add the ImagePropertiesRecordLib definition and "blank"
implementation.
Patches 2-5: Add instances of the library to the platform DSC files.
Patch 6: Updates the logic in Dxe/Misc/MemoryAttributesTable.c to use
parameters passed in instead of referencing directly the global variables.
This functionally changes nothing but allows the logic
to be moved to a library.
Patch 7: Move the Dxe/Misc/MemoryAttributesTable.c Image Properties
Record manipulation logic to ImagePropertiesRecordLib -- still no
functional changes.
------------ FUNCTIONAL CHANGES START ------------
Patch 8: Add ImagePropertiesRecordLibHostBasedUnitTest which tests the
logic now in ImagePropertiesRecordLib and 3/4 of the tests fail to show
that the logic is incorrect.
The test calls into the SplitTable() routine which is
the most complex and invokes almost every other function in
ImagePropertiesRecordLib.
Patch 9: Fixes the issues in the logic resulting in
ImagePropertiesRecordLibHostBasedUnitTest passing fully. The fixes
change some logic in SpitTable() and SplitRecord() (which are tested by
the unit test)
And increases the buffer size for the split table in
Dxe/Misc/MemoryAttributesTable.c to fix another edge case. The rest of
the exposed functions in ImagePropertiesRecordLib.h
are unchanged through this patch.
Patch 10: Simply updates function headers, adds return status values to
some functions, and adds NULL checks to sanity check the caller input.
Patch 11: Makes a minor change to the SMM memory attribute logic to use
the attributes present in the memory map created by the SplitTable()
routine. This needs to be done because the original
SMM MAT logic would manipulate the split memory map
to change the memory type of loaded runtime image data sections to
EfiRuntimeServicesData so it could apply XP and RO based
on each entry EFI type. This process is unecessary,
though, because the SplitTable() routine in
PiSmmCore/MemoryAttributesTable.c already sets the XP and RO attributes
appropriately on PE images, and
EnforceMemoryMapAttribute() in PiSmmCore/MemoryAttributesTable.c sets
the XP and RO attributes on the non PE runtime regions. All that to say,
this
is still output-wise the same as it was before.
Patch 12: Update the SMM MAT logic to use ImagePropertiesRecordLib. If a
direct comparison was done between the original DXE and SMM MAT logic,
you would see many differences. Some bugs
on the DXE side were actually fixed on the SMM side.
For the rest, as best I can tell, there was no reason for the remaining
differences. I also checked the SMM MAT table pre and post this
patch series on OvmfPkg and found output the same.
Patch 13: This patch consolidates the DXE and SMM logic for creating
Image Properties Records into the library which is extremely close to
the ProtectUefiImage() logic in MemoryProtection.c. If you're
familiar to that logic, this should be easy to review.
Patch 14: Just updates the DumpImageRecord() routine to be more helpful
and print the loaded image .efi name. This info will be dumped for both
DXE and SMM debug output and will help us find
MAT issues easier in the future.
Hope this helps :)
-Taylor
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109402): https://edk2.groups.io/g/devel/message/109402
Mute This Topic: https://groups.io/mt/101812772/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
[-- Attachment #2: Type: text/html, Size: 6017 bytes --]
next prev parent reply other threads:[~2023-10-08 19:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <177845D072580598.19347@groups.io>
2023-08-16 18:14 ` [edk2-devel] [PATCH v4 00/14] Add ImagePropertiesRecordLib and Fix MAT Bugs Taylor Beebe
[not found] ` <177BEFB7EF58B50B.8497@groups.io>
2023-08-28 16:27 ` Taylor Beebe
2023-08-28 16:38 ` Ard Biesheuvel
2023-09-26 16:02 ` Taylor Beebe
[not found] ` <17887E55BF3885BC.16687@groups.io>
2023-10-03 17:56 ` Taylor Beebe
2023-10-03 18:57 ` Ard Biesheuvel
2023-10-03 19:04 ` Taylor Beebe
2023-10-07 5:57 ` 回复: " gaoliming via groups.io
2023-10-08 19:20 ` Taylor Beebe [this message]
2023-10-11 2:14 ` 回复: " gaoliming via groups.io
2023-10-13 22:43 ` Taylor Beebe
2023-10-24 0:14 ` Michael D Kinney
2023-10-24 0:36 ` Taylor Beebe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c08705a8-66fe-48fe-985a-5b4870b2c6f6@gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox