From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from huawei.com (huawei.com [45.249.212.191]) by mx.groups.io with SMTP id smtpd.web10.45893.1590473305686769021 for ; Mon, 25 May 2020 23:08:26 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.191, mailfrom: huangming23@huawei.com) Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id AD8249D7AC92A7BFFBCF for ; Tue, 26 May 2020 14:08:21 +0800 (CST) Received: from [127.0.0.1] (10.78.51.60) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Tue, 26 May 2020 14:08:13 +0800 Subject: Re: [edk2-devel] [RFC edk2 v1 1/1] MdeModulePkg/Variable: Move FindVariable after AutoUpdateLangVariable To: "Jiang, Guomin" , "devel@edk2.groups.io" , "Wang, Jian J" , "Wu, Hao A" , "Gao, Liming" CC: "lidongzhan@huawei.com" , "songdongkuang@huawei.com" , "wanghuiqiang@huawei.com" , "qiuliangen@huawei.com" , "shenlimei@huawei.com" References: <1590406458-59742-1-git-send-email-huangming23@huawei.com> <1590406458-59742-2-git-send-email-huangming23@huawei.com> From: Ming Huang Message-ID: <0d23e61f-3126-bf7d-f370-7db6ad22a7b7@huawei.com> Date: Tue, 26 May 2020 14:08:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.78.51.60] X-CFilter-Loop: Reflected Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: quoted-printable =D4=DA 2020/5/26 8:39, Jiang, Guomin =D0=B4=B5=C0: > Hi Huangming, >=20 > I am taking the bugzilla and I am sorry that I haven't provide you with = productive comment. >=20 > I am still busy until August. >=20 > I just want to know that: > 1. Have you verified that the symptom will disappear after invoked FindV= ariable() function? Yes, the symptom will disappeare after add this patch. > 2. Is it your suggestion that the FindVariable() need to be invoked but = you have no idea that how to fix it? This patch can fix this issue, and I guess this issue was resulted by addi= ng AutoUpdateLangVariable feature. I hope this patch can be merged to edk2 master. Thanks Ming >=20 > Best Regards > Guomin >> -----Original Message----- >> From: devel@edk2.groups.io On Behalf Of Ming >> Huang >> Sent: Monday, May 25, 2020 7:34 PM >> To: devel@edk2.groups.io; Wang, Jian J ; Wu, Hao= A >> ; Gao, Liming >> Cc: lidongzhan@huawei.com; huangming23@huawei.com; >> songdongkuang@huawei.com; wanghuiqiang@huawei.com; >> qiuliangen@huawei.com; shenlimei@huawei.com >> Subject: [edk2-devel] [RFC edk2 v1 1/1] MdeModulePkg/Variable: Move >> FindVariable after AutoUpdateLangVariable >> >> When occur reclaim in AutoUpdateLangVariable(), the CurrPtr of Variable= is >> invalid. The State will be update with wrong position after UpdateVaria= ble in >> this situation and two valid PlatformLang or Lang variables will exist. >> BmForEachVariable() will enter endless loop while exist two valid >> PlatformLang variables. So FindVariable() should be invoked atfer >> AutoUpdateLangVariable(). >> >> https://bugzilla.tianocore.org/show_bug.cgi?id=3D2667 >> >> Signed-off-by: Ming Huang >> --- >> MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 26 >> ++++++++++---------- >> 1 file changed, 13 insertions(+), 13 deletions(-) >> >> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> index 1e71fc6..0cec981 100644 >> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> @@ -2741,6 +2741,19 @@ VariableServiceSetVariable ( >> mVariableModuleGlobal->NonVolatileLastVariableOffset =3D (UINTN) >> NextVariable - (UINTN) Point; >> } >> >> + if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) { >> + // >> + // Hook the operation of setting PlatformLangCodes/PlatformLang an= d >> LangCodes/Lang. >> + // >> + Status =3D AutoUpdateLangVariable (VariableName, Data, DataSize); >> + if (EFI_ERROR (Status)) { >> + // >> + // The auto update operation failed, directly return to avoid >> inconsistency between PlatformLang and Lang. >> + // >> + goto Done; >> + } >> + } >> + >> // >> // Check whether the input variable is already existed. >> // >> @@ -2763,19 +2776,6 @@ VariableServiceSetVariable ( >> } >> } >> >> - if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) { >> - // >> - // Hook the operation of setting PlatformLangCodes/PlatformLang an= d >> LangCodes/Lang. >> - // >> - Status =3D AutoUpdateLangVariable (VariableName, Data, DataSize); >> - if (EFI_ERROR (Status)) { >> - // >> - // The auto update operation failed, directly return to avoid in= consistency >> between PlatformLang and Lang. >> - // >> - goto Done; >> - } >> - } >> - >> if (mVariableModuleGlobal->VariableGlobal.AuthSupport) { >> Status =3D AuthVariableLibProcessVariable (VariableName, VendorGui= d, >> Data, DataSize, Attributes); >> } else { >> -- >> 2.8.1 >> >> >>=20 >=20 >=20 >=20