BuildHobFromBl() creates the gUniversalPayloadSmbiosTableGuid HOB before it calls ParseSmbiosTable(). A bootloader that supplies no SMBIOS entry point makes ParseSmbiosTable() return NOT_FOUND and leaves SmBiosEntryPoint uninitialised, because BuildGuidHob() does not zero its allocation. SmbiosDxe dereferences that value later with no NULL guard and faults, so the payload does not come up at all on such a bootloader.
Parse first and build the HOB only on success, matching the pattern we already use for the graphics and firmware info HOBs. That way we never publish an SMBIOS HOB without a valid entry point, and we side-step the missing NULL check in SmbiosDxe without touching MdeModulePkg. Also drop the ASSERT (FALSE) in SblParseLib's ParseSmbiosTable(). A bootloader without an SMBIOS entry point is a supported condition now and the caller handles NOT_FOUND, so the assert only produces a spurious failure on DEBUG builds. CbParseLib's implementation already returns NOT_FOUND without asserting. Cc: Benjamin Doron <[email protected]> Cc: Gua Guo <[email protected]> Cc: Guo Dong <[email protected]> Cc: James Lu <[email protected]> Cc: Sean Rhodes <[email protected]> Cc: Shuo Liu <[email protected]> Assisted-by: claude-opus-5 Signed-off-by: Alexander Graf <[email protected]> --- UefiPayloadPkg/Library/SblParseLib/SblParseLib.c | 2 +- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c index 7cc615a35e..23a3119b62 100644 --- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c +++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c @@ -129,7 +129,7 @@ ParseSmbiosTable ( TableInfo = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *)GetGuidHobDataFromSbl (&gUniversalPayloadSmbiosTableGuid); if (TableInfo == NULL) { - ASSERT (FALSE); + DEBUG ((DEBUG_INFO, "No SMBIOS table from bootloader\n")); return RETURN_NOT_FOUND; } diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c index 921ce7d716..8a730cce65 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -348,6 +348,7 @@ BuildHobFromBl ( EFI_PEI_GRAPHICS_INFO_HOB *NewGfxInfo; EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo; EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *NewGfxDeviceInfo; + UNIVERSAL_PAYLOAD_SMBIOS_TABLE SmBiosTable; UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmBiosTableHob; UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTableHob; @@ -415,13 +416,14 @@ BuildHobFromBl ( // // Create SmBios table Hob // - SmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE)); - ASSERT (SmBiosTableHob != NULL); - SmBiosTableHob->Header.Revision = UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION; - SmBiosTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE); - DEBUG ((DEBUG_INFO, "Create smbios table gUniversalPayloadSmbiosTableGuid guid hob\n")); - Status = ParseSmbiosTable (SmBiosTableHob); + ZeroMem (&SmBiosTable, sizeof (SmBiosTable)); + Status = ParseSmbiosTable (&SmBiosTable); if (!EFI_ERROR (Status)) { + SmBiosTableHob = BuildGuidHob (&gUniversalPayloadSmbiosTableGuid, sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE)); + ASSERT (SmBiosTableHob != NULL); + SmBiosTableHob->Header.Revision = UNIVERSAL_PAYLOAD_SMBIOS_TABLE_REVISION; + SmBiosTableHob->Header.Length = sizeof (UNIVERSAL_PAYLOAD_SMBIOS_TABLE); + SmBiosTableHob->SmBiosEntryPoint = SmBiosTable.SmBiosEntryPoint; DEBUG ((DEBUG_INFO, "Detected Smbios Table at 0x%lx\n", SmBiosTableHob->SmBiosEntryPoint)); } -- 2.47.3 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#122087): https://edk2.groups.io/g/devel/message/122087 Mute This Topic: https://groups.io/mt/120797198/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
