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 457C074003A for ; Wed, 16 Aug 2023 18:14:20 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=nIt4y83DYm8LZMVaZPBtG5gHe5248g1JnPHt+QCJLQ8=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1692209659; v=1; b=NZr6Vw8o1z+7/NREdj4Oo3pzOgz/S1rESCYz+ZL9uH2PhZwskj0BuAR3KV4+QE32xp7nR5U2 xEsCGvPX0PryvD0WOG48Tlc1XV88/zV9iDDeJ3t1XdmwgPgn3L3B25O5tzXbUZdlk2/HMYY5c/v 5PikpUuTDN30R5hKR1u+17LI= X-Received: by 127.0.0.2 with SMTP id cGVUYY7687511x3cKnkvPDqX; Wed, 16 Aug 2023 11:14:19 -0700 X-Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mx.groups.io with SMTP id smtpd.web10.167962.1692209657731829207 for ; Wed, 16 Aug 2023 11:14:18 -0700 X-Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1bbff6b2679so44856835ad.1 for ; Wed, 16 Aug 2023 11:14:17 -0700 (PDT) X-Gm-Message-State: chCRzRX62r82AJrsMAjmgvMBx7686176AA= X-Google-Smtp-Source: AGHT+IFmlCHu60J39c1yI0bHQLioBm74xWHP6hywsZcaoBPr+AusVl//yu3gjWGvofeAvj2pJuLsOw== X-Received: by 2002:a17:902:720b:b0:1ba:ff36:e0d8 with SMTP id ba11-20020a170902720b00b001baff36e0d8mr2474565plb.61.1692209656938; Wed, 16 Aug 2023 11:14:16 -0700 (PDT) X-Received: from [192.168.0.125] ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id y7-20020a170902b48700b001b83dc8649dsm13488757plr.250.2023.08.16.11.14.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Aug 2023 11:14:16 -0700 (PDT) Message-ID: <13bb6dac-0c21-42e4-828f-327c938c3c36@taylorbeebe.com> Date: Wed, 16 Aug 2023 11:14:15 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v4 00/14] Add ImagePropertiesRecordLib and Fix MAT Bugs To: devel@edk2.groups.io Cc: Andrew Fish , Ard Biesheuvel , Dandan Bi , Eric Dong , Gerd Hoffmann , Guo Dong , Gua Guo , James Lu , Jian J Wang , Jiewen Yao , Jordan Justen , Leif Lindholm , Liming Gao , Rahul Kumar , Ray Ni , Sami Mujawar , Sean Rhodes References: <177845D072580598.19347@groups.io> From: "Taylor Beebe" In-Reply-To: <177845D072580598.19347@groups.io> 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 Reply-To: devel@edk2.groups.io,t@taylorbeebe.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=NZr6Vw8o; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Can I please get reviews/feedback on this patch series? On 8/4/2023 12:46 PM, Taylor Beebe via groups.io wrote: > From: Taylor Beebe >=20 > v4: > - Expose additional functions in the Library API > - Add NULL checks to library functions and return a > status where applicable. >=20 > v3: > - Refactor patch series so the transition of logic from the DXE > MAT logic to the new library is more clear. > - Update function headers to improve clarity and follow EDK2 > standards. > - Add Create and Delete functions for Image Properties Records > and redirect some of the SMM and DXE MAT code to use these > functions. > - Update/Add DumpImageRecords() to print the image name and code > sections of each runtime image which will be put in the MAT. > The DXE and SMM MAT logic will now invoke the DumpImageRecords() > on DEBUG builds at the EndOfDxe event to install the MAT. >=20 > v2: > - A one-line change in patch 3 was moved to patch 9 for correctness. >=20 > Reference: https://github.com/tianocore/edk2/pull/4590 > Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4492 >=20 > The UEFI and SMM MAT logic contains duplicate logic for manipulating imag= e > properties records which is used to track runtime images. > This patch series adds a new library, ImagePropertiesRecordLib, > which consolidates this logic and fixes the bugs which currently exist in > the MAT logic. >=20 > The first patch adds the ImagePropertiesRecordLib implementation which > is a copy of the UEFI MAT logic with minor modifications to remove the > reliance on globabl variables and make the code unit testable. >=20 > The second patch adds a unit test for the ImagePropertiesRecordLib. The > logic tests various potential layouts of the EFI memory map and runtime > images. 3/4 of these tests will fail which demonstrates the MAT logic > bugs. >=20 > The third patch fixes the logic in the ImagePropertiesRecordLib so > that all of the unit tests pass and the MAT logic can be fixed by > using the library. >=20 > The remaining patches add library instances to DSC files and remove > the image properties record logic from the SMM and UEFI MAT logic. >=20 > Cc: Andrew Fish > Cc: Ard Biesheuvel > Cc: Dandan Bi > Cc: Eric Dong > Cc: Gerd Hoffmann > Cc: Guo Dong > Cc: Gua Guo > Cc: James Lu > Cc: Jian J Wang > Cc: Jiewen Yao > Cc: Jordan Justen > Cc: Leif Lindholm > Cc: Liming Gao > Cc: Rahul Kumar > Cc: Ray Ni > Cc: Sami Mujawar > Cc: Sean Rhodes >=20 > Taylor Beebe (14): > MdeModulePkg: Add ImagePropertiesRecordLib > ArmVirtPkg: Add ImagePropertiesRecordLib Instance > EmulatorPkg: Add ImagePropertiesRecordLib Instance > OvmfPkg: Add ImagePropertiesRecordLib Instance > UefiPayloadPkg: Add ImagePropertiesRecordLib Instance > MdeModulePkg: Update MemoryAttributesTable.c to Reduce Global Variable > Use > MdeModulePkg: Move Some DXE MAT Logic to ImagePropertiesRecordLib > MdeModulePkg: Add ImagePropertiesRecordLib Host-Based Unit Test > MdeModulePkg: Fix Bugs in MAT Logic > MdeModulePkg: Add NULL checks and Return Status to > ImagePropertiesRecordLib > UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero > MdeModulePkg: Transition SMM MAT Logic to Use ImagePropertiesRecordLib > MdeModulePkg: Add Logic to Create/Delete Image Properties Records > MdeModulePkg: Update DumpImageRecord() in ImagePropertiesRecordLib >=20 > MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c = | 967 +---------------- > MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c = | 24 +- > MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c = | 958 +--------------- > MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.= c | 1144 ++++++++++++++++++++ > MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesR= ecordLibUnitTestHost.c | 938 ++++++++++++++++ > UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c = | 19 +- > ArmVirtPkg/ArmVirt.dsc.inc = | 1 + > EmulatorPkg/EmulatorPkg.dsc = | 1 + > MdeModulePkg/Core/Dxe/DxeMain.h = | 20 - > MdeModulePkg/Core/Dxe/DxeMain.inf = | 1 + > MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf = | 1 + > MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h = | 234 ++++ > MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.= inf | 31 + > MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesR= ecordLibUnitTestHost.inf | 35 + > MdeModulePkg/MdeModulePkg.dec = | 5 + > MdeModulePkg/MdeModulePkg.dsc = | 2 + > MdeModulePkg/Test/MdeModulePkgHostTest.dsc = | 6 + > OvmfPkg/AmdSev/AmdSevX64.dsc = | 1 + > OvmfPkg/Bhyve/BhyveX64.dsc = | 1 + > OvmfPkg/CloudHv/CloudHvX64.dsc = | 1 + > OvmfPkg/IntelTdx/IntelTdxX64.dsc = | 1 + > OvmfPkg/Microvm/MicrovmX64.dsc = | 1 + > OvmfPkg/OvmfPkgIa32.dsc = | 1 + > OvmfPkg/OvmfPkgIa32X64.dsc = | 1 + > OvmfPkg/OvmfPkgX64.dsc = | 1 + > OvmfPkg/OvmfXen.dsc = | 1 + > OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc = | 1 + > UefiPayloadPkg/UefiPayloadPkg.dsc = | 1 + > 28 files changed, 2524 insertions(+), 1874 deletions(-) > create mode 100644 MdeModulePkg/Library/ImagePropertiesRecordLib/ImageP= ropertiesRecordLib.c > create mode 100644 MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTe= st/ImagePropertiesRecordLibUnitTestHost.c > create mode 100644 MdeModulePkg/Include/Library/ImagePropertiesRecordLi= b.h > create mode 100644 MdeModulePkg/Library/ImagePropertiesRecordLib/ImageP= ropertiesRecordLib.inf > create mode 100644 MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTe= st/ImagePropertiesRecordLibUnitTestHost.inf >=20 --=20 Taylor Beebe Software Engineer @ Microsoft -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107804): https://edk2.groups.io/g/devel/message/107804 Mute This Topic: https://groups.io/mt/100553430/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-