From nobody Sun May 5 17:56:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528092616401795.2021925959172; Sun, 3 Jun 2018 23:10:16 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 25FFE21BADAB6; Sun, 3 Jun 2018 23:10:14 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7505220968917 for ; Sun, 3 Jun 2018 23:10:13 -0700 (PDT) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2018 23:10:13 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.4]) by orsmga006.jf.intel.com with ESMTP; 03 Jun 2018 23:10:12 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,475,1520924400"; d="scan'208";a="47057490" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 4 Jun 2018 14:10:22 +0800 Message-Id: <20180604061024.18468-2-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 In-Reply-To: <20180604061024.18468-1-ruiyu.ni@intel.com> References: <20180604061024.18468-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v2 1/3] MdePkg/UefiRuntimeLib: Do not allow to be linked by DXE driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Star Zeng , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When UefiRuntimeLib links to a DXE driver, its constructor still registers a Virtual Address Change event. The event callback will get called when RT.SetVirtualAddressMap() is called from OS. But when the driver is a DXE driver, the memory occupied by the callback function might be zeroed or used by OS since the BS type memory is free memory when entering to RT phase. The patch reverts commit 97511979b4fdd84cf7cd51e43c22dc03e79bd4f3 "MdePkg/UefiRuntimeLib: Support more module types." It makes sure that DXE driver cannot link to this library. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Liming Gao Cc: Star Zeng Reviewed-by: Star Zeng --- MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf b/MdePkg/Libr= ary/UefiRuntimeLib/UefiRuntimeLib.inf index d053da545a..8f46495fc5 100644 --- a/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf +++ b/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf @@ -5,7 +5,7 @@ # EVT_SIGNAL_EXIT_BOOT_SERVICES event, to provide runtime services. # This instance also supports SAL drivers for better performance. # -# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -24,7 +24,7 @@ [Defines] FILE_GUID =3D b1ee6c28-54aa-4d17-b705-3e28ccb27b2e MODULE_TYPE =3D DXE_RUNTIME_DRIVER VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D UefiRuntimeLib|DXE_RUNTIME_DRIVER DXE= _SAL_DRIVER DXE_CORE DXE_DRIVER DXE_SMM_DRIVER=20 + LIBRARY_CLASS =3D UefiRuntimeLib|DXE_RUNTIME_DRIVER DXE= _SAL_DRIVER =20 CONSTRUCTOR =3D RuntimeDriverLibConstruct DESTRUCTOR =3D RuntimeDriverLibDeconstruct --=20 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 17:56:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528092619124202.48055524421068; Sun, 3 Jun 2018 23:10:19 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 53F8920972130; Sun, 3 Jun 2018 23:10:16 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D9A4F2097212B for ; Sun, 3 Jun 2018 23:10:14 -0700 (PDT) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2018 23:10:14 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.4]) by orsmga006.jf.intel.com with ESMTP; 03 Jun 2018 23:10:13 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,475,1520924400"; d="scan'208";a="47057498" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 4 Jun 2018 14:10:23 +0800 Message-Id: <20180604061024.18468-3-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 In-Reply-To: <20180604061024.18468-1-ruiyu.ni@intel.com> References: <20180604061024.18468-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v2 2/3] MdeModulePkg/DxeResetSystemLib: Avoid depending on UefiRuntimeLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Current DxeResetSystemLib depends on UefiRuntimeLib because it calls EfiResetSystem() API exposed by UefiRuntimeLib. Due to the commit: "MdePkg/UefiRuntimeLib: Do not allow to be linked by DXE driver" which reverts UefiRuntimeLib to only support DXE_RUNTIME_DRIVER, removing UefiRuntimeLib dependency makes the DxeResetSystemLib can be used by DXE drivers. The patch also disallows the DxeResetSystemLib to be linked by runtime driver, SMM drivers. Runtime driver cannot link to this library because the gRT is not converted when entering to RT. SMM driver cannot link to this library because calling RT services from SMM after EndOfDxe violates security guideline. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng Cc: Liming Gao Reviewed-by: Star Zeng --- MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c | 10 +++++---= -- MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.inf | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c b/M= deModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c index ea452e3231..76bca223ae 100644 --- a/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c +++ b/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.c @@ -14,7 +14,7 @@ =20 #include #include -#include +#include =20 /** This function causes a system-wide reset (cold reset), in which @@ -30,7 +30,7 @@ ResetCold ( VOID ) { - EfiResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); } =20 /** @@ -45,7 +45,7 @@ ResetWarm ( VOID ) { - EfiResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL); + gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL); } =20 /** @@ -60,7 +60,7 @@ ResetShutdown ( VOID ) { - EfiResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL); + gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL); } =20 /** @@ -94,5 +94,5 @@ ResetPlatformSpecific ( IN VOID *ResetData ) { - EfiResetSystem (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, ResetDa= ta); + gRT->ResetSystem (EfiResetPlatformSpecific, EFI_SUCCESS, DataSize, Reset= Data); } diff --git a/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.inf b= /MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.inf index 6eb2766b93..5cd52d8859 100644 --- a/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.inf +++ b/MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.inf @@ -19,7 +19,7 @@ [Defines] FILE_GUID =3D C2BDE4F6-65EE-440B-87B5-83ABF10EF45B MODULE_TYPE =3D DXE_DRIVER VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D ResetSystemLib|DXE_CORE DXE_DRIVER DX= E_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER + LIBRARY_CLASS =3D ResetSystemLib|DXE_CORE DXE_DRIVER UE= FI_APPLICATION UEFI_DRIVER =20 # # The following information is for reference only and not required by the = build tools. @@ -35,5 +35,4 @@ [Packages] MdeModulePkg/MdeModulePkg.dec =20 [LibraryClasses] - UefiRuntimeLib - + UefiRuntimeServicesTableLib --=20 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 17:56:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528092622070336.47176701340857; Sun, 3 Jun 2018 23:10:22 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7E5CC20972134; Sun, 3 Jun 2018 23:10:17 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E45212097212B for ; Sun, 3 Jun 2018 23:10:15 -0700 (PDT) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2018 23:10:15 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.4]) by orsmga006.jf.intel.com with ESMTP; 03 Jun 2018 23:10:14 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,475,1520924400"; d="scan'208";a="47057504" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 4 Jun 2018 14:10:24 +0800 Message-Id: <20180604061024.18468-4-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 In-Reply-To: <20180604061024.18468-1-ruiyu.ni@intel.com> References: <20180604061024.18468-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v2 3/3] MdeModulePkg: Make sure ResetSystemRuntimeDxe uses ResetSystemLibNull X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Because the DxeResetSystemLib calls gRT->ResetSystem(), make sure the gRT->ResetSystem() implementation doesn't call into DxeResetSystemLib to avoid chicken-egg issue. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng Cc: Liming Gao Reviewed-by: Star Zeng --- MdeModulePkg/MdeModulePkg.dsc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index ec24a50c7d..734c5e5ab7 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -363,7 +363,10 @@ [Components] ResetSystemLib|MdeModulePkg/Library/BaseResetSystemLibNull/BaseReset= SystemLibNull.inf } - MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf { + + ResetSystemLib|MdeModulePkg/Library/BaseResetSystemLibNull/BaseReset= SystemLibNull.inf + } MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf =20 --=20 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel