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 71FDDAC1B11 for ; Wed, 30 Aug 2023 23:19:17 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=YTFXjq4VG65Do16hWR7vSYGrH6vTfmCHtGes8W4okaU=; 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=1693437556; v=1; b=KDfev6Rny19Y7X8pl8OXuPJ/n/78/fkkgmwLrodNN25/iH0H4vJN/2eg0e6QYtvIwNtDmF3c GyPQSvfDz5J75NkKAbzl2kRm+edRL4WI/tbo+RyeVGG+wjyABvFkx8VHZXk2OREcOak70CUEx6T OaAjFbY3DmUA4jgm3BYWcXKE= X-Received: by 127.0.0.2 with SMTP id FNaTYY7687511xXNqWQfXtqJ; Wed, 30 Aug 2023 16:19:16 -0700 X-Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mx.groups.io with SMTP id smtpd.web11.4944.1693437547132133643 for ; Wed, 30 Aug 2023 16:19:07 -0700 X-Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-686be3cbea0so976893b3a.0 for ; Wed, 30 Aug 2023 16:19:07 -0700 (PDT) X-Gm-Message-State: QGSkjnJ3S0jkhPt7eHytVtHzx7686176AA= X-Google-Smtp-Source: AGHT+IHQjgW+ErqFT63U8gp7q8EMK+4vM+YehDjpNPr/zgOioX+py5t5xf4ENqSQa+mbPXSp/ja6Tg== X-Received: by 2002:a05:6a20:3d8b:b0:149:729c:d065 with SMTP id s11-20020a056a203d8b00b00149729cd065mr1453895pzi.14.1693437546390; Wed, 30 Aug 2023 16:19:06 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id x16-20020a62fb10000000b0064398fe3451sm102550pfm.217.2023.08.30.16.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 16:19:06 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v3 05/26] MdeModulePkg: Copy PEI PCD Database Into New Buffer Date: Wed, 30 Aug 2023 16:18:13 -0700 Message-ID: <20230830231851.779-6-taylor.d.beebe@gmail.com> In-Reply-To: <20230830231851.779-1-taylor.d.beebe@gmail.com> References: <20230830231851.779-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=KDfev6Rn; 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.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108159): https://edk2.groups.io/g/devel/message/108159 Mute This Topic: https://groups.io/mt/101064077/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-