From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web09.13160.1606438727248168013 for ; Thu, 26 Nov 2020 16:58:48 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 27 Nov 2020 08:58:39 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , "'Laszlo Ersek'" , Cc: "'Bret Barkelew'" , "'Ard Biesheuvel \(ARM address\)'" , "'Hao A Wu'" , "'Jian J Wang'" References: <414b7574bf8249de0cecd16fb422c711feb76e1a.camel@linux.ibm.com> <3090ce8d-74de-0fc7-985e-c4831091e478@redhat.com> <164AEA4706B9EEF6.8857@groups.io> In-Reply-To: <164AEA4706B9EEF6.8857@groups.io> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0g5Zue5aSNOiBbUEFUQ0hdIE1kZU1vZHVsZVBrZzogRml4IHJ1bnRpbWUgcGFuaWMgaW4gVmFsaWRhdGVTZXRWYXJpYWJsZSgp?= Date: Fri, 27 Nov 2020 08:58:40 +0800 Message-ID: <005301d6c458$724048b0$56c0da10$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHEHZ7xPGRdaqQEbcSTEtE68Ioj3wGDriwPArzHQyWp3nHvkA== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn PR https://github.com/tianocore/edk2/pull/1148 is created.=20 Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: bounce+27952+68010+4905953+8761045@groups.i= o > =E4=BB=A3=E8=A1=A8 gaolim= ing > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B411=E6=9C=8826=E6=97= =A5 9:23 > =E6=94=B6=E4=BB=B6=E4=BA=BA: 'Laszlo Ersek' ; jejb@li= nux.ibm.com > =E6=8A=84=E9=80=81: devel@edk2.groups.io; 'Bret Barkelew' ; > 'Ard Biesheuvel (ARM address)' ; 'Hao A Wu' > ; 'Jian J Wang' > =E4=B8=BB=E9=A2=98: [edk2-devel] =E5=9B=9E=E5=A4=8D: [PATCH] MdeModulePk= g: Fix runtime panic in > ValidateSetVariable() >=20 > Laszlo and James: > Thanks for your root cause. The fix is clear. It works on runtime vers= ion and > smm version. Reviewed-by: Liming Gao >=20 > I agree to merge this hot fix for this stable tag 202011. I will add L= aszlo tag > and update subject title when I merge this patch. >=20 > Thanks > Liming > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > =E5=8F=91=E4=BB=B6=E4=BA=BA: Laszlo Ersek > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B411=E6=9C=8826=E6=97= = =A5 5:01 > > =E6=94=B6=E4=BB=B6=E4=BA=BA: jejb@linux.ibm.com; Liming Gao (Byosoft a= ddress) > > > > =E6=8A=84=E9=80=81: devel@edk2.groups.io; Bret Barkelew ; > Ard > > Biesheuvel (ARM address) ; Hao A Wu > > ; Jian J Wang > > =E4=B8=BB=E9=A2=98: Re: [PATCH] MdeModulePkg: Fix runtime panic in > ValidateSetVariable() > > > > On 11/25/20 21:13, James Bottomley wrote: > > > The current variable policy is allocated by AllocatePool(), which is > > > boot time only. This means that if you do any variable setting in t= he > > > runtime, the policy has been freed. Ordinarily this isn't detected > > > because freed memory is still there, but when you boot the Linux > > > kernel, it's been remapped so the actual memory no longer exists in > > > the memory map causing a page fault. > > > > > > Fix this by making it AllocateRuntimePool(). For SMM drivers, the > > > platform DSC is responsible for resolving the MemoryAllocationLib > > > class to the SmmMemoryAllocationLib instance. In the > > > SmmMemoryAllocationLib instance, AllocatePool() and > > > AllocateRuntimePool() are implemented identically. Therefore this > > > change is a no-op when the RegisterVariablePolicy() function is buil= t > > > into an SMM driver. The fix affects runtime DXE drivers only. > > > > > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3092 > > > Signed-off-by: James Bottomley > > > --- > > > MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi= b.c > > b/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c > > > index 5029ddb96adb..12944ac7ea81 100644 > > > --- a/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c > > > +++ b/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c > > > @@ -411,7 +411,7 @@ RegisterVariablePolicy ( > > > } > > > > > > // Reallocate and copy the table. > > > - NewTable =3D AllocatePool( NewSize ); > > > + NewTable =3D AllocateRuntimePool( NewSize ); > > > if (NewTable =3D=3D NULL) { > > > return EFI_OUT_OF_RESOURCES; > > > } > > > > > > > (1) CC'ing Jian and Hao: > > > > $ python BaseTools/Scripts/GetMaintainer.py \ > > -l MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c > > > > Jian J Wang > > Hao A Wu > > Liming Gao > > devel@edk2.groups.io > > > > > > (2) My feedback: > > > > Fixes: 355b181f74050cdf2f09b1755c1a5ee4affb1faf > > Reviewed-by: Laszlo Ersek > > Tested-by: Laszlo Ersek > > > > (I tested the actual bugfix with SMM-less OVMF. I also > > regression-tested the patch, namely with SMM OVMF, and ArmVirtQemu > too.) > > > > > > (3) I suggest updating the subject line as follows: > > > > MdeModulePkg/VariablePolicyLib: Fix runtime panic in > > ValidateSetVariable() > > > > 74 characters, so it's not overlong. > > > > No need to repost because of this. > > > > > > Liming, can you please pick up my feedback tags from (2), in addition = to > > your own review, and refresh the subject as requested in (3), and then > > merge this patch -- before releasing edk2-stable202011? > > > > Thank you all, > > Laszlo >=20 >=20 >=20 >=20 >=20 >=20 >=20