From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.92.22.23]) by mx.groups.io with SMTP id smtpd.web11.4611.1585105453773004142 for ; Tue, 24 Mar 2020 20:04:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=o5qlQQOi; spf=pass (domain: outlook.com, ip: 40.92.22.23, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mr/sZBzBJf7NLUnAM8NyxP/AjBtj1O5Ha6QoG8ZNl5Wz8MT7c7Tlfe2/vlzxr/PcE88dZ+WKg7rb1CAHS86Q7WeJLxl1Trhm0V2+xjA+YYqHbB4Wf+Svj6KRAVzKZVpWXAlfFUOcX0/ITkuAZgmmupiAvaj4NJBMBT9hmaqNFMfGoWFfB4o63bMfEVkTMWn1uzCqWSoCNrt+aHJvlridtYvabqgp8QXEFZWX8/lAKz1y5GGOjxJM87B/1z49jBND7jHCq5Lh2at5Ibq2U2q65CAM+n660qX0s1T8mcz8JiHEVotXKXQOPEwPi/CnoWjhbt5UWL1Dceoe/pivQmwL5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+te/S0AZDlR46DowiE+ToX1rLBFcpNCkPWufJjWhGss=; b=K3M1k5AWQrLDgjoeXFdomuHfD921mtnDXlNYGg1Z4G2uwyZMxL7bHpceKCr+zWb/4/g/aciN8xCeUAujEsoGeb8tlOUJZR7GrZHLKUI4AIYNBe03NLA3U5+ar+s3WCeWcSU8sDQSbaFmcoSItzfZK5a05JFjiAm+cav5gn35GR7iZ5qhpHJFvaP/oEQJPQJheMMO9EdpZXYL7cCfihFSIHDPYlkSJQ0qN3fx+q1NADBwYKIfWurRDSrX3RLth9QLSeLJ57O+0mT87kWz0olvJGH8yp+yWtAZItL1seJwL2vm+aeH3R9qrguOsqvW/xTG7NSemPCFBnkoUnn1oxOXlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+te/S0AZDlR46DowiE+ToX1rLBFcpNCkPWufJjWhGss=; b=o5qlQQOiDiweNn/VecFqeNv4qN2JYOVJBa06MapBXKd1fpwj8iYh7KnLfqtwclDIS7M79XLSgcbrBIKGA3WDBndZuz3grJ2W1PB9bN60OBCtzi/usI55RIz1MfRoiqfJFwbj/wUam1DrRc6LNJD0+0S8Zx2k5jMiacw0UTUAW4D+O3Nw6qCUvJKUjLv/xn7p1n8qI1NeMlgi0QQg42rh2Nyr9ggYpNYrHAPjAov/xgWMKaWo4uufLJmVKYVbimEefQC/7Y8KwPdlrZBE9Y3T7NJg4JM84qkSqckbXpBIHD+gD6FJ8z4Y0ze/OI9m9NpYCFsfijSpXt/i/XLLQeH1NQ== Received: from BN8NAM12FT050.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::39) by BN8NAM12HT200.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::330) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.14; Wed, 25 Mar 2020 03:04:12 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:fc66::39) by BN8NAM12FT050.mail.protection.outlook.com (2a01:111:e400:fc66::143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.14 via Frontend Transport; Wed, 25 Mar 2020 03:04:12 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:069BA6A5D9EE542C7B9A9813E2381652188A470E8B11EC84BA82241E59CFB197;UpperCasedChecksum:ABD3B393157C3633D2584F1BB2D7FBD1A1BA0D0C670CD7D6030E31B6641764F0;SizeAsReceived:9290;Count:50 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::f5a7:e51b:e22a:959f]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::f5a7:e51b:e22a:959f%7]) with mapi id 15.20.2835.023; Wed, 25 Mar 2020 03:04:12 +0000 Subject: Re: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL To: Laszlo Ersek , devel@edk2.groups.io Cc: Bret Barkelew , Liming Gao , Michael D Kinney , Jian J Wang , Hao A Wu References: From: "Michael Kubacki" Message-ID: Date: Tue, 24 Mar 2020 20:04:11 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 In-Reply-To: X-ClientProxiedBy: MWHPR21CA0046.namprd21.prod.outlook.com (2603:10b6:300:129::32) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <149f1a3e-04a2-2377-b3ef-5c836e815b1c@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2001:4898:d8:39:e5c5:958c:b60a:1216] (2001:4898:80e8:b:65e3:958c:b60a:1216) by MWHPR21CA0046.namprd21.prod.outlook.com (2603:10b6:300:129::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.3 via Frontend Transport; Wed, 25 Mar 2020 03:04:11 +0000 X-Microsoft-Original-Message-ID: <149f1a3e-04a2-2377-b3ef-5c836e815b1c@outlook.com> X-TMN: [4u5v4PfnskIukcoZHjyQtBUC+GlMZGi3U+LRBgxnfgXbB62KGxecAz/za4xH7C6d] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 528a8469-2053-4629-c347-08d7d06931a8 X-MS-TrafficTypeDiagnostic: BN8NAM12HT200: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jX9+1l8GQwgoKBfWl6fVgt+DVy1x3kIyk5r0uLdc1p5op2p54Uj2bBxmLSlYmDBrWHev7ToFzDxAulvRse6DTBm2pSVx7rR1OoGYBs0+E4ekkrPFzqqLFSzMrFXAYIYrWByGeSRcd90ZV/XPJGM7qzFwAlJ/wgK+IkXPFjqtJn6/ZPdFtuxLiB3utDAehKXpr494TCm4harUdXlHuaefiZF4vDo5lyr4EikDVcX1ORk= X-MS-Exchange-AntiSpam-MessageData: RdtVj/L1SoMjGuULxx0CnJx2Wtiqc1KdINHdqR1syHqLvhFoO94FHZSU/uuhto1OWRLe5Dr7YiX4oXE6mkB8YXC2DcjH1us3AqSGbLwWLqpw267JPZuuYDUrnxWpVfaUvIbVGEHsLwsxzM7hS6H0y79h1kb+kMjt156k/wGDOmQxnLKBfqrXxLwliEtTnVwB+XjJjP/EiVPOC7pCOsJbvQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 528a8469-2053-4629-c347-08d7d06931a8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2020 03:04:12.0900 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT200 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Laszlo, I sent a v2 patch series with that commit reverted as patch 2/2. Thanks, Michael On 3/24/2020 6:57 PM, Laszlo Ersek wrote: > Hello Michael, > > On 03/24/20 23:04, Michael Kubacki wrote: >> From: Michael Kubacki >> >> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2062 >> >> The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()" >> "Attributes" parameter description states: >> >> "If not NULL, a pointer to the memory location to return the >> attributes bitmask for the variable. See 'Related Definitions.' >> If not NULL, then Attributes is set on output both when >> EFI_SUCCESS and when EFI_BUFFER_TOO_SMALL is returned." >> >> The attributes were previously only returned from the implementation >> in Variable.c on EFI_SUCCESS. They are now returned on EFI_SUCCESS or >> EFI_BUFFER_TOO_SMALL according to spec. >> >> Cc: Bret Barkelew >> Cc: Liming Gao >> Cc: Michael D Kinney >> Cc: Jian J Wang >> Cc: Hao A Wu >> Signed-off-by: Michael Kubacki >> --- >> MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 10 +++++++--- >> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 10 ++++++---- >> 2 files changed, 13 insertions(+), 7 deletions(-) > > per : > > Can you please turn this submission into a two-part patch series, and > append a revert of commit 6896efdec270, as second patch? > > Thank you, > Laszlo > >> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> index d23aea4bc712..1e71fc642c76 100644 >> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> @@ -18,6 +18,8 @@ >> >> Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
>> (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
>> +Copyright (c) Microsoft Corporation.
>> + >> SPDX-License-Identifier: BSD-2-Clause-Patent >> >> **/ >> @@ -2379,9 +2381,6 @@ VariableServiceGetVariable ( >> } >> >> CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr, mVariableModuleGlobal->VariableGlobal.AuthFormat), VarDataSize); >> - if (Attributes != NULL) { >> - *Attributes = Variable.CurrPtr->Attributes; >> - } >> >> *DataSize = VarDataSize; >> UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, TRUE, FALSE, FALSE, FALSE, &gVariableInfo); >> @@ -2395,6 +2394,11 @@ VariableServiceGetVariable ( >> } >> >> Done: >> + if (Status == EFI_SUCCESS || Status == EFI_BUFFER_TOO_SMALL) { >> + if (Attributes != NULL && Variable.CurrPtr != NULL) { >> + *Attributes = Variable.CurrPtr->Attributes; >> + } >> + } >> ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock); >> return Status; >> } >> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c >> index 2cf0ed32ae55..ca833fb0244d 100644 >> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c >> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c >> @@ -14,6 +14,7 @@ >> InitCommunicateBuffer() is really function to check the variable data size. >> >> Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
>> +Copyright (c) Microsoft Corporation.
>> SPDX-License-Identifier: BSD-2-Clause-Patent >> >> **/ >> @@ -642,10 +643,6 @@ FindVariableInRuntimeCache ( >> } >> >> CopyMem (Data, GetVariableDataPtr (RtPtrTrack.CurrPtr, mVariableAuthFormat), TempDataSize); >> - if (Attributes != NULL) { >> - *Attributes = RtPtrTrack.CurrPtr->Attributes; >> - } >> - >> *DataSize = TempDataSize; >> >> UpdateVariableInfo (VariableName, VendorGuid, RtPtrTrack.Volatile, TRUE, FALSE, FALSE, TRUE, &mVariableInfo); >> @@ -661,6 +658,11 @@ FindVariableInRuntimeCache ( >> } >> >> Done: >> + if (Status == EFI_SUCCESS || Status == EFI_BUFFER_TOO_SMALL) { >> + if (Attributes != NULL && RtPtrTrack.CurrPtr != NULL) { >> + *Attributes = RtPtrTrack.CurrPtr->Attributes; >> + } >> + } >> mVariableRuntimeCacheReadLock = FALSE; >> >> return Status; >> >