From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 1A18F941AF6 for ; Tue, 28 Nov 2023 15:15:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=IoSOV4c232/+PIxMs5vwuTH+v8tIhFucWg5Zh1bVCOE=; c=relaxed/simple; d=groups.io; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Thread-Index:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding:Content-Language; s=20140610; t=1701184505; v=1; b=CpKbOn20zpyBByN4ANZbMhTkdWheUXOU4D97SC4s2vpdhmWs8J792puCNeE6Ackala2QR0cE Pw7fqx09I7puy6aUuAG57IInd6+r16SORd5jOu1Z958JqemnFzGDeh79eoMnPPQXn+KOvHGBvMR sSN6cOgPWUxTUDiBNbJJVFDs= X-Received: by 127.0.0.2 with SMTP id DpLdYY7687511xvr6IsLWI4R; Tue, 28 Nov 2023 07:15:05 -0800 X-Received: from zrleap.intel-email.com (zrleap.intel-email.com [114.80.218.36]) by mx.groups.io with SMTP id smtpd.web10.34895.1701184504501594017 for ; Tue, 28 Nov 2023 07:15:05 -0800 X-Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id F1CA1A32E035 for ; Tue, 28 Nov 2023 23:15:00 +0800 (CST) X-Received: from localhost (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id DCBE2A32E033 for ; Tue, 28 Nov 2023 23:15:00 +0800 (CST) X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by zrleap.intel-email.com (Postfix) with SMTP id 18CBDA32E01D for ; Tue, 28 Nov 2023 23:14:57 +0800 (CST) X-Received: from DESKTOPS6D0PVI ([114.93.194.54]) (envelope-sender ) by 192.168.6.13 with ESMTP(SSL) for ; Tue, 28 Nov 2023 23:14:56 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 114.93.194.54 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming via groups.io" To: , , "'Nhi Pham'" Cc: References: <20231123044854.3003826-1-nhi@os.amperecomputing.com> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1Byb3Bvc2VkIEZpeF1bUEFUQ0ggdjEgMS8xXSBNZGVNb2R1bGVQa2cvRHhlQ2Fwc3VsZUxpYkZtcDogRml4IGNyYXNoIHdpdGggVmlydHVhbEFkZHJlc3NNYXAgb21pdHRlZA==?= Date: Tue, 28 Nov 2023 23:14:57 +0800 Message-ID: <026f01da220d$a6217260$f2645720$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AQHZ9MatZsuEpGgnR2ExDvSHscvTowH4wssosIBrjJA= Precedence: Bulk 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 List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ZIlhjZNlPikxCLXXYHo5LR0Qx7686176AA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=CpKbOn20; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Reviewed-by: Liming Gao > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Ard > Biesheuvel > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2023=E5=B9=B411=E6=9C=8823=E6=97=A5= 16:36 > =E6=94=B6=E4=BB=B6=E4=BA=BA: Nhi Pham > =E6=8A=84=E9=80=81: devel@edk2.groups.io; gaoliming@byosoft.com.cn; > ardb+tianocore@kernel.org > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [Proposed Fix][PATCH v1 1/1] > MdeModulePkg/DxeCapsuleLibFmp: Fix crash with VirtualAddressMap > omitted >=20 > On Thu, 23 Nov 2023 at 05:49, Nhi Pham > wrote: > > > > If the SetVirtualAddressMap() is not called, mIsVirtualAddrConverted > > is FALSE and the kernel crash occurs in IsNestedFmpCapsule() when > > executing gBS->LocateProtocol () in the else case. > > > > To serve the omitted SetVirtualAddressMap() call, we could just check > > mEsrtTable presence instead of relying on mIsVirtualAddrConverted. > > > > Signed-off-by: Nhi Pham >=20 > Agreed: SetVirtualAddressMap() is optional, so whether it has been > called or not should not be used as a proxy to decide whether or not > we are still running in the boot services context. >=20 > Reviewed-by: Ard Biesheuvel >=20 >=20 > > --- > > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 17 > +++++++---------- > > MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleRuntime.c | 2 -- > > 2 files changed, 7 insertions(+), 12 deletions(-) > > > > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > > index 197af267aff3..2433c76a8c6f 100644 > > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c > > @@ -41,8 +41,7 @@ > > #include > > #include > > > > -EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable =3D NULL; > > -BOOLEAN mIsVirtualAddrConverted =3D FALSE; > > +EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable =3D NULL; > > > > BOOLEAN mDxeCapsuleLibEndOfDxe =3D FALSE; > > EFI_EVENT mDxeCapsuleLibEndOfDxeEvent =3D NULL; > > @@ -1394,14 +1393,12 @@ IsNestedFmpCapsule ( > > EFI_SYSTEM_RESOURCE_ENTRY Entry; > > > > EsrtGuidFound =3D FALSE; > > - if (mIsVirtualAddrConverted) { > > - if (mEsrtTable !=3D NULL) { > > - EsrtEntry =3D (EFI_SYSTEM_RESOURCE_ENTRY *)(mEsrtTable + 1); > > - for (Index =3D 0; Index < mEsrtTable->FwResourceCount; Index++, > EsrtEntry++) { > > - if (CompareGuid (&EsrtEntry->FwClass, > &CapsuleHeader->CapsuleGuid)) { > > - EsrtGuidFound =3D TRUE; > > - break; > > - } > > + if (mEsrtTable !=3D NULL) { > > + EsrtEntry =3D (EFI_SYSTEM_RESOURCE_ENTRY *)(mEsrtTable + 1); > > + for (Index =3D 0; Index < mEsrtTable->FwResourceCount; Index++, > EsrtEntry++) { > > + if (CompareGuid (&EsrtEntry->FwClass, > &CapsuleHeader->CapsuleGuid)) { > > + EsrtGuidFound =3D TRUE; > > + break; > > } > > } > > } else { > > diff --git > a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleRuntime.c > b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleRuntime.c > > index 9ceb44fe4d79..44f30c16c284 100644 > > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleRuntime.c > > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleRuntime.c > > @@ -21,7 +21,6 @@ > > #include > > > > extern EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable; > > -extern BOOLEAN mIsVirtualAddrConverted; > > EFI_EVENT > mDxeRuntimeCapsuleLibVirtualAddressChangeEvent =3D NULL; > > EFI_EVENT > mDxeRuntimeCapsuleLibReadyToBootEvent =3D NULL; > > > > @@ -40,7 +39,6 @@ DxeCapsuleLibVirtualAddressChangeEvent ( > > ) > > { > > gRT->ConvertPointer (EFI_OPTIONAL_PTR, (VOID **)&mEsrtTable); > > - mIsVirtualAddrConverted =3D TRUE; > > } > > > > /** > > -- > > 2.25.1 > > >=20 >=20 >=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 (#111812): https://edk2.groups.io/g/devel/message/111812 Mute This Topic: https://groups.io/mt/102851947/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-