Re: 回复: 回复: [edk2-devel] [PATCH v4 00/14] Add ImagePropertiesRecordLib and Fix MAT Bugs

Taylor Beebe taylor.d.beebe at gmail.com
Fri Oct 13 22:43:02 UTC 2023


Thank you Liming :)

Patches 2, 3, 4, 5, and 11 still need reviews -- 4 of them are just 
adding the new library to the package DSC files.


This bug has cost me a significant amount of hours to debug, fix, and 
unit-test. I have been

specific in the cases which cause issues and demonstrated the problem 
via testing yet this

patch has now been in flight for over 2 months. In fact, there have been 
no significant functional

changes to the series since it was originally submitted almost 3 months 
ago. I complied with

Ray's request to reshuffle the commit structure to ease the review 
burden but am still

waiting for feedback or even acknowledgement that it's being looked at.


Everyone in the "To" line of this email has the authority to push this 
toward the finish line.

Can I please get some help?

Reference: Add ImagePropertiesRecordLib and Fix MAT Bugs by TaylorBeebe 
· Pull Request #4900 · tianocore/edk2 (github.com) 
<https://github.com/tianocore/edk2/pull/4900>

Bugzilla: 4492 – MAT Logic Incorrectly Reports Runtime Images 
(tianocore.org) <https://bugzilla.tianocore.org/show_bug.cgi?id=4492>

-Taylor

On 10/10/2023 7:14 PM, gaoliming via groups.io wrote:
>
> Taylor:
>
>  Thanks for your detail information. I understand more in the detail. 
> The changes is good to me. Reviewed-by: Liming Gao 
> <gaoliming at byosoft.com.cn>
>
> Thanks
>
> Liming
>
> *发件人:*devel at edk2.groups.io <devel at edk2.groups.io> *代表 *Taylor Beebe
> *发送时间:*2023年10月9日3:21
> *收件人:*devel at edk2.groups.io; gaoliming at byosoft.com.cn; 'Ard Biesheuvel' 
> <ardb at kernel.org>
> *抄送:*'Andrew Fish' <afish at apple.com>; 'Ard Biesheuvel' 
> <ardb+tianocore at kernel.org>; 'Dandan Bi' <dandan.bi at intel.com>; 'Eric 
> Dong' <eric.dong at intel.com>; 'Gerd Hoffmann' <kraxel at redhat.com>; 'Guo 
> Dong' <guo.dong at intel.com>; 'Gua Guo' <gua.guo at intel.com>; 'James Lu' 
> <james.lu at intel.com>; 'Jian J Wang' <jian.j.wang at intel.com>; 'Jiewen 
> Yao' <jiewen.yao at intel.com>; 'Jordan Justen' 
> <jordan.l.justen at intel.com>; 'Leif Lindholm' 
> <quic_llindhol at quicinc.com>; 'Rahul Kumar' <rahul1.kumar at intel.com>; 
> 'Ray Ni' <ray.ni at intel.com>; 'Sami Mujawar' <sami.mujawar at arm.com>; 
> 'Sean Rhodes' <sean at starlabs.systems>
> *主题:*Re: 回复: [edk2-devel] [PATCH v4 00/14] Add 
> ImagePropertiesRecordLib and Fix MAT Bugs
>
> 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 (#109611): https://edk2.groups.io/g/devel/message/109611
Mute This Topic: https://groups.io/mt/101889424/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20231013/77a3af6f/attachment-0001.htm>


More information about the edk2-devel-archive mailing list