From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cxsh.intel-email.com (cxsh.intel-email.com [121.46.250.151]) by mx.groups.io with SMTP id smtpd.web11.17753.1677566604118641357 for ; Mon, 27 Feb 2023 22:43:25 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=S1dCRh0E; spf=pass (domain: byosoft.com.cn, ip: 121.46.250.151, mailfrom: gaoliming@byosoft.com.cn) Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id D0EA2DDA787 for ; Tue, 28 Feb 2023 14:43:21 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1677566601; bh=3woWiKnDPficoxdQN2oskyo9teG6f1aFHT4Spx290to=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=S1dCRh0Emwfsp6E+s7dNwsKKVJkgVzIWotOs2fw7Xz148OmH3hsaMJpLZqNbP4h// 7hQPEXZ7tqjThmsWHqWN2+zDxmELHuTQj4DCOHWM2OXjg0q8SS+b8YXXmCdCZxV4CG hXZ8lpHoniJkbWInaTzd8Dc537tzqqdiSEMdjZmQ= Received: from localhost (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id CC458DDA79A for ; Tue, 28 Feb 2023 14:43:21 +0800 (CST) Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id 90CA6DDA7BD for ; Tue, 28 Feb 2023 14:43:21 +0800 (CST) Authentication-Results: cxsh.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by cxsh.intel-email.com (Postfix) with SMTP id 1D0C8DDA7D7 for ; Tue, 28 Feb 2023 14:43:18 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 28 Feb 2023 14:43:12 +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" To: "'Sunil V L'" , Cc: "'Andrei Warkentin'" , "'Ard Biesheuvel'" , "'Jiewen Yao'" , "'Jordan Justen'" , "'Gerd Hoffmann'" , "'Michael D Kinney'" , "'Andrew Fish'" , "'Leif Lindholm'" References: <20230225053200.2051719-1-sunilvl@ventanamicro.com> In-Reply-To: <20230225053200.2051719-1-sunilvl@ventanamicro.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1zdGFibGUyMDIzMDIgUEFUQ0ggVjIgMS8xXSBPdm1mUGtnL1Jpc2NWVmlydDogQWRkIFN0YWNrIEhPQg==?= Date: Tue, 28 Feb 2023 14:43:13 +0800 Message-ID: <04e001d94b3f$eeb87870$cc296950$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQCcvlz8aYRz9to4GNbRftMX/Y+PArFdAsgA Sender: "gaoliming" Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Sunil: Is this a critical issue? Dose this fix need to catch this stable tag? = Has it been verified and code review? Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: Sunil V L > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA2=D4=C225=C8=D5 13:32 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Liming Gao ; Andrei Warkentin > ; Ard Biesheuvel = ; > Jiewen Yao ; Jordan Justen > ; Gerd Hoffmann > =D6=F7=CC=E2: [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add = Stack HOB >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4350 >=20 > Currently, stack HOB is not created for the stack memory. This causes > stack memory to be treated as free memory and any memory allocation > which > happens at this address causes random memory corruption. Fix this by > creating the stack HOB which marks the memory as BS data. >=20 > Cc: Liming Gao > Cc: Andrei Warkentin > Cc: Ard Biesheuvel > Cc: Jiewen Yao > Cc: Jordan Justen > Cc: Gerd Hoffmann > Signed-off-by: Sunil V L > Reported-by: Andrei Warkentin > Tested-by: Andrei Warkentin > Reviewed-by: Andrei Warkentin > --- > Changes since V1: > 1) Added BZ reference > 2) Added edk2-stable202302 in the title to request to catch > the stable tag > 3) Updated tags >=20 > OvmfPkg/RiscVVirt/Sec/SecMain.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/OvmfPkg/RiscVVirt/Sec/SecMain.c > b/OvmfPkg/RiscVVirt/Sec/SecMain.c > index 73b9b21a67ba..adf73f2eb66c 100644 > --- a/OvmfPkg/RiscVVirt/Sec/SecMain.c > +++ b/OvmfPkg/RiscVVirt/Sec/SecMain.c > @@ -55,6 +55,7 @@ SecStartup ( > EFI_STATUS Status; > UINT64 UefiMemoryBase; > UINT64 StackBase; > + UINT32 StackSize; >=20 > // > // Report Status Code to indicate entering SEC core > @@ -71,9 +72,9 @@ SecStartup ( > FirmwareContext.FlattenedDeviceTree =3D (UINT64)DeviceTreeAddress; > SetFirmwareContextPointer (&FirmwareContext); >=20 > - StackBase =3D (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + > - FixedPcdGet32 (PcdOvmfSecPeiTempRamSize); > - UefiMemoryBase =3D StackBase - SIZE_32MB; > + StackBase =3D (UINT64)FixedPcdGet32 > (PcdOvmfSecPeiTempRamBase); > + StackSize =3D FixedPcdGet32 (PcdOvmfSecPeiTempRamSize); > + UefiMemoryBase =3D StackBase + StackSize - SIZE_32MB; >=20 > // Declare the PI/UEFI memory region > HobList =3D HobConstructor ( > @@ -86,6 +87,8 @@ SecStartup ( >=20 > SecInitializePlatform (); >=20 > + BuildStackHob (StackBase, StackSize); > + > // > // Process all libraries constructor function linked to SecMain. > // > -- > 2.34.1