From nobody Wed May 8 20:01:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+94856+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94856+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1665365961; cv=none; d=zohomail.com; s=zohoarc; b=DYL/g9+6nK6IbzrbqimgVHo1jJejXQzGlk51O+MgEgLJshiBTGdjMO0KU6GukVK5bjHyHwLp38rLZ0uLDM2ydGQi0XNBWh7b0R1BrlemiprNkEjNihvD2wsP+HIp2huUA5DkTXwiqObK0gyK+QCzoxYgh6iuV7Lc8zlJ1dzfuuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665365961; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=iOzckffkT0SaCGmwBJdOLM8tKQc9UG3Xj3GpzbsfF+k=; b=BU8ML+0/ELrdBE95o1UVnM9VneHrzQkg8f3Gv+fhWmOTxS4KQvvbKcegENMBMwnZ8fH1IXT1fTzsm/+r2SMvcymYp0dX+d72yZAetdSfNxPwtwSrT2yfoK855arD3GtLaG+3tWa5G858TZH8M0soxL+d9u0xjXyrwfJbiOY4wrI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94856+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 166536596126480.92464666874935; Sun, 9 Oct 2022 18:39:21 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id uUVJYY1788612xCrXuLuLZpN; Sun, 09 Oct 2022 18:39:20 -0700 X-Received: from walk.intel-email.com (walk.intel-email.com [101.227.64.242]) by mx.groups.io with SMTP id smtpd.web12.1730.1665365958979572640 for ; Sun, 09 Oct 2022 18:39:20 -0700 X-Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 6CDB0CD1F650 for ; Mon, 10 Oct 2022 09:39:16 +0800 (CST) X-Received: from localhost (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 68AEFCD1F6AA for ; Mon, 10 Oct 2022 09:39:16 +0800 (CST) X-Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 2F89CCD1F671 for ; Mon, 10 Oct 2022 09:39:16 +0800 (CST) X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by walk.intel-email.com (Postfix) with SMTP id E18B9CD1F6AA for ; Mon, 10 Oct 2022 09:39:12 +0800 (CST) X-Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Mon, 10 Oct 2022 09:39:11 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming via groups.io" To: "'Jiading Zhang'" , References: <01fa01d8d476$c9f2ed80$5dd8c880$@byosoft.com.cn> <28563.1665362102769346496@groups.io> In-Reply-To: <28563.1665362102769346496@groups.io> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0g5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIXSBNZGVNb2R1bGVQa2cgVmFyaWFibGVQZWk6IEFkZCBWYXJpYWJsZSBzdGF0ZSBjaGVjayB3aGVuIGZpbmQgdmFyaWFibGUgaW4gSW5kZXhUYWJsZS4=?= Date: Mon, 10 Oct 2022 09:39:14 +0800 Message-ID: <01df01d8dc49$1a7b2130$4f716390$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AQKB7qNld73geYOyxiug3YXymmF/UQHPGm/6rKY7iBA= Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gaoliming@byosoft.com.cn X-Gm-Message-State: a8v2BVwTUkrI3xNpME2pS86Vx1787277AA= Content-Type: multipart/alternative; boundary="----=_NextPart_000_01E0_01D8DC8C.289F99B0" Content-Language: zh-cn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1665365960; bh=RXSuzNwQ64RckSoaYTT3QKjS5wJnAnWvE6i6ezfxDg4=; h=Content-Type:Date:From:Reply-To:Subject:To; b=kPsGZ2PTodMfrj6mgKauvnW/lhALB0pq37YJ3sPtciHYW4yzXNEJ/jS/fXn+qwLjbY/ GcnWseEWIUlf4abha80Cc6hx6GsU6VF2Tdn+GmqZDf7fcmo4gSrP9QG9YwFV79XhBlp90 Zie2QE8ThGaWqjf/lc6gspeqZqc0P/58t94= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1665365961578100001 ------=_NextPart_000_01E0_01D8DC8C.289F99B0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Jiading:=20 Please check why NV variable data is required to be changed in PEI phase.= This will be helpful for this issue. =20 Thanks Liming =E5=8F=91=E4=BB=B6=E4=BA=BA: Jiading Zhang =20 =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B410=E6=9C=8810=E6=97=A5 8= :35 =E6=94=B6=E4=BB=B6=E4=BA=BA: gaoliming ; devel@ed= k2.groups.io =E4=B8=BB=E9=A2=98: Re: [edk2-devel] =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATC= H] MdeModulePkg VariablePei: Add Variable state check when find variable in= IndexTable. =20 Hi liming: Yes, NV Variable Data is not changed in PEI phase in normal case. This i= ssue was found when we did a special coding, and when found variable in the= IndexTable, it found the variable before the last changed if didn't add t= he following condition: "if ((VariableHeader->State =3D=3D VAR_ADDED) || (VariableHeader->State = =3D=3D (VAR_IN_DELETED_TRANSITION & VAR_ADDED)))" Maybe our specail coding had some defect=EF=BC=8Cand caused this issue. On Fri, Sep 30, 2022 at 10:46 AM, gaoliming wrote: Jiading: Hob Variable Store Info IndexTable is NULL. So, this logic doesn=E2=80=99t= work for HOB variable store. NV Variable Store Info has IndexTable. When i= ts IndexTable is initialized, its IndexTable will only record the variable = with VAR_ADDED attribute. Because NV Variable Data is not changed in PEI ph= ase, this check is not required by NV variable.=20 =20 Thanks Liming =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > =E4=BB=A3=E8=A1= =A8 Jiading Zhang =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B49=E6=9C=8828=E6=97=A5 11= :05 =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io =20 =E4=B8=BB=E9=A2=98: [edk2-devel] [PATCH] MdeModulePkg VariablePei: Add Vari= able state check when find variable in IndexTable. =20 When read a variable in PEI, it will find it first in the HOB, then find in= variable store. When find in variable store, it will check the variable st= ate, but find in HOB, it doesn't check the state, so if the variable was ch= anged, it will find the obsolete variable in the HOB. =20 Signed-off-by: jdzhang > --- MdeModulePkg/Universal/Variable/Pei/Variable.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) =20 diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/= Universal/Variable/Pei/Variable.c index 26a4c73b45..dffbd8cdb1 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -866,11 +866,13 @@ FindVariableEx ( Offset +=3D IndexTable->Index[Index]; MaxIndex =3D (VARIABLE_HEADER *)((UINT8 *)IndexTable->StartPtr + Off= set); GetVariableHeader (StoreInfo, MaxIndex, &VariableHeader); - if (CompareWithValidVariable (StoreInfo, MaxIndex, VariableHeader, V= ariableName, VendorGuid, PtrTrack) =3D=3D EFI_SUCCESS) { - if (VariableHeader->State =3D=3D (VAR_IN_DELETED_TRANSITION & VAR_= ADDED)) { - InDeletedVariable =3D PtrTrack->CurrPtr; - } else { - return EFI_SUCCESS; + if ((VariableHeader->State =3D=3D VAR_ADDED) || (VariableHeader->Sta= te =3D=3D (VAR_IN_DELETED_TRANSITION & VAR_ADDED))) { + if (CompareWithValidVariable (StoreInfo, MaxIndex, VariableHeader,= VariableName, VendorGuid, PtrTrack) =3D=3D EFI_SUCCESS) { + if (VariableHeader->State =3D=3D (VAR_IN_DELETED_TRANSITION & VA= R_ADDED)) { + InDeletedVariable =3D PtrTrack->CurrPtr; + } else { + return EFI_SUCCESS; + } } } } --=20 2.20.1.windows.1 =20 =20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94856): https://edk2.groups.io/g/devel/message/94856 Mute This Topic: https://groups.io/mt/94228287/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- ------=_NextPart_000_01E0_01D8DC8C.289F99B0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Jiading:

=C2= =A0=C2=A0Please check why NV variable data is required to be changed in PEI= phase. This will be helpful for this issue.

 

Thanks<= o:p>

Liming

=E5=8F=91=E4=BB=B6=E4=BA=BA: Jiading Zhang <jdzhang@kunluntech.com.cn> = =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4:<= span lang=3DEN-US style=3D'font-size:11.0pt;font-family:=E7=AD=89=E7=BA=BF'= > 2022=E5=B9=B410=E6=9C=8810=E6=97=A5 8:35
=E6=94=B6=E4=BB=B6=E4=BA=BA= : gaoliming <gaoliming@= byosoft.com.cn>; devel@edk2.groups.io
=E4=B8=BB=E9=A2=98:
Re: [edk2-devel] =E5= =9B=9E=E5=A4=8D: [edk2-devel] [PATCH] MdeModulePkg Varia= blePei: Add Variable state check when find variable in IndexTable.

 

Hi liming:=
   Yes, NV Variable Data is not changed in PEI phase in norma= l case. This issue was found when we did a special coding, and when found v= ariable in the IndexTable, it found the variable before the last changed if=   didn't add the following condition:
  "if ((VariableHea= der->State =3D=3D VAR_ADDED) || (VariableHeader->State =3D=3D (VAR_IN= _DELETED_TRANSITION & VAR_ADDED)))"

Maybe our specail codin= g had some defect
=EF=BC=8Cand caused this issue.<= br>
On Fri, Sep 30, 2022 at 10:46 AM, gaoliming wrote:
=

Jiading:

 Hob Variable Store Info IndexTable is NULL. So, this logic doesn= =E2= =80=99t work for HOB variable store. NV Variable Store I= nfo has IndexTable. When its IndexTable is initialized, its IndexTable will= only record the variable with VAR_ADDED attribute. Because NV Variable Dat= a is not changed in PEI phase, this check is not required by NV variable. <= /span>

 <= /span>

Thanks=

Liming

<= div style=3D'border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4= .0pt'>

=E5=8F= =91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io <devel@edk2.groups.io> =E4=BB=A3=E8=A1= =A8 Jiading Zhang
=E5=8F=91=E9=80=81=E6=97=B6=E9= =97=B4: 2022=E5=B9=B49=E6=9C=8828=E6=97=A5 11:05
=E6=94=B6=E4=BB=B6=E4=BA=BA:
devel@edk2.g= roups.io
=E4=B8=BB=E9=A2=98: [edk2-devel] [PATCH] MdeModulePkg VariablePei: Add Variable stat= e check when find variable in IndexTable.<= o:p>

 

When read a variable = in PEI, it will find it first in the HOB, then find in variable store. When= find in variable store, it will check the variable state, but find in HOB,= it doesn't check the state, so if the variable was changed, it will find t= he obsolete variable in the HOB.

 

= Signed-off-by: jdzhang <jdzhang@kunluntech.com.cn>

---

 MdeModulePkg/Universal/Variable/Pei/Va= riable.c | 12 +++++++-----

 1 file changed, = 7 insertions(+), 5 deletions(-)

 =

diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c= b/MdeModulePkg/Universal/Variable/Pei/Variable.c

index 26a4c73b45..dffbd8cdb1 100644

--- a/MdeMod= ulePkg/Universal/Variable/Pei/Variable.c

+++ b/Md= eModulePkg/Universal/Variable/Pei/Variable.c

@@ -= 866,11 +866,13 @@ FindVariableEx (

    =    Offset  +=3D IndexTable->Index[Index];

       MaxIndex =3D (VARIABLE_HEADER *)((UIN= T8 *)IndexTable->StartPtr + Offset);

  &n= bsp;    GetVariableHeader (StoreInfo, MaxIndex, &VariableHead= er);

-      if (CompareWithValidVa= riable (StoreInfo, MaxIndex, VariableHeader, VariableName, VendorGuid, PtrT= rack) =3D=3D EFI_SUCCESS) {

-     =   if (VariableHeader->State =3D=3D (VAR_IN_DELETED_TRANSITION &= ; VAR_ADDED)) {

-        &nbs= p; InDeletedVariable =3D PtrTrack->CurrPtr;

<= div>

-&= nbsp;       } else {

-   = ;       return EFI_SUCCESS;

=

+ = ;     if ((VariableHeader->State =3D=3D VAR_ADDED) || (Variabl= eHeader->State =3D=3D (VAR_IN_DELETED_TRANSITION & VAR_ADDED))) {

+        if (CompareWithValidVa= riable (StoreInfo, MaxIndex, VariableHeader, VariableName, VendorGuid, PtrT= rack) =3D=3D EFI_SUCCESS) {

+     =     if (VariableHeader->State =3D=3D (VAR_IN_DELETED_TRANSITI= ON & VAR_ADDED)) {

+      &nbs= p;     InDeletedVariable =3D PtrTrack->CurrPtr;

+          } else {<= /p>

+            return EFI_SUCCESS;

+          }

         }

=

&= nbsp;      }

     }=

-- 

2.20.1.window= s.1

 

 <= /o:p>

_._,_._,_

G= roups.io Links:

You receive all messages sent to this group.

Vi= ew/Reply Online (#94856) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [importer@patchew.org]
_._,_._,_=20 ------=_NextPart_000_01E0_01D8DC8C.289F99B0--