public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add Stack HOB
@ 2023-02-25  5:32 Sunil V L
  2023-02-28  6:43 ` 回复: " gaoliming
  0 siblings, 1 reply; 5+ messages in thread
From: Sunil V L @ 2023-02-25  5:32 UTC (permalink / raw)
  To: devel
  Cc: Liming Gao, Andrei Warkentin, Ard Biesheuvel, Jiewen Yao,
	Jordan Justen, Gerd Hoffmann

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4350

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.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Andrei Warkentin <andrei.warkentin@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reported-by: Andrei Warkentin <andrei.warkentin@intel.com>
Tested-by: Andrei Warkentin <andrei.warkentin@intel.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
---
Changes since V1:
	1) Added BZ reference
	2) Added edk2-stable202302 in the title to request to catch
	   the stable tag
	3) Updated tags

 OvmfPkg/RiscVVirt/Sec/SecMain.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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;
 
   //
   // Report Status Code to indicate entering SEC core
@@ -71,9 +72,9 @@ SecStartup (
   FirmwareContext.FlattenedDeviceTree = (UINT64)DeviceTreeAddress;
   SetFirmwareContextPointer (&FirmwareContext);
 
-  StackBase = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) +
-              FixedPcdGet32 (PcdOvmfSecPeiTempRamSize);
-  UefiMemoryBase = StackBase - SIZE_32MB;
+  StackBase      = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase);
+  StackSize      = FixedPcdGet32 (PcdOvmfSecPeiTempRamSize);
+  UefiMemoryBase = StackBase + StackSize - SIZE_32MB;
 
   // Declare the PI/UEFI memory region
   HobList = HobConstructor (
@@ -86,6 +87,8 @@ SecStartup (
 
   SecInitializePlatform ();
 
+  BuildStackHob (StackBase, StackSize);
+
   //
   // Process all libraries constructor function linked to SecMain.
   //
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* 回复: [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add Stack HOB
  2023-02-25  5:32 [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add Stack HOB Sunil V L
@ 2023-02-28  6:43 ` gaoliming
  2023-02-28  6:47   ` [edk2-devel] " Sunil V L
  0 siblings, 1 reply; 5+ messages in thread
From: gaoliming @ 2023-02-28  6:43 UTC (permalink / raw)
  To: 'Sunil V L', devel
  Cc: 'Andrei Warkentin', 'Ard Biesheuvel',
	'Jiewen Yao', 'Jordan Justen',
	'Gerd Hoffmann', 'Michael D Kinney',
	'Andrew Fish', 'Leif Lindholm'

Sunil:
  Is this a critical issue? Dose this fix need to catch this stable tag? Has
it been verified and code review?

Thanks
Liming
> -----邮件原件-----
> 发件人: Sunil V L <sunilvl@ventanamicro.com>
> 发送时间: 2023年2月25日 13:32
> 收件人: devel@edk2.groups.io
> 抄送: Liming Gao <gaoliming@byosoft.com.cn>; Andrei Warkentin
> <andrei.warkentin@intel.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> Jiewen Yao <jiewen.yao@intel.com>; Jordan Justen
> <jordan.l.justen@intel.com>; Gerd Hoffmann <kraxel@redhat.com>
> 主题: [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add Stack HOB
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4350
> 
> 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.
> 
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Andrei Warkentin <andrei.warkentin@intel.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> Reported-by: Andrei Warkentin <andrei.warkentin@intel.com>
> Tested-by: Andrei Warkentin <andrei.warkentin@intel.com>
> Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
> ---
> Changes since V1:
> 	1) Added BZ reference
> 	2) Added edk2-stable202302 in the title to request to catch
> 	   the stable tag
> 	3) Updated tags
> 
>  OvmfPkg/RiscVVirt/Sec/SecMain.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> 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;
> 
>    //
>    // Report Status Code to indicate entering SEC core
> @@ -71,9 +72,9 @@ SecStartup (
>    FirmwareContext.FlattenedDeviceTree = (UINT64)DeviceTreeAddress;
>    SetFirmwareContextPointer (&FirmwareContext);
> 
> -  StackBase = (UINT64)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) +
> -              FixedPcdGet32 (PcdOvmfSecPeiTempRamSize);
> -  UefiMemoryBase = StackBase - SIZE_32MB;
> +  StackBase      = (UINT64)FixedPcdGet32
> (PcdOvmfSecPeiTempRamBase);
> +  StackSize      = FixedPcdGet32 (PcdOvmfSecPeiTempRamSize);
> +  UefiMemoryBase = StackBase + StackSize - SIZE_32MB;
> 
>    // Declare the PI/UEFI memory region
>    HobList = HobConstructor (
> @@ -86,6 +87,8 @@ SecStartup (
> 
>    SecInitializePlatform ();
> 
> +  BuildStackHob (StackBase, StackSize);
> +
>    //
>    // Process all libraries constructor function linked to SecMain.
>    //
> --
> 2.34.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] 回复: [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add Stack HOB
  2023-02-28  6:43 ` 回复: " gaoliming
@ 2023-02-28  6:47   ` Sunil V L
  2023-03-01 14:47     ` 回复: " gaoliming
  0 siblings, 1 reply; 5+ messages in thread
From: Sunil V L @ 2023-02-28  6:47 UTC (permalink / raw)
  To: devel, gaoliming
  Cc: 'Andrei Warkentin', 'Ard Biesheuvel',
	'Jiewen Yao', 'Jordan Justen',
	'Gerd Hoffmann', 'Michael D Kinney',
	'Andrew Fish', 'Leif Lindholm'

On Tue, Feb 28, 2023 at 02:43:13PM +0800, gaoliming via groups.io wrote:
> Sunil:
>   Is this a critical issue? Dose this fix need to catch this stable tag? Has
> it been verified and code review?
> 
Hi Liming,

Yes, this is a critical issue. So, I request to catch the stable tag.

Andrei who reported this issue has verified the fix and helped with
review.

https://edk2.groups.io/g/devel/message/100496

Thanks!
Sunil

^ permalink raw reply	[flat|nested] 5+ messages in thread

* 回复: [edk2-devel] 回复: [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add Stack HOB
  2023-02-28  6:47   ` [edk2-devel] " Sunil V L
@ 2023-03-01 14:47     ` gaoliming
  2023-03-02  6:50       ` Sunil V L
  0 siblings, 1 reply; 5+ messages in thread
From: gaoliming @ 2023-03-01 14:47 UTC (permalink / raw)
  To: devel, sunilvl
  Cc: 'Andrei Warkentin', 'Ard Biesheuvel',
	'Jiewen Yao', 'Jordan Justen',
	'Gerd Hoffmann', 'Michael D Kinney',
	'Andrew Fish', 'Leif Lindholm'

Sunil:
  PR https://github.com/tianocore/edk2/pull/4084 has been created for this
patch. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Sunil V L
> 发送时间: 2023年2月28日 14:47
> 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn
> 抄送: 'Andrei Warkentin' <andrei.warkentin@intel.com>; 'Ard Biesheuvel'
> <ardb+tianocore@kernel.org>; 'Jiewen Yao' <jiewen.yao@intel.com>; 'Jordan
> Justen' <jordan.l.justen@intel.com>; 'Gerd Hoffmann' <kraxel@redhat.com>;
> 'Michael D Kinney' <michael.d.kinney@intel.com>; 'Andrew Fish'
> <afish@apple.com>; 'Leif Lindholm' <leif@nuviainc.com>
> 主题: Re: [edk2-devel] 回复: [edk2-stable202302 PATCH V2 1/1]
> OvmfPkg/RiscVVirt: Add Stack HOB
> 
> On Tue, Feb 28, 2023 at 02:43:13PM +0800, gaoliming via groups.io wrote:
> > Sunil:
> >   Is this a critical issue? Dose this fix need to catch this stable tag?
Has
> > it been verified and code review?
> >
> Hi Liming,
> 
> Yes, this is a critical issue. So, I request to catch the stable tag.
> 
> Andrei who reported this issue has verified the fix and helped with
> review.
> 
> https://edk2.groups.io/g/devel/message/100496
> 
> Thanks!
> Sunil
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 回复: [edk2-devel] 回复: [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add Stack HOB
  2023-03-01 14:47     ` 回复: " gaoliming
@ 2023-03-02  6:50       ` Sunil V L
  0 siblings, 0 replies; 5+ messages in thread
From: Sunil V L @ 2023-03-02  6:50 UTC (permalink / raw)
  To: devel, gaoliming

Thank yo very much!, Liming.

On 01/03/23 20:17, gaoliming via groups.io wrote:
> Sunil:
>    PR https://github.com/tianocore/edk2/pull/4084 has been created for this
> patch.
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Sunil V L
>> 发送时间: 2023年2月28日 14:47
>> 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn
>> 抄送: 'Andrei Warkentin' <andrei.warkentin@intel.com>; 'Ard Biesheuvel'
>> <ardb+tianocore@kernel.org>; 'Jiewen Yao' <jiewen.yao@intel.com>; 'Jordan
>> Justen' <jordan.l.justen@intel.com>; 'Gerd Hoffmann' <kraxel@redhat.com>;
>> 'Michael D Kinney' <michael.d.kinney@intel.com>; 'Andrew Fish'
>> <afish@apple.com>; 'Leif Lindholm' <leif@nuviainc.com>
>> 主题: Re: [edk2-devel] 回复: [edk2-stable202302 PATCH V2 1/1]
>> OvmfPkg/RiscVVirt: Add Stack HOB
>>
>> On Tue, Feb 28, 2023 at 02:43:13PM +0800, gaoliming via groups.io wrote:
>>> Sunil:
>>>    Is this a critical issue? Dose this fix need to catch this stable tag?
> Has
>>> it been verified and code review?
>>>
>> Hi Liming,
>>
>> Yes, this is a critical issue. So, I request to catch the stable tag.
>>
>> Andrei who reported this issue has verified the fix and helped with
>> review.
>>
>> https://edk2.groups.io/g/devel/message/100496
>>
>> Thanks!
>> Sunil
>>
>>
>>
>>
>
>
>
>
> 
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-02  6:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-25  5:32 [edk2-stable202302 PATCH V2 1/1] OvmfPkg/RiscVVirt: Add Stack HOB Sunil V L
2023-02-28  6:43 ` 回复: " gaoliming
2023-02-28  6:47   ` [edk2-devel] " Sunil V L
2023-03-01 14:47     ` 回复: " gaoliming
2023-03-02  6:50       ` Sunil V L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox