From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.281.1573452479894797614 for ; Sun, 10 Nov 2019 22:08:00 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Nov 2019 22:07:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,291,1569308400"; d="scan'208";a="287088291" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga001.jf.intel.com with ESMTP; 10 Nov 2019 22:07:58 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 10 Nov 2019 22:07:58 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 10 Nov 2019 22:07:58 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by shsmsx102.ccr.corp.intel.com ([169.254.2.108]) with mapi id 14.03.0439.000; Mon, 11 Nov 2019 14:07:55 +0800 From: "Liming Gao" To: "devel@edk2.groups.io" , "Kubacki, Michael A" CC: "Kinney, Michael D" , "Wang, Jian J" , "Wu, Hao A" , "Gao, Liming" Subject: Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Fix volatile variable RT cache update logic Thread-Topic: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Fix volatile variable RT cache update logic Thread-Index: AQHVmE8xR9YeOpMBmUyU1dFIoHwO4qeFe/aw Date: Mon, 11 Nov 2019 06:07:55 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E53C580@SHSMSX104.ccr.corp.intel.com> References: <20191111051620.37748-1-michael.a.kubacki@intel.com> In-Reply-To: <20191111051620.37748-1-michael.a.kubacki@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Michael: What real issue is caused by this issue? Thanks Liming >-----Original Message----- >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >Kubacki, Michael A >Sent: Monday, November 11, 2019 1:16 PM >To: devel@edk2.groups.io >Cc: Gao, Liming ; Kinney, Michael D >; Wang, Jian J ; Wu, >Hao A >Subject: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Fix volatile >variable RT cache update logic > >REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2333 > >During a SetVariable () invocation, UpdateVariable () is called. >UpdateVariable () contains logic to determine whether a volatile or >non-volatile UEFI variable was set so the corresponding runtime >cache can be updated to reflect the change. The current logic simply >evaluates Variable->Volatile to determine which runtime cache should >be updated. > >The problem is Variable->Volatile does not always reflect whether a >volatile variable is being set. Variable->Volatile is set to TRUE >only in the case a pre-existing variable is found in the volatile >variable store. Therefore, the value is FALSE when a new volatile >variable is written. > >This change updates the logic to take this into account. If a new >variable is written successfully, the Attributes will accurately >reflect whether the variable is non-volatile. If a pre-existing >variable is modified, the Volatile field will reflect the type of >variable (Attributes are not reliable; e.g. 0x0 indicates deletion). > >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 | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > >diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >index 29d6aca993..75d33ff724 100644 >--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >@@ -2296,9 +2296,8 @@ UpdateVariable ( > > Done: > if (!EFI_ERROR (Status)) { >- if (Variable->Volatile) { >- VolatileCacheInstance =3D &(mVariableModuleGlobal- >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeVolatileCach >e); >- } else { >+ VolatileCacheInstance =3D &(mVariableModuleGlobal- >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeVolatileCach >e); >+ if ((Variable->CurrPtr !=3D NULL && !Variable->Volatile) || (Attribu= tes & >EFI_VARIABLE_NON_VOLATILE) !=3D 0) { > VolatileCacheInstance =3D &(mVariableModuleGlobal- >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeNvCache); > } > >-- >2.16.2.windows.1 > > >