From nobody Tue May 7 19:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47444+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47444+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1568775981; cv=none; d=zoho.com; s=zohoarc; b=k6/TMJZ9nIjW8adMqvc3RMeqxjekGBGdC54gyR4t+Yjbdi5SlzgVDnXb5KlwDfr8rrPZLUXbMd8tLeWmvpB/8ubG/Bmu/Y8xRV5hZjzJTUHLaM/COvYRwb8UloaHktI8CjjjSvAWGSTTjKNeIe92dquNINfc5MqIh6LBQ6XpEck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568775981; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=XzozcuB94Bv9iUZBEi2dbOwBJDe8Kl5LH/edaIlzD7E=; b=kg2QPGWUxlMs2h7JazxmgAbg0x7/YNxt0doG88vlPdu0XqHnatK1SLit/tgobIN2rdN8QtpQiGnNp8Uw8XS0rkVjl6D20t6X0utHB0Zexy8bUymgtPI/hfOV4b9078VglRY+WwB65O0aEd/+VWApXSWym7dXDX6JaxRxyiTdZvo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47444+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568775981421548.7393648968063; Tue, 17 Sep 2019 20:06:21 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id QmM3YY1788612xLUs6EhpEVL; Tue, 17 Sep 2019 20:06:20 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by groups.io with SMTP; Tue, 17 Sep 2019 20:06:20 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 20:06:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,519,1559545200"; d="scan'208";a="338192248" X-Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.147]) by orsmga004.jf.intel.com with ESMTP; 17 Sep 2019 20:06:15 -0700 From: "Dandan Bi" To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Laszlo Ersek Subject: [edk2-devel] [patch v2 1/5] EmbeddedPkg: Unload image on EFI_SECURITY_VIOLATION Date: Wed, 18 Sep 2019 11:05:53 +0800 Message-Id: <20190918030557.55256-2-dandan.bi@intel.com> In-Reply-To: <20190918030557.55256-1-dandan.bi@intel.com> References: <20190918030557.55256-1-dandan.bi@intel.com> Precedence: Bulk List-Unsubscribe: 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,dandan.bi@intel.com X-Gm-Message-State: bwz3OXGvFtw8QcmmvW5oXkxix1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568775980; bh=FR1KTKb6NZyQcINCOeJXFHtsUHpnzy/Xs3/ALHrqM8g=; h=Cc:Date:From:Reply-To:Subject:To; b=j1IDjhWO+jtpJCE41kJjY1e7Fe6vgklyAOFO0uRMOokMnZolq3Kx3XZ+p2imGrwUkrK BrRW6WA78RgO064gNLJL4eGjP1TCQcbKAtIXYhT+k0HTQbpW/KgO3Tv24A8hU9OLw2k+r 116me1KbTue32E6Nffhp/5JABq9tcW2fAXo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now. This follows UEFI Spec. But if the caller of LoadImage() doesn't have the option to defer the execution of an image, we can not treat EFI_SECURITY_VIOLATION like any other LoadImage() error, we should unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly for the callers in EmbeddedPkg which don't have the policy to defer the execution of the image. Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Laszlo Ersek REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1992 Signed-off-by: Dandan Bi Acked-by: Ard Biesheuvel Acked-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daude --- .../AndroidFastboot/Arm/BootAndroidBootImg.c | 9 +++++++++ .../Library/AndroidBootImgLib/AndroidBootImgLib.c | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg= .c b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c index 591afbe7cc..fe05878b4b 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c +++ b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c @@ -71,10 +71,19 @@ StartEfiApplication ( =20 // Load the image from the device path with Boot Services function Status =3D gBS->LoadImage (TRUE, ParentImageHandle, DevicePath, NULL, 0, &ImageHandle); if (EFI_ERROR (Status)) { + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an Ima= geHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be st= arted right now. + // If the caller doesn't have the option to defer the execution of an = image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (ImageHandle); + } return Status; } =20 // Passed LoadOptions to the EFI Application if (LoadOptionsSize !=3D 0) { diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c b/Em= beddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c index d9e7aa7d2b..e1036954ee 100644 --- a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c +++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c @@ -439,10 +439,22 @@ AndroidBootImgBoot ( + KernelSize; =20 Status =3D gBS->LoadImage (TRUE, gImageHandle, (EFI_DEVICE_PATH *)&KernelDevicePath, (VOID*)(UINTN)Kernel, KernelSize, &ImageHandle); + if (EFI_ERROR (Status)) { + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an Ima= geHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be st= arted right now. + // If the caller doesn't have the option to defer the execution of an = image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (ImageHandle); + } + return Status; + } =20 // Set kernel arguments Status =3D gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGui= d, (VOID **) &ImageInfo); ImageInfo->LoadOptions =3D NewKernelArg; --=20 2.18.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 (#47444): https://edk2.groups.io/g/devel/message/47444 Mute This Topic: https://groups.io/mt/34184004/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 Tue May 7 19:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47445+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47445+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1568775986; cv=none; d=zoho.com; s=zohoarc; b=NVXgPQJgWQnywlmW8Jp0qqCj57C/X45/f3H5bd4Y/OaxWvaA9gMq3sfk4Q/R4JDWy9ww8Ar8nJbcuzzPhhfH9/F/UsKqVpnrpn1a+5XTESqqI5L6sKDS5jB9pvDRXhrLa8eamyLuNKCYf+BfPQ8uWKkBf98KPDT8f+ZxoyjOeqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568775986; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=j9AqGeSNyNHJq5vsUQ80PW29CojaXXqX+juQjhbJ294=; b=EemhD6zjK2wYivDfba47QK+a8/s/uncq9y+BQK/ors9ws0YWgyKiilijgUnfrkHHgSqiHvR5MAwVtOBo4cxXdrL8WD29hHjAlqQKtONcr8ZGBeg65NtXTToVULS0wy60wdqvr5x71wG5ohoHL1xBZeQTWE+oojH1uSKNsC2C5gA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47445+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568775986776575.918917956718; Tue, 17 Sep 2019 20:06:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id cOZ1YY1788612xE7eqc1RUr7; Tue, 17 Sep 2019 20:06:26 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Tue, 17 Sep 2019 20:06:26 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 20:06:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,519,1559545200"; d="scan'208";a="338192295" X-Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.147]) by orsmga004.jf.intel.com with ESMTP; 17 Sep 2019 20:06:24 -0700 From: "Dandan Bi" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao , Laszlo Ersek Subject: [edk2-devel] [patch v2 2/5] MdeModulePkg/DxeCapsuleLibFmp: Unload image on EFI_SECURITY_VIOLATION Date: Wed, 18 Sep 2019 11:05:54 +0800 Message-Id: <20190918030557.55256-3-dandan.bi@intel.com> In-Reply-To: <20190918030557.55256-1-dandan.bi@intel.com> References: <20190918030557.55256-1-dandan.bi@intel.com> Precedence: Bulk List-Unsubscribe: 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,dandan.bi@intel.com X-Gm-Message-State: YTtDvN17cZT5UaKdsSqygv5ex1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568775986; bh=YqbNPJEcAe/U3wyXRcgoh7FCP+LPVidU9wIemjfT2NM=; h=Cc:Date:From:Reply-To:Subject:To; b=tkcP6VDdQwiHlanDXks73HiSsSobgZcVH99+XekyGLjC++vZXiWKex3YZTQJ/E+jo7/ GifQdOYOVv95ze+KsdEc00LHAN6VOVi5yZh03mx6BALA4dVF1+0FKGjI49nlZMnzypVBe 6vZGj3OtmxgfXlW+vdSRObD2NI46CAEIygw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now. This follows UEFI Spec. But if the caller of LoadImage() doesn't have the option to defer the execution of an image, we can not treat EFI_SECURITY_VIOLATION like any other LoadImage() error, we should unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly for the callers in DxeCapsuleLibFmp which don't have the policy to defer the execution of the image. Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Cc: Laszlo Ersek REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1992 Signed-off-by: Dandan Bi Reviewed-by: Hao A Wu Reviewed-by: Philippe Mathieu-Daude --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeMod= ulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index 95aa9de087..5dda561a04 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -1028,10 +1028,19 @@ StartFmpImage ( ImageSize, &ImageHandle ); DEBUG((DEBUG_INFO, "FmpCapsule: LoadImage - %r\n", Status)); if (EFI_ERROR(Status)) { + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an Ima= geHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be st= arted right now. + // If the caller doesn't have the option to defer the execution of an = image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (ImageHandle); + } FreePool(DriverDevicePath); return Status; } =20 DEBUG((DEBUG_INFO, "FmpCapsule: StartImage ...\n")); --=20 2.18.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 (#47445): https://edk2.groups.io/g/devel/message/47445 Mute This Topic: https://groups.io/mt/34184007/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 Tue May 7 19:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47446+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47446+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1568775990; cv=none; d=zoho.com; s=zohoarc; b=CrWlUCFvYiOr3j1/bb3m7tDIhDC6lCjM5Veb0vKKjSosf0rr9d0uXQTBY+S/+yFzwD6f1WlTstM1p/iyD2LNkw8XoH5dtM8S6PEepbgPuzQrEHuO5/ZtbfENgcpV551LtOTyvKZtmEPbWR/iPLvEz/gyldItY5rSiJ+qAAyS0o8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568775990; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=KT0erPSoUez+dSMkTkvOhtRLFyGfrUTsmeF+wWqzpQ0=; b=gT026sfZmH/xb62Q3mgBrR6NznPV0x3DRNu5cRlVax2/ORthzknfohfTz/ak2cUkD+xhTAQowoio6ZRWPjLS1DRyHcYS38rPlWjZD+K0QzUnmDAja10QgIP6QTYe/3q+JGDga4Z51Dk5D3qZl1umtgZzpoD61DwyN9h9nxE544E= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47446+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568775990588446.7999757851501; Tue, 17 Sep 2019 20:06:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id AkjFYY1788612xcXeavz2QM7; Tue, 17 Sep 2019 20:06:29 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by groups.io with SMTP; Tue, 17 Sep 2019 20:06:29 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 20:06:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,519,1559545200"; d="scan'208";a="338192308" X-Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.147]) by orsmga004.jf.intel.com with ESMTP; 17 Sep 2019 20:06:27 -0700 From: "Dandan Bi" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Ray Ni , Zhichao Gao , Liming Gao , Laszlo Ersek Subject: [edk2-devel] [patch v2 3/5] MdeModulePkg/UefiBootManager: Unload image on EFI_SECURITY_VIOLATION Date: Wed, 18 Sep 2019 11:05:55 +0800 Message-Id: <20190918030557.55256-4-dandan.bi@intel.com> In-Reply-To: <20190918030557.55256-1-dandan.bi@intel.com> References: <20190918030557.55256-1-dandan.bi@intel.com> Precedence: Bulk List-Unsubscribe: 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,dandan.bi@intel.com X-Gm-Message-State: HMJzoKHOPTWkqM2cVuNJ3HWRx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568775989; bh=Pt3qHL4oKesE4Y8FkRj8vx3nz5mrv+52tm5F+vnmI10=; h=Cc:Date:From:Reply-To:Subject:To; b=igUhjOt8enhEZkQ+jG1ao+/J9SPwX7Uwkw7x6gHNEJLJlJBAveGj6dTjFs+J8UzC58L GyQGbeHwXQqF5vIH6Kk60OzLcgeKcMwxXR4cgmo/OPC73BZAvo7E7zMZ+1Q8tZHlEyTqO GOXAQxObv/X2E67+mNKVeoY7p3rO4Zm+Vpc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now. This follows UEFI Spec. But if the caller of LoadImage() doesn't have the option to defer the execution of an image, we can not treat EFI_SECURITY_VIOLATION like any other LoadImage() error, we should unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly for the callers in UefiBootManagerLib which don't have the policy to defer the execution of the image. Cc: Jian J Wang Cc: Hao A Wu Cc: Ray Ni Cc: Zhichao Gao Cc: Liming Gao Cc: Laszlo Ersek REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1992 Signed-off-by: Dandan Bi Reviewed-by: Zhichao Gao --- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +++++++++ .../Library/UefiBootManagerLib/BmLoadOption.c | 11 ++++++++++- MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c | 11 ++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePk= g/Library/UefiBootManagerLib/BmBoot.c index 952033fc82..760d7647b8 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -1859,10 +1859,19 @@ EfiBootManagerBoot ( if (FilePath !=3D NULL) { FreePool (FilePath); } =20 if (EFI_ERROR (Status)) { + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an I= mageHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be = started right now. + // If the caller doesn't have the option to defer the execution of a= n image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid resource lea= k. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (ImageHandle); + } // // Report Status Code with the failure status to indicate that the f= ailure to load boot option // BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR, Status= ); BootOption->Status =3D Status; diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c b/MdeMo= dulePkg/Library/UefiBootManagerLib/BmLoadOption.c index 07592f8ebd..af47b787d1 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c @@ -1,9 +1,9 @@ /** @file Load option library functions which relate with creating and processing = load options. =20 -Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 @@ -1409,10 +1409,19 @@ EfiBootManagerProcessLoadOption ( FileSize, &ImageHandle ); FreePool (FileBuffer); =20 + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an Ima= geHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be st= arted right now. + // If the caller doesn't have the option to defer the execution of an = image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (ImageHandle); + } if (!EFI_ERROR (Status)) { Status =3D gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtoco= lGuid, (VOID **)&ImageInfo); ASSERT_EFI_ERROR (Status); =20 ImageInfo->LoadOptionsSize =3D LoadOption->OptionalDataSize; diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c b/MdeModulePk= g/Library/UefiBootManagerLib/BmMisc.c index 6b8fb4d924..833e38c6fe 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c @@ -1,9 +1,9 @@ /** @file Misc library functions. =20 -Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 @@ -491,10 +491,19 @@ EfiBootManagerDispatchDeferredImages ( ImageDevicePath, NULL, 0, &ImageHandle ); + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an I= mageHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be = started right now. + // If the caller doesn't have the option to defer the execution of a= n image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid resource lea= k. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (ImageHandle); + } if (!EFI_ERROR (Status)) { LoadCount++; // // Before calling the image, enable the Watchdog Timer for // a 5 Minute period --=20 2.18.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 (#47446): https://edk2.groups.io/g/devel/message/47446 Mute This Topic: https://groups.io/mt/34184008/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 Tue May 7 19:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47447+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47447+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1568775995; cv=none; d=zoho.com; s=zohoarc; b=PmelmFh9HnlGogkLEu69bHbnIDqhATXN5rW8CbAWxBPXXK1NPnzeisVx3C1/O32N7Ve0J4Em6Yh0NUmYft03UivbqSrKsGn/AJo/jKyx35vQ82Cpd8WIiiiNEoDU3r9Zz0fa4mq1UfhXbP3/8lKHi5edMfuiEoA66pJBKu3hvJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568775995; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=BcPJUFK3Vtqufs4Sk5tVgAgtvyQlCPyECOS2ZjCwRUA=; b=FMjkPtKoOFR8YVINZdavOBM1g+vZKn7Ltd0uNqwy9e6M/d6vVFAnsEFwn/fCGeZim6veS6vaUiVB2MVG/NtXkJKLQ6T5Jyrds31SYCkbbeMxTWqW+M7m8vpyaJHP6u+iGIU6UfRsWPodhBDzk0CPT4qLjWHbIv1o/+6mT4i2MuA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47447+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568775995272278.6337438264504; Tue, 17 Sep 2019 20:06:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6bqUYY1788612xcWdSIu0pTX; Tue, 17 Sep 2019 20:06:34 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by groups.io with SMTP; Tue, 17 Sep 2019 20:06:33 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 20:06:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,519,1559545200"; d="scan'208";a="338192333" X-Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.147]) by orsmga004.jf.intel.com with ESMTP; 17 Sep 2019 20:06:32 -0700 From: "Dandan Bi" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao , Laszlo Ersek Subject: [edk2-devel] [patch v2 4/5] MdeModulePkg/PlatformDriOverride: Unload image on EFI_SECURITY_VIOLATION Date: Wed, 18 Sep 2019 11:05:56 +0800 Message-Id: <20190918030557.55256-5-dandan.bi@intel.com> In-Reply-To: <20190918030557.55256-1-dandan.bi@intel.com> References: <20190918030557.55256-1-dandan.bi@intel.com> Precedence: Bulk List-Unsubscribe: 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,dandan.bi@intel.com X-Gm-Message-State: YY7SDXj5OEmoSfKhiBTFpAWex1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568775994; bh=8x3w/38zZGPp/o9ODooNY5re57DuIUDUGaxUEESB0k8=; h=Cc:Date:From:Reply-To:Subject:To; b=SyanCIC50tCax9zX3xYF6yJ0n7QsbxFBY8keXrOwS2GytZ6L/DFWLUvM3XucSaERLw+ CHyHzMII0irt+qKRmA9IpWuPzNss0e3570sj8t1Y84wAMva8uHRhy8gCekGnsQglX0ugA lij6iT5JWxc9hJz9PbVhMPg+x5JLpt8zufI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now. This follows UEFI Spec. But if the caller of LoadImage() doesn't have the option to defer the execution of an image, we can not treat EFI_SECURITY_VIOLATION like any other LoadImage() error, we should unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly for the caller in PlatformDriOverrideDxe which don't have the policy to defer the execution of the image. Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Cc: Laszlo Ersek REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1992 Signed-off-by: Dandan Bi Reviewed-by: Hao A Wu Reviewed-by: Philippe Mathieu-Daude --- .../PlatformDriOverrideDxe/PlatDriOverrideLib.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideL= ib.c b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c index 2d3736b468..f91f038b7a 100644 --- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c +++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c @@ -1,9 +1,9 @@ /** @file Implementation of the shared functions to do the platform driver vverrid= e mapping. =20 - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include "InternalPlatDriOverrideDxe.h" @@ -1484,10 +1484,19 @@ GetDriverFromMapping ( ); ASSERT (DriverBinding !=3D NULL); DriverImageInfo->ImageHandle =3D ImageHandle; } } else { + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded = and an ImageHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can= not be started right now. + // If the caller doesn't have the option to defer the execut= ion of an image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid reso= urce leak. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (ImageHandle); + } DriverImageInfo->UnLoadable =3D TRUE; DriverImageInfo->ImageHandle =3D NULL; } } } --=20 2.18.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 (#47447): https://edk2.groups.io/g/devel/message/47447 Mute This Topic: https://groups.io/mt/34184009/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 Tue May 7 19:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47448+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47448+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1568775999; cv=none; d=zoho.com; s=zohoarc; b=WtU4F/O8vtfqiQ3VD+A08gT3UU+BOr4j9oJRuR9wEE3GbsZptUp7BYWfvEVPO+FmaioxLZEIn27gPG22lIcp0aTYiCc9hTLYNvgvHknCvXNputHBo08i0hu4hQ4UQBm1iPQ1MpHhErZUSg1RMar3i4Y4dJqPAjimhGmdSnxfHvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568775999; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=cqiBrwW9VqHNHpgUmorvZhC6u3TdcYyfBX/+Ad4eZzg=; b=OBo1PiN/Rf3NucGE6NXNNqc0p3zA1PMyFPbcpp5Asm4eunD+VBcMiglNfFl71csVOVFfpH5LxHVpsXet28sasm7YYFJBsPfldkpIwNAsFcP4iW+XZxDLWxjpn9fb6QCncBQn6p441DBPkRQ6IHQ7cjAj8mhLEdb6gTiqTJxExoQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47448+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1568775999740305.8131878792167; Tue, 17 Sep 2019 20:06:39 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id yQ20YY1788612xUaATBpbwoo; Tue, 17 Sep 2019 20:06:37 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by groups.io with SMTP; Tue, 17 Sep 2019 20:06:37 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 20:06:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,519,1559545200"; d="scan'208";a="338192354" X-Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.147]) by orsmga004.jf.intel.com with ESMTP; 17 Sep 2019 20:06:35 -0700 From: "Dandan Bi" To: devel@edk2.groups.io Cc: Ray Ni , Zhichao Gao , Laszlo Ersek Subject: [edk2-devel] [patch v2 5/5] ShellPkg: Unload image on EFI_SECURITY_VIOLATION Date: Wed, 18 Sep 2019 11:05:57 +0800 Message-Id: <20190918030557.55256-6-dandan.bi@intel.com> In-Reply-To: <20190918030557.55256-1-dandan.bi@intel.com> References: <20190918030557.55256-1-dandan.bi@intel.com> Precedence: Bulk List-Unsubscribe: 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,dandan.bi@intel.com X-Gm-Message-State: vWx9g5wDGuwcswSQUaSKlz2wx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568775997; bh=gcbBijmWCUJJSkAdpvkWmGORz8OJMmVHbgPnvHEvjg8=; h=Cc:Date:From:Reply-To:Subject:To; b=umkjxsDJLwB1gpPgO9l0UGTb5Ydagj3dg6Wotn6qhVfTS4J48fSQ7Ys4RAclQw7TWf2 F4LBhy5z93HFvRZR45kwQ6AqwQOdWtFR/d8ehfbmmLFtI71+jxAF8FqG7P0ubrvUpJqVM K/6nAr6gTxgSDjaLmuXFQij+GkY5rs94Zzw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For the LoadImage() boot service, with EFI_SECURITY_VIOLATION retval, the Image was loaded and an ImageHandle was created with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be started right now. This follows UEFI Spec. But if the caller of LoadImage() doesn't have the option to defer the execution of an image, we can not treat EFI_SECURITY_VIOLATION like any other LoadImage() error, we should unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. This patch is to do error handling for EFI_SECURITY_VIOLATION explicitly for the callers in ShellPkg which don't have the policy to defer the execution of the image. Cc: Ray Ni Cc: Zhichao Gao Cc: Laszlo Ersek REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1992 Signed-off-by: Dandan Bi Reviewed-by: Zhichao Gao Reviewed-by: Philippe Mathieu-Daude --- ShellPkg/Application/Shell/ShellManParser.c | 9 +++++++++ .../Library/UefiShellDebug1CommandsLib/LoadPciRom.c | 11 ++++++++++- ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c | 11 ++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Application/Shell/ShellManParser.c b/ShellPkg/Applica= tion/Shell/ShellManParser.c index 6909f29441..4d5a5668aa 100644 --- a/ShellPkg/Application/Shell/ShellManParser.c +++ b/ShellPkg/Application/Shell/ShellManParser.c @@ -643,10 +643,19 @@ ProcessManFile( goto Done; } DevPath =3D ShellInfoObject.NewEfiShellProtocol->GetDevicePathFromFile= Path(CmdFilePathName); Status =3D gBS->LoadImage(FALSE, gImageHandle, DevPath, NULL, 0, = &CmdFileImgHandle); if(EFI_ERROR(Status)) { + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an I= mageHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be = started right now. + // If the caller doesn't have the option to defer the execution of a= n image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid the resource= leak. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (CmdFileImgHandle); + } *HelpText =3D NULL; goto Done; } Status =3D gBS->OpenProtocol( CmdFileImgHandle, diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c b/She= llPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c index 1b169d0d3c..5b6cba17f3 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/LoadPciRom.c @@ -1,10 +1,10 @@ /** @file Main file for LoadPciRom shell Debug1 function. =20 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include "UefiShellDebug1CommandsLib.h" @@ -332,10 +332,19 @@ LoadEfiDriversFromRomImage ( ImageBuffer, ImageLength, &ImageHandle ); if (EFI_ERROR (Status)) { + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded an= d an ImageHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can n= ot be started right now. + // If the caller doesn't have the option to defer the executio= n of an image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid resour= ce leak. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (ImageHandle); + } ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_LOA= D_FAIL), gShellDebug1HiiHandle, L"loadpcirom", FileName, ImageIndex); // PrintToken (STRING_TOKEN (STR_LOADPCIROM_LOAD_IMAGE_ERROR), = HiiHandle, ImageIndex, Status); } else { Status =3D gBS->StartImage (ImageHandle, NULL, NULL); if (EFI_ERROR (Status)) { diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c b/ShellPkg/= Library/UefiShellLevel2CommandsLib/Load.c index 6a94b48c86..b6e7c952fa 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c @@ -1,10 +1,10 @@ /** @file Main file for attrib shell level 2 function. =20 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include "UefiShellLevel2CommandsLib.h" @@ -110,10 +110,19 @@ LoadDriver( NULL, 0, &LoadedDriverHandle); =20 if (EFI_ERROR(Status)) { + // + // With EFI_SECURITY_VIOLATION retval, the Image was loaded and an Ima= geHandle was created + // with a valid EFI_LOADED_IMAGE_PROTOCOL, but the image can not be st= arted right now. + // If the caller doesn't have the option to defer the execution of an = image, we should + // unload image for the EFI_SECURITY_VIOLATION to avoid resource leak. + // + if (Status =3D=3D EFI_SECURITY_VIOLATION) { + gBS->UnloadImage (LoadedDriverHandle); + } ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_NOT_IMAGE), gShel= lLevel2HiiHandle, FileName, Status); } else { // // Make sure it is a driver image // --=20 2.18.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 (#47448): https://edk2.groups.io/g/devel/message/47448 Mute This Topic: https://groups.io/mt/34184010/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-