From nobody Mon Apr 29 01:10:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+78768+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78768+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1628213597; cv=none; d=zohomail.com; s=zohoarc; b=NkRJoBS8yYaZfkDYcKcSgY7XVvSJ9GW0p7py9FlgdZdRPVL4PF7zjsQxtzW4HL7srmTCYlwM/zN3Odg7o4F2YqUhzHGrijBWj9nrkdqro91/aXKxcbCzcTbHbKst5VCQVz4ezG9wRVdZco/3Stu/wZIRrVnUk4OZ0UblGmwbx3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628213597; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=hkEsIo0FwVkA3RDy9Ei/Ex7iX5WLweR2PuIahNIptWM=; b=T11vEKdMhvx8Q7pV6BA1GPG4GaYE7qqKqgJXBVaSkI+owDw0sq3+boPBeI9MtNbhutvMFiJ7HBLMbPGPTnU5uMdTALVhlo+0/RO+z1N56NWsSv2UuFf7Lux3C2SszbS1oSZ8eaXGsYnnAPkRMQlHNt6oMy458yXBAB6JkKn5o7w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78768+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1628213597370708.7888197706518; Thu, 5 Aug 2021 18:33:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id X0E7YY1788612xJmUlrcbZd2; Thu, 05 Aug 2021 18:33:17 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web08.2467.1628213596020746364 for ; Thu, 05 Aug 2021 18:33:16 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 8527820B36ED; Thu, 5 Aug 2021 18:33:15 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8527820B36ED From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg/TestPointCheckLib: Fix MessageLength cast issue Date: Thu, 5 Aug 2021 21:32:46 -0400 Message-Id: <20210806013250.2928-2-mikuback@linux.microsoft.com> In-Reply-To: <20210806013250.2928-1-mikuback@linux.microsoft.com> References: <20210806013250.2928-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,mikuback@linux.microsoft.com X-Gm-Message-State: Uw3Uc1AK6W2fAq2SWMSLL4YNx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1628213597; bh=Wi4EQNFf+SzlKnGVUkvLpgPV4SDMMd8OmXwkL+6/Fo4=; h=Cc:Date:From:Reply-To:Subject:To; b=mzZpZxDApcNQy5vimrUJGVUgtyO957vUODj+Qz2npj3Zda+OF5s0bdK2g0iQ+F7jrSB m3Bh9jY40g0yztsFaXTzgMgp8sUoVC3JoMUJmLKDN1Bzf18YYHJBqL29NjzGZpEA/oyPD bS431ODVzKx+gyQJRksO7Pzf2qxjYUBnzjk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1628213598241100005 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3531 The MessageLength field of EFI_MM_COMMUNICATE_HEADER as defined in MdePkg/Include/Protocol/MmCommunication.h was updated to a fixed size as opposed to UINTN to avoid ambiguity between different caller enviornments. This change updates the MessageLength usage in MinPlatformPkg to support the new field structure, in turn, fixing a build issue. Original edk2 change: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3398 Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki Reviewed-by: Nate DeSimone --- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckSmiHa= ndlerInstrument.c | 4 ++-- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointC= heckLib.c | 15 ++++++++++++++- Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.c = | 10 +++++----- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointC= heckLib.inf | 1 + 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckSmiHandlerInstrument.c b/Platform/Intel/MinPlatformPkg/Test/Library/= TestPointCheckLib/DxeCheckSmiHandlerInstrument.c index 3ceeb821fb95..80e8d26f4e1d 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= SmiHandlerInstrument.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= SmiHandlerInstrument.c @@ -106,7 +106,7 @@ GetSmiHandlerProfileDatabase( CommGetInfo->Header.ReturnStatus =3D (UINT64)-1; CommGetInfo->DataSize =3D 0; =20 - CommSize =3D sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader->MessageLengt= h; + CommSize =3D OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + (UINTN)CommH= eader->MessageLength; Status =3D SmmCommunication->Communicate(SmmCommunication, CommBuffer, &= CommSize); if (EFI_ERROR(Status)) { DEBUG ((DEBUG_INFO, "SmiHandlerProfile: SmmCommunication - %r\n", Stat= us)); @@ -139,7 +139,7 @@ GetSmiHandlerProfileDatabase( CommGetData->Header.DataLength =3D sizeof(*CommGetData); CommGetData->Header.ReturnStatus =3D (UINT64)-1; =20 - CommSize =3D sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader->MessageLengt= h; + CommSize =3D OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + (UINTN)CommH= eader->MessageLength; Buffer =3D (UINT8 *)CommHeader + CommSize; Size -=3D CommSize; =20 diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeTestPointCheckLib.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPoin= tCheckLib/DxeTestPointCheckLib.c index c012e0afcbaa..e5efbd059954 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestP= ointCheckLib.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestP= ointCheckLib.c @@ -12,6 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -520,6 +521,7 @@ TestPointDxeSmmReadyToBootSmmPageProtection ( UINTN MemoryAttributesTabl= eSize; EFI_STATUS Status; UINTN CommSize; + UINT64 LongCommSize; UINT8 *CommBuffer; EFI_SMM_COMMUNICATE_HEADER *CommHeader; EFI_SMM_COMMUNICATION_PROTOCOL *SmmCommunication; @@ -620,7 +622,18 @@ TestPointDxeSmmReadyToBootSmmPageProtection ( (UINTN)CommData->UefiMemoryAttributeTableSize ); =20 - CommSize =3D OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data) + CommHeader->M= essageLength; + Status =3D SafeUint64Add (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data), = CommHeader->MessageLength, &LongCommSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "TestPointDxeSmmReadyToBootSmmPageProtection: Long= CommSize calculation - %r\n", Status)); + return EFI_SUCCESS; + } + + Status =3D SafeUint64ToUintn (LongCommSize, &CommSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "TestPointDxeSmmReadyToBootSmmPageProtection: Comm= Size conversion - %r\n", Status)); + return EFI_SUCCESS; + } + Status =3D SmmCommunication->Communicate(SmmCommunication, CommBuffer, &= CommSize); if (EFI_ERROR(Status)) { DEBUG ((DEBUG_INFO, "TestPointDxeSmmReadyToBootSmmPageProtection: SmmC= ommunication - %r\n", Status)); diff --git a/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointS= tubDxe.c b/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStu= bDxe.c index 3cc5ccfef6f4..8416b36f56ae 100644 --- a/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.c +++ b/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.c @@ -122,7 +122,7 @@ GetTestPointDataSmm ( CommGetInfo->Header.ReturnStatus =3D (UINT64)-1; CommGetInfo->DataSize =3D 0; =20 - CommSize =3D sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader->MessageLengt= h; + CommSize =3D OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + (UINTN)CommH= eader->MessageLength; Status =3D SmmCommunication->Communicate(SmmCommunication, CommBuffer, &= CommSize); if (EFI_ERROR(Status)) { DEBUG ((DEBUG_INFO, "SmiHandlerTestPoint: SmmCommunication - %r\n", St= atus)); @@ -155,7 +155,7 @@ GetTestPointDataSmm ( CommGetData->Header.DataLength =3D sizeof(*CommGetData); CommGetData->Header.ReturnStatus =3D (UINT64)-1; =20 - CommSize =3D sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader->MessageLengt= h; + CommSize =3D OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + (UINTN)CommH= eader->MessageLength; Buffer =3D (UINT8 *)CommHeader + CommSize; Size -=3D CommSize; =20 @@ -233,7 +233,7 @@ PublishSmmTestPoint ( TestPoint =3D mSmmTestPointDatabase; while ((UINTN)TestPoint < (UINTN)mSmmTestPointDatabase + mSmmTestPointDa= tabaseSize) { TestPointSize =3D GetTestPointInfoSize (TestPoint, (UINTN)mSmmTestPoin= tDatabase + mSmmTestPointDatabaseSize - (UINTN)TestPoint); - =20 + TestPointLibSetTable (TestPoint, TestPointSize); =20 TestPoint =3D (ADAPTER_INFO_PLATFORM_TEST_POINT *)((UINTN)TestPoint + = TestPointSize); @@ -286,7 +286,7 @@ OnReadyToBoot ( EFI_EVENT ReadyToBootLaterEvent; =20 gBS->CloseEvent (Event); - =20 + Status =3D gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, @@ -295,7 +295,7 @@ OnReadyToBoot ( &ReadyToBootLaterEvent ); ASSERT_EFI_ERROR (Status); - =20 + gBS->SignalEvent (ReadyToBootLaterEvent); } =20 diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeTestPointCheckLib.inf b/Platform/Intel/MinPlatformPkg/Test/Library/TestPo= intCheckLib/DxeTestPointCheckLib.inf index 2ae1db4ee483..54b4015d6767 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestP= ointCheckLib.inf +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestP= ointCheckLib.inf @@ -32,6 +32,7 @@ [LibraryClasses] TestPointLib PciSegmentLib PciSegmentInfoLib + SafeIntLib =20 [Packages] MinPlatformPkg/MinPlatformPkg.dec --=20 2.28.0.windows.1 -=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 (#78768): https://edk2.groups.io/g/devel/message/78768 Mute This Topic: https://groups.io/mt/84699698/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Apr 29 01:10:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+78769+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78769+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1628213600; cv=none; d=zohomail.com; s=zohoarc; b=iEqxW8hEaqpW3NjUm8dvS0WV8h15NJ+e2NJnYj7L8PRM89bYk1ldGuT5D7oKStnvjIcJFg/pZj+tZUtzWDaCITE/31HuY7QGIMa85EMNjJTcY0izCXeu2sL4y+60bC3jd4Vg2fYlJzAE2llVWfsSUSKtFut5BXU7ZZ7lvlhCmH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628213600; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=3B4j2ts2B2dMOAkaVP8CzjEq5RC8DSGaqRX5ydV3Rl0=; b=ZIKmHUgOa585gdWCC6ZiSBHgA9fQSyBNdyIeHvJw3dMWyxAmzfcnL8vmo9XvM6UwpBgWmGQjgJyHx1s42SNxK8DmP0rfT4EtxVQ7ochWRaNGZh1JwqjMCbu7R0w+uGpNuzbfdXoUGQrOc7pKnKOV7+v7VXjPUtpJof4Wmc+5xo0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78769+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1628213600033753.7736546332835; Thu, 5 Aug 2021 18:33:20 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7CQuYY1788612x9qSooh3ClZ; Thu, 05 Aug 2021 18:33:19 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.2462.1628213599172978967 for ; Thu, 05 Aug 2021 18:33:19 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id D53CF20B36EA; Thu, 5 Aug 2021 18:33:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D53CF20B36EA From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 2/5] MinPlatformPkg/TestPointCheckLib: Set required size field in protocol Date: Thu, 5 Aug 2021 21:32:47 -0400 Message-Id: <20210806013250.2928-3-mikuback@linux.microsoft.com> In-Reply-To: <20210806013250.2928-1-mikuback@linux.microsoft.com> References: <20210806013250.2928-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,mikuback@linux.microsoft.com X-Gm-Message-State: vDQg4thBKUEL0eDsK9fh58uEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1628213599; bh=8j8W/XgM1KvQ8g7W1YFIRwuqi3G43NxdeT4dj+wbuCM=; h=Cc:Date:From:Reply-To:Subject:To; b=CIE9dYN3Q1dJndFRWcPyyNZv8CmX7jBaU3HdbG++grIIGH6XZ66xoQubTUMaCE2ogMd Nm7B4REsLSAdX/bcbe0NF/yPiROFMj0L2KWo759CRxcBWtFra2ysnXPrMBslJKInoQo+J MglgSazUKpWDP3916XWHVNczPn/H3VdkXGo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1628213600399100001 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3518 Per the protocol definition, the caller must allocate the input structure and set the size field. TestPointCheckTcgTrustedBoot() does not do this which can result in an EFI_BUFFER_TOO_SMALL error. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki Reviewed-by: Nate DeSimone --- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckTcgTr= ustedBoot.c | 3 +++ Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointC= heckLib.inf | 1 + 2 files changed, 4 insertions(+) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckTcgTrustedBoot.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPo= intCheckLib/DxeCheckTcgTrustedBoot.c index 2a04f86fedac..5ec32fd2e875 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= TcgTrustedBoot.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= TcgTrustedBoot.c @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -41,6 +42,8 @@ TestPointCheckTcgTrustedBoot ( goto Done; } =20 + ZeroMem ((VOID *) &ProtocolCapability, sizeof (ProtocolCapability)); + ProtocolCapability.Size =3D (UINT8) sizeof (ProtocolCapability); Status =3D Tcg2->GetCapability (Tcg2, &ProtocolCapability); if (EFI_ERROR(Status)) { DEBUG ((DEBUG_ERROR, "Tcg2->GetCapability - %r\n", Status)); diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeTestPointCheckLib.inf b/Platform/Intel/MinPlatformPkg/Test/Library/TestPo= intCheckLib/DxeTestPointCheckLib.inf index 54b4015d6767..195729e0ff5b 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestP= ointCheckLib.inf +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestP= ointCheckLib.inf @@ -18,6 +18,7 @@ [Defines] =20 [LibraryClasses] BaseLib + BaseMemoryLib DebugLib DxeServicesTableLib UefiBootServicesTableLib --=20 2.28.0.windows.1 -=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 (#78769): https://edk2.groups.io/g/devel/message/78769 Mute This Topic: https://groups.io/mt/84699699/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Apr 29 01:10:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+78770+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78770+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1628213603; cv=none; d=zohomail.com; s=zohoarc; b=Wirb0RD1eFOtxyyzJVlRnK3hIoxu3sZpydeBc/kYmAREHtTCKZF/zYIZYQRksiz5y83L26RQapnkOnvqTuOMaSDPhPktGYEZaoSDl4q9f0PIP3AqOiF/cd/fW/wvVRs9CwShrOYHQ73x3X+NDE6iRkru+9Sq7BiZ9KjVfQEq5kA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628213603; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=DmulP/19ncUNOTjqkyr8mASMk9hIbQg7IUNNwzL8NUI=; b=nr17Rki39WdmlSB8DYdUtACD2XQZsu9fQmLq6srEKKubHc3QHoLZkpiuFuDwEVcMjzzDng/gl02USpSK23Uh4jNanmTZRVdFV+0FpUZ5jOXSXpCrvYF4E1qwRv4urndkBkUHJyC3sE9PPf3HUxpil+zatiCZVJ6EjqrszMZp6kM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78770+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1628213603381825.1913072263512; Thu, 5 Aug 2021 18:33:23 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bFSZYY1788612xfqBSIf2Z84; Thu, 05 Aug 2021 18:33:23 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.2463.1628213602408030380 for ; Thu, 05 Aug 2021 18:33:22 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 077A320B36EA; Thu, 5 Aug 2021 18:33:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 077A320B36EA From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 3/5] MinPlatformPkg/TestPointCheckLib: Fix incorrect array index Date: Thu, 5 Aug 2021 21:32:48 -0400 Message-Id: <20210806013250.2928-4-mikuback@linux.microsoft.com> In-Reply-To: <20210806013250.2928-1-mikuback@linux.microsoft.com> References: <20210806013250.2928-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,mikuback@linux.microsoft.com X-Gm-Message-State: TEGJOxHhIjHQh4NpQPMZXedax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1628213603; bh=dh+0O94DLs0mKaQJ1vTBlkBOWnuqHr+wKL53iuT6je4=; h=Cc:Date:From:Reply-To:Subject:To; b=FZaoBiXUL90K+9wxb6IpWKgTSbWG9i7vjuo0CYMfJwLDf4UQspBnVgEDR1xg5BieF4b +MRixJuGHHQYDtP9tJOwUYAHBumbyLn0jvpRlDMCWloLry5IzCu25OffasU1+zPWU1yGL PoDIedKnk9Wz1Tf+gZvcz2SoizLwnkqnVEc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1628213604600100001 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3520 TestPointSmmEndOfDxeSmrrFunctional() uses the incorrect byte index to skip the test. It should use byte 6 instead of byte 5. Also defines a macro "TEST_POINT_INDEX_BYTE6_SMM" for the byte index 6 value. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki Reviewed-by: Nate DeSimone --- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointC= heckLib.c | 26 +++++++++++--------- Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h = | 1 + 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/S= mmTestPointCheckLib.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPoin= tCheckLib/SmmTestPointCheckLib.c index 4b4f874c7bbc..75200969d3e7 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestP= ointCheckLib.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestP= ointCheckLib.c @@ -109,7 +109,7 @@ TestPointSmmEndOfDxeSmrrFunctional ( EFI_STATUS Status; BOOLEAN Result; =20 - if ((mFeatureImplemented[5] & TEST_POINT_BYTE6_SMM_END_OF_DXE_SMRR_FUNCT= IONAL) =3D=3D 0) { + if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] & TEST_POINT_BYTE6_= SMM_END_OF_DXE_SMRR_FUNCTIONAL) =3D=3D 0) { return EFI_SUCCESS; } =20 @@ -125,7 +125,7 @@ TestPointSmmEndOfDxeSmrrFunctional ( TestPointLibSetFeaturesVerified ( PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, NULL, - 5, + TEST_POINT_INDEX_BYTE6_SMM, TEST_POINT_BYTE6_SMM_END_OF_DXE_SMRR_FUNCTIONAL ); } @@ -156,7 +156,8 @@ TestPointSmmReadyToLockSmmMemoryAttributeTableFunctiona= l ( EFI_STATUS Status; BOOLEAN Result; =20 - if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEM= ORY_ATTRIBUTE_TABLE_FUNCTIONAL) =3D=3D 0) { + if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] & + TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEMORY_ATTRIBUTE_TABLE_FUNCTION= AL) =3D=3D 0) { return EFI_SUCCESS; } =20 @@ -173,7 +174,7 @@ TestPointSmmReadyToLockSmmMemoryAttributeTableFunctiona= l ( TestPointLibSetFeaturesVerified ( PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, NULL, - 6, + TEST_POINT_INDEX_BYTE6_SMM, TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEMORY_ATTRIBUTE_TABLE_FUNCTI= ONAL ); } @@ -202,7 +203,8 @@ TestPointSmmReadyToLockSecureSmmCommunicationBuffer ( EFI_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable; UINTN MemoryAttributesTableSize; =20 - if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_= SMM_COMMUNICATION_BUFFER) =3D=3D 0) { + if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] & + TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER) = =3D=3D 0) { return EFI_SUCCESS; } =20 @@ -248,7 +250,8 @@ TestPointSmmReadyToBootSmmPageProtection ( EFI_STATUS Status; BOOLEAN Result; =20 - if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAG= E_LEVEL_PROTECTION) =3D=3D 0) { + if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] + & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) =3D=3D= 0) { return EFI_SUCCESS; } =20 @@ -264,7 +267,7 @@ TestPointSmmReadyToBootSmmPageProtection ( TestPointLibSetFeaturesVerified ( PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, NULL, - 6, + TEST_POINT_INDEX_BYTE6_SMM, TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION ); } @@ -280,7 +283,7 @@ TestPointSmmReadyToBootSmmPageProtection ( TestPointLibSetFeaturesVerified ( PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, NULL, - 6, + TEST_POINT_INDEX_BYTE6_SMM, TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER ); } @@ -312,7 +315,8 @@ TestPointSmmReadyToBootSmmPageProtectionHandler ( TEST_POINT_SMM_COMMUNICATION_UEFI_GCD_MAP_INFO *CommData; UINTN TempCommBufferSize; =20 - if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAG= E_LEVEL_PROTECTION) =3D=3D 0) { + if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] + & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) =3D=3D= 0) { return EFI_SUCCESS; } =20 @@ -390,14 +394,14 @@ TestPointSmmReadyToBootSmmPageProtectionHandler ( TestPointLibSetFeaturesVerified ( PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, NULL, - 6, + TEST_POINT_INDEX_BYTE6_SMM, TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER ); } else { TestPointLibClearFeaturesVerified ( PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, NULL, - 6, + TEST_POINT_INDEX_BYTE6_SMM, TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER ); } diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLi= b.h b/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h index 7265e2268961..73c30522179c 100644 --- a/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h +++ b/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h @@ -738,6 +738,7 @@ TestPointSmmExitBootServices ( #define TEST_POINT_SMM_READY_TO_BOOT = L" - SMM Ready To Boot - " #define TEST_POINT_SMM_EXIT_BOOT_SERVICES = L" - SMM Exit Boot Services - " =20 +#define TEST_POINT_INDEX_BYTE6_SMM = 6 #define TEST_POINT_BYTE6_SMM_END_OF_DXE_SMRR_FUNCTIONAL = BIT0 #define TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEMORY_ATTRIBUTE_TABLE_FUNC= TIONAL BIT1 #define TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER= BIT2 --=20 2.28.0.windows.1 -=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 (#78770): https://edk2.groups.io/g/devel/message/78770 Mute This Topic: https://groups.io/mt/84699700/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Apr 29 01:10:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+78771+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78771+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1628213606; cv=none; d=zohomail.com; s=zohoarc; b=GZKAzq28hEss3cNEeDpSapHKf7sZppEapC1ka2If3QOYiQVnhL0LKm60LdYeI89khyGTpLXz4VVI3HC10dWMoCVmYeftMElCHJ8R7G90J+ox+Ri87w3huZRjeIY/qDvPJ2K5FrfMHODJB027gjesmx5v0X1CbyJBhqd60Nj7/h0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628213606; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=uql/IE7uI8eVr+eqNgPMG2iNojo81jcUchi0Jb2bdEM=; b=XWfHw2XvohCgDZ+ApVPyCZGICutJEm2UQ3h2YsZ/dlspZbDguYm66d3cPQLL9hjIhqTZyRhJQlMB6++l39cYo7oJarCNy3+3UswYH0yVs0PnQhxgan2ecG2942vqCIfPHU9VEh6Wejasjw8Rm27zG4XS2/1L/gojPAX9vORQ5KU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78771+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1628213606456309.15671692898854; Thu, 5 Aug 2021 18:33:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id c5wnYY1788612xE0zncJNnRA; Thu, 05 Aug 2021 18:33:26 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.2503.1628213605432307357 for ; Thu, 05 Aug 2021 18:33:25 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 015AE20B36ED; Thu, 5 Aug 2021 18:33:24 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 015AE20B36ED From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 4/5] MinPlatformPkg/TestPointCheckLib: Improve adjacent region checking Date: Thu, 5 Aug 2021 21:32:49 -0400 Message-Id: <20210806013250.2928-5-mikuback@linux.microsoft.com> In-Reply-To: <20210806013250.2928-1-mikuback@linux.microsoft.com> References: <20210806013250.2928-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,mikuback@linux.microsoft.com X-Gm-Message-State: ho0EcvMmMdKZ3GYlDXfJp8adx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1628213606; bh=kMs0YdthmXuPMUBWouRJZRyGcWRWnf95U+zPuWl8yl8=; h=Cc:Date:From:Reply-To:Subject:To; b=ECGRWm8ccnFJthROPH06kXm1xhScfzHzdH1lFuGozIQ2M3vT0Lui7nowRBZLR//8iH5 v/u8FImxhL3vT/zLhrpF0J9agt/3S0kd9GNpUN/uTVvMOgPhb43hviTNweQJs6a89NTkn NmMskT0E7gm2iOP+zXWBPMZFVXvgrUXHVZU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1628213606741100006 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3521 The current logic depends on a particular order in which the descriptors for three or more regions are placed in the array to perform proper adjacency checking. When three or more regions are all adjacent, but neighboring descriptors are not adjacent, the logic can improperly report a failure. Adjust the logic so that all descriptors are checked for adjacency. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki Reviewed-by: Nate DeSimone --- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckSmmIn= fo.c | 56 ++++++++++---------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckSmmInfo.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointChec= kLib/DxeCheckSmmInfo.c index c493750a27e6..f15f76eab574 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= SmmInfo.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= SmmInfo.c @@ -59,34 +59,36 @@ CheckSmramDescriptor ( ) { UINTN Index; - UINT64 Base; + UINTN Index2; UINT64 Length; + BOOLEAN AdjacentRegion; =20 - Base =3D 0; Length =3D 0; for (Index =3D 0; Index < NumberOfSmmReservedRegions; Index++) { - if (Base =3D=3D 0) { - Base =3D Descriptor[Index].PhysicalStart; - Length =3D Descriptor[Index].PhysicalSize; + AdjacentRegion =3D FALSE; + for (Index2 =3D 0; Index2 < NumberOfSmmReservedRegions; Index2++) { + if ((NumberOfSmmReservedRegions =3D=3D 1) + || (Descriptor[Index].PhysicalStart + Descriptor[Index].Physical= Size =3D=3D Descriptor[Index2].PhysicalStart) + || (Descriptor[Index2].PhysicalStart + Descriptor[Index2].Physic= alSize =3D=3D Descriptor[Index].PhysicalStart)) { + AdjacentRegion =3D TRUE; + break; + } + } + + if (AdjacentRegion =3D=3D TRUE) { + Length +=3D Descriptor[Index].PhysicalSize; } else { - if (Base + Length =3D=3D Descriptor[Index].PhysicalStart) { - Length =3D Length + Descriptor[Index].PhysicalSize; - } else if (Descriptor[Index].PhysicalStart + Descriptor[Index].Physi= calSize =3D=3D Base) { - Base =3D Descriptor[Index].PhysicalStart; - Length =3D Length + Descriptor[Index].PhysicalSize; - } else { - DEBUG ((DEBUG_ERROR, "Smram is not adjacent\n")); - TestPointLibAppendErrorString ( - PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, - NULL, - TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERROR_CODE \ - TEST_POINT_DXE_SMM_READY_TO_LOCK=20 - TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERROR_STR= ING - ); - return EFI_INVALID_PARAMETER; - } + DEBUG ((DEBUG_ERROR, "Smram is not adjacent\n")); + TestPointLibAppendErrorString ( + PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, + NULL, + TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERROR_CODE \ + TEST_POINT_DXE_SMM_READY_TO_LOCK + TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERROR_STRING + ); + return EFI_INVALID_PARAMETER; } - } =20 + } =20 if (Length !=3D GetPowerOfTwo64 (Length)) { DEBUG ((DEBUG_ERROR, "Smram is not aligned\n")); @@ -94,7 +96,7 @@ CheckSmramDescriptor ( PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV, NULL, TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERROR_CODE \ - TEST_POINT_DXE_SMM_READY_TO_LOCK=20 + TEST_POINT_DXE_SMM_READY_TO_LOCK TEST_POINT_BYTE7_DXE_SMM_READY_TO_LOCK_SMRAM_ALIGNED_ERROR_STRING ); return EFI_INVALID_PARAMETER; @@ -111,14 +113,14 @@ TestPointCheckSmmInfo ( EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; UINTN Size; EFI_SMRAM_DESCRIPTOR *SmramRanges; - =20 + DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckSmmInfo - Enter\n")); - =20 + Status =3D gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID= **)&SmmAccess); if (EFI_ERROR (Status)) { goto Done ; } - =20 + Size =3D 0; Status =3D SmmAccess->GetCapabilities (SmmAccess, &Size, NULL); ASSERT (Status =3D=3D EFI_BUFFER_TOO_SMALL); @@ -128,7 +130,7 @@ TestPointCheckSmmInfo ( =20 Status =3D SmmAccess->GetCapabilities (SmmAccess, &Size, SmramRanges); ASSERT_EFI_ERROR (Status); - =20 + DEBUG ((DEBUG_INFO, "SMRAM Info\n")); DumpSmramDescriptor (Size / sizeof (EFI_SMRAM_DESCRIPTOR), SmramRanges); =20 --=20 2.28.0.windows.1 -=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 (#78771): https://edk2.groups.io/g/devel/message/78771 Mute This Topic: https://groups.io/mt/84699703/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Apr 29 01:10:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+78772+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78772+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1628213609; cv=none; d=zohomail.com; s=zohoarc; b=QtgoGlJNDoStdPjn58OPmztJjXZuqmoUtHYH+1NAwSb3HojHRad8IFsZxvHYQiWjEcCKhrSAy+fQsOfahJLdVMIuBcYT0fD9A2RBaZhxt7bZhesxLLMZCmJ9sT1PPjA0fytJDnf2zaHVCGoqc/kPQeG891bSJqXBI7W/Dk+0PU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628213609; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=+e3E8sMPOejVArLrj2HARQWXn8who5qmhmfNCzElyNo=; b=ncZ9rk5hvbAC/xDmy6k8NswnuJ/r4cD0Q9uN9yRtAO0BRJt2EoOBRIh2n2E14QdYv0Kk2ryUBInFQuFyPXCc22lugdvCPpUTdmPDYGO6EmA9/o1T5TmyxcZtLEZcRMGqJYU96SAF8Mbc4a1mkHp3GfJGTFP3U0rtL0JlEraMCIk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78772+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1628213609052578.8931210119906; Thu, 5 Aug 2021 18:33:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id dMiJYY1788612xmqMF4PI9ua; Thu, 05 Aug 2021 18:33:28 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.2465.1628213608185789789 for ; Thu, 05 Aug 2021 18:33:28 -0700 X-Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id DB66520B36EA; Thu, 5 Aug 2021 18:33:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DB66520B36EA From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v2 5/5] MinPlatformPkg/TestPointCheckLib: Make OutTable parameter optional Date: Thu, 5 Aug 2021 21:32:50 -0400 Message-Id: <20210806013250.2928-6-mikuback@linux.microsoft.com> In-Reply-To: <20210806013250.2928-1-mikuback@linux.microsoft.com> References: <20210806013250.2928-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,mikuback@linux.microsoft.com X-Gm-Message-State: Li9WIGsOagRRg6TGNJF8hW36x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1628213608; bh=O7Lt/A7HaZVPZbKNIaYg/EOwLR53+ScbquiNZ0JlvQY=; h=Cc:Date:From:Reply-To:Subject:To; b=pXq4S4GifhL6q7z4pJWKR3Lemz5OvfgiL63DMZnz1W+FodlH+yp3G+2Pj8KphvaBd5e HH+19YpTGdQGv/B0WrNClF8YlFJ8P08XXIH/zCPVwieynepNjWRU1TVJW6KoiiEJ+9Ugz Jymb+SKZdwLHypnwCCpj3o3XUCyfduJwHPI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1628213611206100003 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki Makes the OutTable parameter in DumpAcpiRsdt() and DumpAcpiXsdt() optional since the pointer passed can be NULL if the Signature pointer is also NULL. Can fix a potential failure in TestPointCheckAcpi(). Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki Reviewed-by: Nate DeSimone --- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcpi.= c | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckAcpi.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLi= b/DxeCheckAcpi.c index cd8f538f7f3f..3d75e5012a4c 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= Acpi.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= Acpi.c @@ -477,7 +477,7 @@ DumpAcpiTable ( ) { EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; - =20 + if (Table =3D=3D NULL) { return ; } @@ -535,7 +535,7 @@ CheckAcpiTableResource ( ) { EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; - =20 + if (Table =3D=3D NULL) { return EFI_INVALID_PARAMETER; } @@ -592,7 +592,7 @@ EFI_STATUS DumpAcpiRsdt ( IN EFI_ACPI_DESCRIPTION_HEADER *Rsdt, IN UINT32 *Signature, OPTIONAL - OUT VOID **OutTable, + OUT VOID **OutTable, OPTIONAL IN BOOLEAN DumpPrint, IN BOOLEAN CheckResource ) @@ -610,7 +610,7 @@ DumpAcpiRsdt ( =20 if (OutTable !=3D NULL) { *OutTable =3D NULL; - } else { + } else if ((OutTable =3D=3D NULL) && (Signature !=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 @@ -632,7 +632,7 @@ DumpAcpiRsdt ( *OutTable =3D Table; } } - =20 + if (OutTable !=3D NULL) { if (*OutTable =3D=3D NULL) { return EFI_NOT_FOUND; @@ -646,7 +646,7 @@ EFI_STATUS DumpAcpiXsdt ( IN EFI_ACPI_DESCRIPTION_HEADER *Xsdt, IN UINT32 *Signature, OPTIONAL - OUT VOID **OutTable, + OUT VOID **OutTable, OPTIONAL IN BOOLEAN DumpPrint, IN BOOLEAN CheckResource ) @@ -662,16 +662,16 @@ DumpAcpiXsdt ( if (Xsdt =3D=3D NULL) { return EFI_INVALID_PARAMETER; } - =20 + if (OutTable !=3D NULL) { *OutTable =3D NULL; - } else { + } else if ((OutTable =3D=3D NULL) && (Signature !=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 ReturnStatus =3D EFI_SUCCESS; EntryCount =3D (Xsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / s= izeof(UINT64); - =20 + BasePtr =3D (UINTN)(Xsdt + 1); for (Index =3D 0; Index < EntryCount; Index ++) { CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), sizeof= (UINT64)); @@ -783,7 +783,7 @@ TestPointCheckAcpi ( if (Status =3D=3D EFI_NOT_FOUND) { Status =3D DumpAcpiWithGuid (&gEfiAcpi10TableGuid, NULL, NULL, TRUE, F= ALSE); } - =20 + if (EFI_ERROR(Status)) { DEBUG ((DEBUG_ERROR, "No ACPI table\n")); TestPointLibAppendErrorString ( @@ -796,7 +796,7 @@ TestPointCheckAcpi ( } =20 DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckAcpi - Exit\n")); - =20 + return Status; } =20 @@ -806,9 +806,9 @@ TestPointCheckAcpiGcdResource ( ) { EFI_STATUS Status; - =20 + DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckAcpiGcdResource - Enter\= n")); - =20 + // // Check the ACPI existence // @@ -816,7 +816,7 @@ TestPointCheckAcpiGcdResource ( if (Status =3D=3D EFI_NOT_FOUND) { Status =3D DumpAcpiWithGuid (&gEfiAcpi10TableGuid, NULL, NULL, FALSE, = FALSE); } - =20 + if (!EFI_ERROR(Status)) { // // Then check resource in ACPI and GCD @@ -828,7 +828,7 @@ TestPointCheckAcpiGcdResource ( Status =3D DumpAcpiWithGuid (&gEfiAcpi10TableGuid, NULL, NULL, FALSE= , TRUE); } } - =20 + if (EFI_ERROR(Status)) { DEBUG ((DEBUG_ERROR, "ACPI table resource not in GCD\n")); TestPointLibAppendErrorString ( @@ -840,7 +840,7 @@ TestPointCheckAcpiGcdResource ( ); } DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckAcpiGcdResource - Exit\n= ")); - =20 + return Status; } =20 --=20 2.28.0.windows.1 -=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 (#78772): https://edk2.groups.io/g/devel/message/78772 Mute This Topic: https://groups.io/mt/84699704/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-