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.web12.7482.1590590427010108017 for ; Wed, 27 May 2020 07:40:27 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.191, mailfrom: huangming23@huawei.com) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id EEA2473AC0D770DF59BA for ; Wed, 27 May 2020 22:40:22 +0800 (CST) Received: from [127.0.0.1] (10.78.51.60) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Wed, 27 May 2020 22:40:15 +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> <0d23e61f-3126-bf7d-f370-7db6ad22a7b7@huawei.com> From: Ming Huang Message-ID: <394ac7a5-7010-f8d0-62f8-fa51f807af8d@huawei.com> Date: Wed, 27 May 2020 22:40:15 +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="iso-2022-jp" Content-Transfer-Encoding: 7bit Hi Guomin, This patch change the position of invoking the FindVariable() function to after AutoUpdateLangVariable() invoked. Thanks, Ming 在 2020/5/27 8:12, Jiang, Guomin 写道: > Hi Huangming, > > I will clarify it when I am free, please be patient. > > If it is urgent for you, I suggest that you can use your patch temporarily. > > Any other thing, I check your patch in the mail, it seem that not any change in code, can you double confirm it? > > Best Regards >> -----Original Message----- >> From: Ming Huang >> Sent: Tuesday, May 26, 2020 2:08 PM >> 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 >> Subject: Re: [edk2-devel] [RFC edk2 v1 1/1] MdeModulePkg/Variable: Move >> FindVariable after AutoUpdateLangVariable >> >> >> >> 在 2020/5/26 8:39, Jiang, Guomin 写道: >>> Hi Huangming, >>> >>> I am taking the bugzilla and I am sorry that I haven't provide you with >> productive comment. >>> >>> I am still busy until August. >>> >>> I just want to know that: >>> 1. Have you verified that the symptom will disappear after invoked >> FindVariable() 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 adding >> AutoUpdateLangVariable feature. >> I hope this patch can be merged to edk2 master. >> >> Thanks >> Ming >> >>> >>> 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 UpdateVariable 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=2667 >>>> >>>> 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 = (UINTN) >>>> NextVariable - (UINTN) Point; >>>> } >>>> >>>> + if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) { >>>> + // >>>> + // Hook the operation of setting PlatformLangCodes/PlatformLang >>>> + and >>>> LangCodes/Lang. >>>> + // >>>> + Status = 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 and >>>> LangCodes/Lang. >>>> - // >>>> - Status = AutoUpdateLangVariable (VariableName, Data, DataSize); >>>> - if (EFI_ERROR (Status)) { >>>> - // >>>> - // The auto update operation failed, directly return to avoid >> inconsistency >>>> between PlatformLang and Lang. >>>> - // >>>> - goto Done; >>>> - } >>>> - } >>>> - >>>> if (mVariableModuleGlobal->VariableGlobal.AuthSupport) { >>>> Status = AuthVariableLibProcessVariable (VariableName, >>>> VendorGuid, Data, DataSize, Attributes); >>>> } else { >>>> -- >>>> 2.8.1 >>>> >>>> >>>> >>> >>> >>> > > > . >