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 58690AC146E for ; Mon, 27 Nov 2023 18:40:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=BZpLr4nHbYDBxe1z0KDxDCWlKkDSk42uOYu0Rd92Sgs=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1701110420; v=1; b=FbwdE9Tg3Kc+NOpKgRkOqYDWSm8IJ0EJKFBMUOvjP6TbfOMWLmmsgEoZnUpjW5xmK4XQwEiq chYf3rL4S4kdVbb4meR1f/39QxESe4d2zgMjvpVLEjomTkTe9CWd0yl3IlV0qQSbYWKfgG62P89 mosrBFTuP/GiKlSUiQy4ssd4= X-Received: by 127.0.0.2 with SMTP id iSdNYY7687511xsl92soVsFq; Mon, 27 Nov 2023 10:40:20 -0800 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.103221.1701110419380841920 for ; Mon, 27 Nov 2023 10:40:19 -0800 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A7B276143D for ; Mon, 27 Nov 2023 18:40:18 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 718D6C43397 for ; Mon, 27 Nov 2023 18:40:18 +0000 (UTC) X-Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2c993089736so26977681fa.0 for ; Mon, 27 Nov 2023 10:40:18 -0800 (PST) X-Gm-Message-State: YDT6hKFFceP01E6GQKrE9LeIx7686176AA= X-Google-Smtp-Source: AGHT+IElG7PNntFbbzKQlkkIroMcLyO3uICaL0q4di+IOIYqfR+Bud6k32Or1lYGOx2GCi2X52htC/niFGIfx7xBRbw= X-Received: by 2002:a05:651c:198e:b0:2c9:94a3:6e2 with SMTP id bx14-20020a05651c198e00b002c994a306e2mr3365214ljb.5.1701110416663; Mon, 27 Nov 2023 10:40:16 -0800 (PST) MIME-Version: 1.0 References: <20231127181818.411-1-taylor.d.beebe@gmail.com> In-Reply-To: <20231127181818.411-1-taylor.d.beebe@gmail.com> From: "Ard Biesheuvel" Date: Mon, 27 Nov 2023 19:40:05 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: =?UTF-8?B?UmU6IFtlZGsyLWRldmVsXSBbUEFUQ0ggdjUgMDAvMTZdIEFkZCBJbWFnZVByb3BlcnRpZXNSZWNvcmRMaWIgYW5kIEZpeCBNQVQgQnVnc+KAiw==?= To: Taylor Beebe Cc: devel@edk2.groups.io, 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 , Lazlo Ersek 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,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=FbwdE9Tg; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=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 On Mon, 27 Nov 2023 at 19:18, Taylor Beebe wrote: > > v5: > This version is purely an update of commit messages and orientation. > No code changes were made. > - Split patch 9 into 3 separate patches so each fix is in its own > commit. > - Updated the commit comment of patch 11 to add context. > Thanks for sticking with this. For the series, Reviewed-by: Ard Biesheuvel > v4: > - Expose additional functions in the Library API > - Add NULL checks to library functions and return a > status where applicable. > > 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. > > v2: > - A one-line change in patch 3 was moved to patch 9 for correctness. > > Reference: https://github.com/tianocore/edk2/pull/4590 > Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4492 > > The UEFI and SMM MAT logic contains duplicate logic for manipulating image > 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. > > 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. > > 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. > > 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. > > The remaining patches add library instances to DSC files and remove > the image properties record logic from the SMM and UEFI MAT logic. > > 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 > Cc: Lazlo Ersek > > Taylor Beebe (16): > 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 MAT Descriptor Count Calculation > MdeModulePkg: Fix MAT SplitRecord() Logic > MdeModulePkg: Fix MAT SplitTable() 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 > > 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/ImagePropertiesRecordLibUnitTestHost.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/ImagePropertiesRecordLibUnitTestHost.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/ImagePropertiesRecordLib.c > create mode 100644 MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.c > create mode 100644 MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h > create mode 100644 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf > create mode 100644 MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.inf > > -- > 2.42.0.windows.2 > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111755): https://edk2.groups.io/g/devel/message/111755 Mute This Topic: https://groups.io/mt/102834905/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-