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 35B44740035 for ; Wed, 20 Sep 2023 00:58:18 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=AkAVNkBrCuLgj3UwwcjpVC0tGc7w5i1m26RMnQCM0XI=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1695171496; v=1; b=AO4piS5y8hJosBn0cnphLbl/Fwutns/TeOtWsjXPbJ094ZDh7dlDeOV8etxgBGLkofuF4/Wi KHg7kR1Pdzdc90zsO/1d0kIFrWlnfyfO4uYIBydOmolcix2P63spEg7stexnoQSqYzxhKnCpt73 Ypxv8exU06srFkVD93ithhuw= X-Received: by 127.0.0.2 with SMTP id mXFeYY7687511xtBGy72RoCm; Tue, 19 Sep 2023 17:58:16 -0700 X-Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mx.groups.io with SMTP id smtpd.web10.26778.1695171488202460673 for ; Tue, 19 Sep 2023 17:58:08 -0700 X-Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1c453379020so27759025ad.1 for ; Tue, 19 Sep 2023 17:58:08 -0700 (PDT) X-Gm-Message-State: a6oS4OEzhCVo20hrzhtuMwQwx7686176AA= X-Google-Smtp-Source: AGHT+IGzP5Qy55J8OH5LipncvLQddN6te4OGxipZ3AdklX97rziDR6ze6rMtZlOQ0ylli38+EWPYpQ== X-Received: by 2002:a17:902:f551:b0:1c3:f023:9823 with SMTP id h17-20020a170902f55100b001c3f0239823mr1106857plf.6.1695171487514; Tue, 19 Sep 2023 17:58:07 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id 13-20020a170902c24d00b001bb988ac243sm10563576plg.297.2023.09.19.17.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 17:58:07 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v4 05/28] MdeModulePkg: Copy PEI PCD Database Into New Buffer Date: Tue, 19 Sep 2023 17:57:28 -0700 Message-ID: <20230920005752.2041-6-taylor.d.beebe@gmail.com> In-Reply-To: <20230920005752.2041-1-taylor.d.beebe@gmail.com> References: <20230920005752.2041-1-taylor.d.beebe@gmail.com> MIME-Version: 1.0 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,taylor.d.beebe@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=AO4piS5y; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (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 HOB memory should not be written to in DXE phase. This patch copies the PCD database from PEI into a new buffer so updates to dynamic PCDs don't write to HOB memory. Signed-off-by: Taylor Beebe Cc: Jian J Wang Cc: Liming Gao Cc: Dandan Bi --- MdeModulePkg/Universal/PCD/Dxe/Service.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c index 1ae06a639c43..0feb11142545 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Service.c +++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c @@ -885,15 +885,17 @@ BuildPcdDxeDataBase ( // be NULL. If it is NULL, we just copy over the DXE Default // Value to PCD Database. // - PeiDatabase = (PEI_PCD_DATABASE *)GET_GUID_HOB_DATA (GuidHob); + PeiDatabase = AllocateCopyPool ((UINTN)GET_GUID_HOB_DATA_SIZE (GuidHob), GET_GUID_HOB_DATA (GuidHob)); + ASSERT (PeiDatabase != NULL); // // Get next one that stores full PEI data // GuidHob = GetNextGuidHob (&gPcdDataBaseHobGuid, GET_NEXT_HOB (GuidHob)); if (GuidHob != NULL) { - mPeiPcdDbBinary = (PEI_PCD_DATABASE *)GET_GUID_HOB_DATA (GuidHob); mPeiPcdDbSize = (UINTN)GET_GUID_HOB_DATA_SIZE (GuidHob); + mPeiPcdDbBinary = (PEI_PCD_DATABASE *)AllocateCopyPool (mPeiPcdDbSize, GET_GUID_HOB_DATA (GuidHob)); + ASSERT (mPeiPcdDbBinary != NULL); } // -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108867): https://edk2.groups.io/g/devel/message/108867 Mute This Topic: https://groups.io/mt/101469942/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-