Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 8bc44608b8ea5807123bf2a050d15a66f0a4f4b0
      
https://github.com/tianocore/edk2/commit/8bc44608b8ea5807123bf2a050d15a66f0a4f4b0
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    A MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
    A MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
    A MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
    M MdeModulePkg/MdeModulePkg.dec
    M MdeModulePkg/MdeModulePkg.dsc

  Log Message:
  -----------
  MdeModulePkg: Add ImagePropertiesRecordLib

Create a library for manipulating image properties records. The
library is currently blank and will be filled in a future patch
to help with reviewer readability.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: 16b1e88502f92dd23f049cb7bebef346f7dab1eb
      
https://github.com/tianocore/edk2/commit/16b1e88502f92dd23f049cb7bebef346f7dab1eb
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M ArmVirtPkg/ArmVirt.dsc.inc

  Log Message:
  -----------
  ArmVirtPkg: Add ImagePropertiesRecordLib Instance

Add an instance of ImagePropertiesRecordLib which will be used by the
DXE Core.

Cc: Ard Biesheuvel <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>


  Commit: 21b831c5b56c34c369e0de7be0fb66c96bd622e0
      
https://github.com/tianocore/edk2/commit/21b831c5b56c34c369e0de7be0fb66c96bd622e0
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M EmulatorPkg/EmulatorPkg.dsc

  Log Message:
  -----------
  EmulatorPkg: Add ImagePropertiesRecordLib Instance

Add an instance of ImagePropertiesRecordLib which will be used by the
DXE Core.

Cc: Andrew Fish <[email protected]>
Cc: Ray Ni <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>


  Commit: 1ef4e102c2b58d0d55c00f406ca11a634f2f54bf
      
https://github.com/tianocore/edk2/commit/1ef4e102c2b58d0d55c00f406ca11a634f2f54bf
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M OvmfPkg/AmdSev/AmdSevX64.dsc
    M OvmfPkg/Bhyve/BhyveX64.dsc
    M OvmfPkg/CloudHv/CloudHvX64.dsc
    M OvmfPkg/IntelTdx/IntelTdxX64.dsc
    M OvmfPkg/Microvm/MicrovmX64.dsc
    M OvmfPkg/OvmfPkgIa32.dsc
    M OvmfPkg/OvmfPkgIa32X64.dsc
    M OvmfPkg/OvmfPkgX64.dsc
    M OvmfPkg/OvmfXen.dsc
    M OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc

  Log Message:
  -----------
  OvmfPkg: Add ImagePropertiesRecordLib Instance

Add an instance of ImagePropertiesRecordLib which will be used by the
DXE Core.

Cc: Ard Biesheuvel <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Jordan Justen <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
Acked-by: Jiewen Yao <[email protected]>


  Commit: 26460342d0b3f6b13620cb535e494cba4bf06d2b
      
https://github.com/tianocore/edk2/commit/26460342d0b3f6b13620cb535e494cba4bf06d2b
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M UefiPayloadPkg/UefiPayloadPkg.dsc

  Log Message:
  -----------
  UefiPayloadPkg: Add ImagePropertiesRecordLib Instance

Add an instance of ImagePropertiesRecordLib which will be used by the
DXE Core.

Cc: Guo Dong <[email protected]>
Cc: Sean Rhodes <[email protected]>
Cc: James Lu <[email protected]>
Cc: Gua Guo <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
Reviewed-by: Gua Guo <[email protected]>


  Commit: 561362368b838761368cff3c45f92d10a1a794a2
      
https://github.com/tianocore/edk2/commit/561362368b838761368cff3c45f92d10a1a794a2
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c

  Log Message:
  -----------
  MdeModulePkg: Update MemoryAttributesTable.c to Reduce Global Variable Use

This patch updates MemoryAttributesTable.c to reduce reliance on global
variables and allow some logic to move to a library.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: 7284c44951cffd52f1a08367d91b5c63c7bb9c16
      
https://github.com/tianocore/edk2/commit/7284c44951cffd52f1a08367d91b5c63c7bb9c16
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Core/Dxe/DxeMain.h
    M MdeModulePkg/Core/Dxe/DxeMain.inf
    M MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
    M MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
    M MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf

  Log Message:
  -----------
  MdeModulePkg: Move Some DXE MAT Logic to ImagePropertiesRecordLib

Move some DXE MAT logic to ImagePropertiesRecordLib to consolidate
code and enable unit testability.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: 0a9e2153129828d4df1653f449b1a846095aca3d
      
https://github.com/tianocore/edk2/commit/0a9e2153129828d4df1653f449b1a846095aca3d
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    A 
MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.c
    A 
MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.inf
    M MdeModulePkg/Test/MdeModulePkgHostTest.dsc

  Log Message:
  -----------
  MdeModulePkg: Add ImagePropertiesRecordLib Host-Based Unit Test

Create a host-based unit test for the ImagePropertiesRecordLib
SplitTable() logic. This test has 4 cases which tests different
potential image and memory map layouts. 3/4 of these tests fail
with the logic in its current state to provide proof of the bugs
in the current MAT logic.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: acb29d4cbeb4f11c33576fcde438d0a37e053933
      
https://github.com/tianocore/edk2/commit/acb29d4cbeb4f11c33576fcde438d0a37e053933
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c

  Log Message:
  -----------
  MdeModulePkg: Fix MAT Descriptor Count Calculation

|4K PAGE|DATA|CODE|DATA|CODE|DATA|4K PAGE|
Say the above memory region is currently one memory map descriptor.
The above image memory layout example contains two code sections
oriented in a way that maximizes the number of descriptors which
would be required to describe each section.

NOTE: It's unlikely that a data section would ever be between
two code sections, but it's still handled by the below formula
for correctness.

There are two code sections (let's say CodeSegmentMax == 2),
three data sections, and two unrelated memory regions flanking the
image. The number of required descriptors to describe this layout
will be 2 * 2 + 3 == 7. This patch updates the calculations to account
for the worst-case scenario.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: e2f2bbe208b4c7ebcedacfc8333df1e52cbf07eb
      
https://github.com/tianocore/edk2/commit/e2f2bbe208b4c7ebcedacfc8333df1e52cbf07eb
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c

  Log Message:
  -----------
  MdeModulePkg: Fix MAT SplitRecord() Logic

SplitRecord() does not handle the case where a memory descriptor
describes an image region plus extra pages before or after the
image region. This patch fixes this case by carving off the
unrelated regions into their own descriptors.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: 7ae0516dd9073eabca495e1f59a03193cdd99614
      
https://github.com/tianocore/edk2/commit/7ae0516dd9073eabca495e1f59a03193cdd99614
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c

  Log Message:
  -----------
  MdeModulePkg: Fix MAT SplitTable() Logic

SplitTable() does not properly handle the case where there is
an odd number of code regions within a loaded image. When there are
an odd number of code regions, at least one image region descriptor
is overwritten with uninitialized memory which has caused crashes
in the right conditions.

This failure cases is documented extensively in the following bugzilla:
https://bugzilla.tianocore.org/show_bug.cgi?id=4492

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: cf78580a34d4794346ab08e0365e74a6f3fc29ca
      
https://github.com/tianocore/edk2/commit/cf78580a34d4794346ab08e0365e74a6f3fc29ca
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c

  Log Message:
  -----------
  MdeModulePkg: Add NULL checks and Return Status to ImagePropertiesRecordLib

Update function headers to clarify the contract of each function and
improve readability. Add NULL checks to all functions that take a
pointer as an argument. Add return status to functions that
may need to return early due to invalid input.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: 960c7b25c202690d970ba9b2c473def18957e11b
      
https://github.com/tianocore/edk2/commit/960c7b25c202690d970ba9b2c473def18957e11b
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c

  Log Message:
  -----------
  UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero

PiSmmCore fetches the EFI memory map and calls SplitTable() to
split each loaded image section into its own descriptor with
EFI_MEMORY_XP marking data sections and EFI_MEMORY_RO marking
code sections.

The SMM MAT logic is almost identical to the DXE MAT logic but goes
a step further and also updates the memory map descriptors which describe
image code and data sections to be of type EfiRuntimeServicesCode and
EfiRuntimeServicesData respectively. The consolidated MAT logic
(present in the new ImagePropertiesRecordLib) more closely follows
the DXE MAT logic which identifies image code sections by the presence
of the attribute EFI_MEMORY_RO in the descriptor and image data
sections by the presence of the attribute EFI_MEMORY_XP. Because of
the flow choice of the consolidated MAT logic, the SMM MAT logic should
just use the attributes from the table returned by SplitTable().

Additionally, the function EnforceMemoryMapAttribute() in the SMM MAT
logic will ensure that the CODE and DATA memory types have the desired
attributes so bisecting this patch series at this commit will still
function as before.

Cc: Eric Dong <[email protected]>
Cc: Ray Ni <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>


  Commit: aa77dac3fb2c2861ee841809075b615359bf6352
      
https://github.com/tianocore/edk2/commit/aa77dac3fb2c2861ee841809075b615359bf6352
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
    M MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
    M MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c

  Log Message:
  -----------
  MdeModulePkg: Transition SMM MAT Logic to Use ImagePropertiesRecordLib

Now that the bugs are fixed in the MAT logic, we can remove the
duplicate logic from PiSmmCore/MemoryAttributesTable.c and use
ImagePropertiesRecordLib instead.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Cc: Ray Ni <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: 3565ee6c29ffcb2d4d500e857bc3501b5247aeee
      
https://github.com/tianocore/edk2/commit/3565ee6c29ffcb2d4d500e857bc3501b5247aeee
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
    M MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
    M MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf

  Log Message:
  -----------
  MdeModulePkg: Add Logic to Create/Delete Image Properties Records

Add logic to create and delete image properties records. Where
applicable, redirect existing code to use the new library.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Cc: Ray Ni <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


  Commit: 4ec2fab279fc69d15f69ee8fd8ce52045f788102
      
https://github.com/tianocore/edk2/commit/4ec2fab279fc69d15f69ee8fd8ce52045f788102
  Author: Taylor Beebe <[email protected]>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
    M MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
    M MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
    M MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
    M MdeModulePkg/Test/MdeModulePkgHostTest.dsc

  Log Message:
  -----------
  MdeModulePkg: Update DumpImageRecord() in ImagePropertiesRecordLib

Update DumpImageRecord() to be DumpImageRecords(), and improve
the debug output. The function will output at DEBUG_INFO instead,
and the function will be run in DXE and SMM
MAT logic when the MAT is installed at EndOfDxe on DEBUG builds.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Cc: Ray Ni <[email protected]>
Signed-off-by: Taylor Beebe <[email protected]>
Reviewed-by: Liming Gao <[email protected]>


Compare: https://github.com/tianocore/edk2/compare/33e31c289cc7...4ec2fab279fc


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to