From nobody Thu Apr 25 07:37:41 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=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1534516544200892.2675894175661; Fri, 17 Aug 2018 07:35:44 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7DB6421959CB2; Fri, 17 Aug 2018 07:35:41 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 B4C34210F30BB for ; Fri, 17 Aug 2018 07:35:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD0FC407604E; Fri, 17 Aug 2018 14:35:38 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-113.rdu2.redhat.com [10.10.120.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 168BC175BB; Fri, 17 Aug 2018 14:35:37 +0000 (UTC) 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=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Fri, 17 Aug 2018 16:35:31 +0200 Message-Id: <20180817143534.28393-2-lersek@redhat.com> In-Reply-To: <20180817143534.28393-1-lersek@redhat.com> References: <20180817143534.28393-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 17 Aug 2018 14:35:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 17 Aug 2018 14:35:38 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 1/4] MdePkg/UefiLib: don't special-case EFI_FILE_MODE_CREATE in OpenMode X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney , Ruiyu Ni , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RDMRC_1 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" While reviewing the patch that would land as 768b611136d0 ("MdePkg/UefiLib: introduce EfiOpenFileByDevicePath()", 2018-08-16), Ray pointed out that distinguishing EFI_FILE_MODE_CREATE was wasteful. Per spec, if the file to create exists, then EFI_FILE_MODE_CREATE is ignored by EFI_FILE_PROTOCOL.Open(), and the existent file is opened. Therefore we don't need an attempt to "open-but-not-create" first, and a fallback to "open-and-create-too" second -- that behavior is internal to EFI_FILE_PROTOCOL.Open(). Remove the special-casing of EFI_FILE_MODE_CREATE. Cc: Liming Gao Cc: Michael D Kinney Cc: Ruiyu Ni Suggested-by: Ruiyu Ni Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1074 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Liming Gao --- Notes: Tested with MdeModulePkg/RamDiskDxe: created a virtual disk from an ISO file, using the HII form; browsed the disk contents from the UEFI shell. MdePkg/Include/Library/UefiLib.h | 19 ++-------- MdePkg/Library/UefiLib/UefiLib.c | 40 +++----------------- 2 files changed, 9 insertions(+), 50 deletions(-) diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/Uefi= Lib.h index f950f1c9c648..f80067f11103 100644 --- a/MdePkg/Include/Library/UefiLib.h +++ b/MdePkg/Include/Library/UefiLib.h @@ -1533,12 +1533,7 @@ EfiLocateProtocolBuffer ( =20 On the remaining device path, the longest initial sequence of FILEPATH_DEVICE_PATH nodes is node-wise traversed with - EFI_FILE_PROTOCOL.Open(). For the pathname fragment specified by each - traversed FILEPATH_DEVICE_PATH node, EfiOpenFileByDevicePath() first mas= ks - EFI_FILE_MODE_CREATE out of OpenMode, and passes 0 for Attributes. If - EFI_FILE_PROTOCOL.Open() fails, and OpenMode includes EFI_FILE_MODE_CREA= TE, - then the operation is retried with the caller's OpenMode and Attributes - unmodified. + EFI_FILE_PROTOCOL.Open(). =20 (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attrib= utes includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a s= ingle @@ -1570,18 +1565,10 @@ EfiLocateProtocolBuffer ( the last node in FilePath. =20 @param[in] OpenMode The OpenMode parameter to pass to - EFI_FILE_PROTOCOL.Open(). For each - FILEPATH_DEVICE_PATH node in FilePath, - EfiOpenFileByDevicePath() first opens the speci= fied - pathname fragment with EFI_FILE_MODE_CREATE mas= ked - out of OpenMode and with Attributes set to 0, a= nd - only retries the operation with EFI_FILE_MODE_C= REATE - unmasked and Attributes propagated if the first= open - attempt fails. + EFI_FILE_PROTOCOL.Open(). =20 @param[in] Attributes The Attributes parameter to pass to - EFI_FILE_PROTOCOL.Open(), when EFI_FILE_MODE_CR= EATE - is propagated unmasked in OpenMode. + EFI_FILE_PROTOCOL.Open(). =20 @retval EFI_SUCCESS The file or directory has been opened or created. diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/Uefi= Lib.c index 7bcac5613768..39d0ce2b21b3 100644 --- a/MdePkg/Library/UefiLib/UefiLib.c +++ b/MdePkg/Library/UefiLib/UefiLib.c @@ -1730,12 +1730,7 @@ EfiLocateProtocolBuffer ( =20 On the remaining device path, the longest initial sequence of FILEPATH_DEVICE_PATH nodes is node-wise traversed with - EFI_FILE_PROTOCOL.Open(). For the pathname fragment specified by each - traversed FILEPATH_DEVICE_PATH node, EfiOpenFileByDevicePath() first mas= ks - EFI_FILE_MODE_CREATE out of OpenMode, and passes 0 for Attributes. If - EFI_FILE_PROTOCOL.Open() fails, and OpenMode includes EFI_FILE_MODE_CREA= TE, - then the operation is retried with the caller's OpenMode and Attributes - unmodified. + EFI_FILE_PROTOCOL.Open(). =20 (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attrib= utes includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a s= ingle @@ -1767,18 +1762,10 @@ EfiLocateProtocolBuffer ( the last node in FilePath. =20 @param[in] OpenMode The OpenMode parameter to pass to - EFI_FILE_PROTOCOL.Open(). For each - FILEPATH_DEVICE_PATH node in FilePath, - EfiOpenFileByDevicePath() first opens the speci= fied - pathname fragment with EFI_FILE_MODE_CREATE mas= ked - out of OpenMode and with Attributes set to 0, a= nd - only retries the operation with EFI_FILE_MODE_C= REATE - unmasked and Attributes propagated if the first= open - attempt fails. + EFI_FILE_PROTOCOL.Open(). =20 @param[in] Attributes The Attributes parameter to pass to - EFI_FILE_PROTOCOL.Open(), when EFI_FILE_MODE_CR= EATE - is propagated unmasked in OpenMode. + EFI_FILE_PROTOCOL.Open(). =20 @retval EFI_SUCCESS The file or directory has been opened or created. @@ -1889,31 +1876,16 @@ EfiOpenFileByDevicePath ( } =20 // - // Open the next pathname fragment with EFI_FILE_MODE_CREATE masked ou= t and - // with Attributes set to 0. + // Open or create the file corresponding to the next pathname fragment. // Status =3D LastFile->Open ( LastFile, &NextFile, PathName, - OpenMode & ~(UINT64)EFI_FILE_MODE_CREATE, - 0 + OpenMode, + Attributes ); =20 - // - // Retry with EFI_FILE_MODE_CREATE and the original Attributes if the = first - // attempt failed, and the caller specified EFI_FILE_MODE_CREATE. - // - if (EFI_ERROR (Status) && (OpenMode & EFI_FILE_MODE_CREATE) !=3D 0) { - Status =3D LastFile->Open ( - LastFile, - &NextFile, - PathName, - OpenMode, - Attributes - ); - } - // // Release any AlignedPathName on both error and success paths; PathNa= me is // no longer needed. --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu Apr 25 07:37:41 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=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1534516547414603.5242421381377; Fri, 17 Aug 2018 07:35:47 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AFC04210F474F; Fri, 17 Aug 2018 07:35:41 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 A818E210F30C8 for ; Fri, 17 Aug 2018 07:35:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E82464059FF7; Fri, 17 Aug 2018 14:35:39 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-113.rdu2.redhat.com [10.10.120.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24B521745B; Fri, 17 Aug 2018 14:35:39 +0000 (UTC) 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=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Fri, 17 Aug 2018 16:35:32 +0200 Message-Id: <20180817143534.28393-3-lersek@redhat.com> In-Reply-To: <20180817143534.28393-1-lersek@redhat.com> References: <20180817143534.28393-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 17 Aug 2018 14:35:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 17 Aug 2018 14:35:39 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 2/4] IntelFrameworkPkg/FrameworkUefiLib: don't special-case EFI_FILE_MODE_CREATE X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney , Ruiyu Ni , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RDMRC_1 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Synchronize EfiOpenFileByDevicePath() with the MdePkg/UefiLib instance, as described in the previous patch. Cc: Liming Gao Cc: Michael D Kinney Cc: Ruiyu Ni Suggested-by: Ruiyu Ni Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1074 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Liming Gao --- Notes: build-tested with: =20 build -a IA32 -a X64 -b NOOPT -t GCC48 \ -p IntelFrameworkPkg/IntelFrameworkPkg.dsc \ -m IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 40 +++-------------= ---- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/IntelFr= ameworkPkg/Library/FrameworkUefiLib/UefiLib.c index b283d775b470..45bf4b17c5c3 100644 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c +++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c @@ -1702,12 +1702,7 @@ EfiLocateProtocolBuffer ( =20 On the remaining device path, the longest initial sequence of FILEPATH_DEVICE_PATH nodes is node-wise traversed with - EFI_FILE_PROTOCOL.Open(). For the pathname fragment specified by each - traversed FILEPATH_DEVICE_PATH node, EfiOpenFileByDevicePath() first mas= ks - EFI_FILE_MODE_CREATE out of OpenMode, and passes 0 for Attributes. If - EFI_FILE_PROTOCOL.Open() fails, and OpenMode includes EFI_FILE_MODE_CREA= TE, - then the operation is retried with the caller's OpenMode and Attributes - unmodified. + EFI_FILE_PROTOCOL.Open(). =20 (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attrib= utes includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a s= ingle @@ -1739,18 +1734,10 @@ EfiLocateProtocolBuffer ( the last node in FilePath. =20 @param[in] OpenMode The OpenMode parameter to pass to - EFI_FILE_PROTOCOL.Open(). For each - FILEPATH_DEVICE_PATH node in FilePath, - EfiOpenFileByDevicePath() first opens the speci= fied - pathname fragment with EFI_FILE_MODE_CREATE mas= ked - out of OpenMode and with Attributes set to 0, a= nd - only retries the operation with EFI_FILE_MODE_C= REATE - unmasked and Attributes propagated if the first= open - attempt fails. + EFI_FILE_PROTOCOL.Open(). =20 @param[in] Attributes The Attributes parameter to pass to - EFI_FILE_PROTOCOL.Open(), when EFI_FILE_MODE_CR= EATE - is propagated unmasked in OpenMode. + EFI_FILE_PROTOCOL.Open(). =20 @retval EFI_SUCCESS The file or directory has been opened or created. @@ -1861,31 +1848,16 @@ EfiOpenFileByDevicePath ( } =20 // - // Open the next pathname fragment with EFI_FILE_MODE_CREATE masked ou= t and - // with Attributes set to 0. + // Open or create the file corresponding to the next pathname fragment. // Status =3D LastFile->Open ( LastFile, &NextFile, PathName, - OpenMode & ~(UINT64)EFI_FILE_MODE_CREATE, - 0 + OpenMode, + Attributes ); =20 - // - // Retry with EFI_FILE_MODE_CREATE and the original Attributes if the = first - // attempt failed, and the caller specified EFI_FILE_MODE_CREATE. - // - if (EFI_ERROR (Status) && (OpenMode & EFI_FILE_MODE_CREATE) !=3D 0) { - Status =3D LastFile->Open ( - LastFile, - &NextFile, - PathName, - OpenMode, - Attributes - ); - } - // // Release any AlignedPathName on both error and success paths; PathNa= me is // no longer needed. --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu Apr 25 07:37:41 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=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 153451655041888.94373497091692; Fri, 17 Aug 2018 07:35:50 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D97F0210F4757; Fri, 17 Aug 2018 07:35:44 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 0EBF3210F474C for ; Fri, 17 Aug 2018 07:35:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51B7C26379; Fri, 17 Aug 2018 14:35:41 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-113.rdu2.redhat.com [10.10.120.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F9401745B; Fri, 17 Aug 2018 14:35:40 +0000 (UTC) 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=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Fri, 17 Aug 2018 16:35:33 +0200 Message-Id: <20180817143534.28393-4-lersek@redhat.com> In-Reply-To: <20180817143534.28393-1-lersek@redhat.com> References: <20180817143534.28393-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 17 Aug 2018 14:35:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 17 Aug 2018 14:35:41 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 3/4] NetworkPkg/TlsAuthConfigDxe: fix TlsCaCertificate attributes retrieval X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Siyuan Fu , Jiaxin Wu , Songpeng Li MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RDMRC_1 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Per spec, the GetVariable() runtime service is not required to populate (*Attributes) on output when it fails with EFI_BUFFER_TOO_SMALL. Therefore we have to fetch the full contents of the TlsCaCertificate variable temporarily, just so we can (a) get the current attributes, and (b) add EFI_VARIABLE_APPEND_WRITE to them for the subsequent SetVariable() call. Cc: Jiaxin Wu Cc: Siyuan Fu Cc: Songpeng Li Reported-by: Songpeng Li Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1090 Fixes: b90c335fbbb674470fbf09601cc522bf61564c30 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- Notes: Tested via loading the same CA cert .pem file twice in a row, using the HII form, first without any pre-existent TlsCaCertificate variable. =20 Songpeng, can you please test this patch as well, and confirm if it works on your end? Thanks! NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c b/NetworkPkg/T= lsAuthConfigDxe/TlsAuthConfigImpl.c index 7259c5e82f61..0780b03bbab4 100644 --- a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c +++ b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.c @@ -663,6 +663,7 @@ EnrollX509toVariable ( EFI_SIGNATURE_LIST *CACert; EFI_SIGNATURE_DATA *CACertData; VOID *Data; + VOID *CurrentData; UINTN DataSize; UINTN SigDataSize; UINT32 Attr; @@ -674,6 +675,7 @@ EnrollX509toVariable ( CACert =3D NULL; CACertData =3D NULL; Data =3D NULL; + CurrentData =3D NULL; Attr =3D 0; =20 Status =3D ReadFileContent ( @@ -716,11 +718,30 @@ EnrollX509toVariable ( Status =3D gRT->GetVariable( VariableName, &gEfiTlsCaCertificateGuid, - &Attr, + NULL, &DataSize, NULL ); if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + // + // Per spec, we have to fetch the variable's contents, even though we'= re + // only interested in the variable's attributes. + // + CurrentData =3D AllocatePool (DataSize); + if (CurrentData =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto ON_EXIT; + } + Status =3D gRT->GetVariable( + VariableName, + &gEfiTlsCaCertificateGuid, + &Attr, + &DataSize, + CurrentData + ); + if (EFI_ERROR (Status)) { + goto ON_EXIT; + } Attr |=3D EFI_VARIABLE_APPEND_WRITE; } else if (Status =3D=3D EFI_NOT_FOUND) { Attr =3D TLS_AUTH_CONFIG_VAR_BASE_ATTR; @@ -751,6 +772,10 @@ ON_EXIT: FreePool (Data); } =20 + if (CurrentData !=3D NULL) { + FreePool (CurrentData); + } + if (X509Data !=3D NULL) { FreePool (X509Data); } --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu Apr 25 07:37:41 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=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1534516554387204.20418496667241; Fri, 17 Aug 2018 07:35:54 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 10A58210F475A; Fri, 17 Aug 2018 07:35:45 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 C734E210F4755 for ; Fri, 17 Aug 2018 07:35:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1BC4540216F1; Fri, 17 Aug 2018 14:35:42 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-113.rdu2.redhat.com [10.10.120.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D32D1745B; Fri, 17 Aug 2018 14:35:41 +0000 (UTC) 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=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Fri, 17 Aug 2018 16:35:34 +0200 Message-Id: <20180817143534.28393-5-lersek@redhat.com> In-Reply-To: <20180817143534.28393-1-lersek@redhat.com> References: <20180817143534.28393-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 17 Aug 2018 14:35:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 17 Aug 2018 14:35:42 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 4/4] UefiCpuPkg/PiSmmCpuDxeSmm: clear exec file mode bits on "PiSmmCpuDxeSmm.c" X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RDMRC_1 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit 241f914975d5 ("UefiCpuPkg/PiSmmCpuDxeSmm: Add support for PCD PcdPteMemoryEncryptionAddressOrMask", 2017-03-01) unintentionally set the executable file mode bits on "PiSmmCpuDxeSmm.c"; clear them now. Cc: Eric Dong Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1092 Fixes: 241f914975d50e34f6da57d1e5ac60eedb5d52de Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c old mode 100755 new mode 100644 --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel