From c466fbc0f08737edc034e55616c1e01210da1f2f Mon Sep 17 00:00:00 2001 From: Alex James Date: Sun, 5 Dec 2021 01:37:11 -0800 Subject: [PATCH 1/2] OcMemoryLib: Avoid rebuilding attributes when MAT is empty (#304) Some firmware implementations may provide an empty Memory Attributes Table (NumberOfEntries is zero). Avoid calling OcUpdateDescriptors in this case, as it will lead to division by zero. This resolves boot failures due to #DE on XPS 15 9560 when Secure Boot is enabled. --- Library/OcMemoryLib/MemoryAttributes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/OcMemoryLib/MemoryAttributes.c b/Library/OcMemoryLib/MemoryAttributes.c index e0f00646..4e2c7f08 100644 --- a/Library/OcMemoryLib/MemoryAttributes.c +++ b/Library/OcMemoryLib/MemoryAttributes.c @@ -438,7 +438,7 @@ OcRebuildAttributes ( UINT32 DescriptorVersion; MemoryAttributesTable = OcGetMemoryAttributes (&MemoryAttributesEntry); - if (MemoryAttributesTable == NULL) { + if (MemoryAttributesTable == NULL || MemoryAttributesTable->NumberOfEntries == 0) { return EFI_UNSUPPORTED; } From 18811afbf540f324ebd9659ddaaf83f8c2d11131 Mon Sep 17 00:00:00 2001 From: Vitaly Cheptsov <4348897+vit9696@users.noreply.github.com> Date: Sun, 5 Dec 2021 12:38:19 +0300 Subject: [PATCH 2/2] Docs: Sync changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 6f273447..67c979eb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -16,6 +16,7 @@ OpenCore Changelog - Added `EnableVmx` quirk to allow virtualization in other OS on some Macs - Upgraded `ProtectUefiServices` to prevent GRUB shim overwriting service pointers when chainloading with Secure Boot enabled - Removed deprecated SSDT-PNLFCFL +- Fixed handling of zero-sized Memory Attributes Table #### v0.7.5 - Revised OpenLinuxBoot documentation