[edk2-devel] [RFC edk2 v1 1/1] MdeModulePkg/Variable: Move FindVariable after AutoUpdateLangVariable

Ming Huang huangming23 at huawei.com
Tue May 26 06:08:13 UTC 2020



在 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 at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Ming
>> Huang
>> Sent: Monday, May 25, 2020 7:34 PM
>> To: devel at edk2.groups.io; Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao A
>> <hao.a.wu at intel.com>; Gao, Liming <liming.gao at intel.com>
>> Cc: lidongzhan at huawei.com; huangming23 at huawei.com;
>> songdongkuang at huawei.com; wanghuiqiang at huawei.com;
>> qiuliangen at huawei.com; shenlimei at 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 <huangming23 at huawei.com>
>> ---
>>  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
>>
>>
>> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#60261): https://edk2.groups.io/g/devel/message/60261
Mute This Topic: https://groups.io/mt/74462883/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list