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 70DF97803CC for ; Mon, 9 Oct 2023 00:08:02 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=R9jnS0uTA2xl+fmjhBtQvHyfLGBmX4qOC686Z9I9m3o=; 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=1696810081; v=1; b=f8ERuYHBE5Af7vuMqT71ZeJqj/zv+TFtXSJAeeeYvUe8MSiTJP/w6p55WkHLykOpQqUbEnI/ EuYTbtg9/l4FQr7AY9I9CutUlts0sNR0rwdNXb3etk9demnPB0vxj4DYBIKYLCgLUX2+CEm/w9l IOzngRe9Lp6r0A/IUgTHM3Ko= X-Received: by 127.0.0.2 with SMTP id oNZsYY7687511xcSorKMdWbj; Sun, 08 Oct 2023 17:08:01 -0700 X-Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by mx.groups.io with SMTP id smtpd.web11.50033.1696810078394531929 for ; Sun, 08 Oct 2023 17:07:58 -0700 X-Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-578b4981526so2485595a12.0 for ; Sun, 08 Oct 2023 17:07:58 -0700 (PDT) X-Gm-Message-State: o1qXSKOArbAHiESroseoh8Grx7686176AA= X-Google-Smtp-Source: AGHT+IHZjfd/nNsL/fnanmNd9SzFEIhDq9DJfj49e+iygX0omgBG9JOcnXxsF8u6tvDn4HfDyFvxXg== X-Received: by 2002:a05:6a21:788d:b0:16b:79c2:877f with SMTP id bf13-20020a056a21788d00b0016b79c2877fmr6544209pzc.53.1696810077666; Sun, 08 Oct 2023 17:07:57 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id t20-20020a62ea14000000b0068fcc7f6b00sm5048320pfh.74.2023.10.08.17.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 17:07:57 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v5 05/28] MdeModulePkg: Copy PEI PCD Database Into New Buffer Date: Sun, 8 Oct 2023 17:07:17 -0700 Message-ID: <20231009000742.1792-6-taylor.d.beebe@gmail.com> In-Reply-To: <20231009000742.1792-1-taylor.d.beebe@gmail.com> References: <20231009000742.1792-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=f8ERuYHB; 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 (#109410): https://edk2.groups.io/g/devel/message/109410 Mute This Topic: https://groups.io/mt/101843346/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-