public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] DxeMain: Fix the bug that StackGuard is not enabled
@ 2022-06-10  8:49 Ni, Ray
  2022-06-11 14:20 ` Wang, Jian J
  0 siblings, 1 reply; 2+ messages in thread
From: Ni, Ray @ 2022-06-10  8:49 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Liming Gao

Commit e7abb94d1 removed InitializeCpuExceptionHandlersEx
and updated DxeMain to call InitializeCpuExceptionHandlers
for exception setup. But the old behavior that calls *Ex() sets
up the stack guard as well. To match the old behavior,
the patch calls InitializeSeparateExceptionStacks.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index 83f49d7c00..0a1f3d79e2 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -256,6 +256,14 @@ DxeMain (
   Status = InitializeCpuExceptionHandlers (VectorInfoList);
   ASSERT_EFI_ERROR (Status);
 
+  //
+  // Setup Stack Guard
+  //
+  if (PcdGetBool (PcdCpuStackGuard)) {
+    Status = InitializeSeparateExceptionStacks (NULL);
+    ASSERT_EFI_ERROR (Status);
+  }
+
   //
   // Initialize Debug Agent to support source level debug in DXE phase
   //
-- 
2.35.1.windows.2


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

* Re: [PATCH] DxeMain: Fix the bug that StackGuard is not enabled
  2022-06-10  8:49 [PATCH] DxeMain: Fix the bug that StackGuard is not enabled Ni, Ray
@ 2022-06-11 14:20 ` Wang, Jian J
  0 siblings, 0 replies; 2+ messages in thread
From: Wang, Jian J @ 2022-06-11 14:20 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io; +Cc: Gao, Liming

Reviewed-by: Jian J Wang <jian.j.wang@intel.com>

Regards,
Jian

> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Friday, June 10, 2022 4:50 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>
> Subject: [PATCH] DxeMain: Fix the bug that StackGuard is not enabled
> 
> Commit e7abb94d1 removed InitializeCpuExceptionHandlersEx
> and updated DxeMain to call InitializeCpuExceptionHandlers
> for exception setup. But the old behavior that calls *Ex() sets
> up the stack guard as well. To match the old behavior,
> the patch calls InitializeSeparateExceptionStacks.
> 
> Signed-off-by: Ray Ni <ray.ni@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> ---
>  MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> index 83f49d7c00..0a1f3d79e2 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
> @@ -256,6 +256,14 @@ DxeMain (
>    Status = InitializeCpuExceptionHandlers (VectorInfoList);
> 
>    ASSERT_EFI_ERROR (Status);
> 
> 
> 
> +  //
> 
> +  // Setup Stack Guard
> 
> +  //
> 
> +  if (PcdGetBool (PcdCpuStackGuard)) {
> 
> +    Status = InitializeSeparateExceptionStacks (NULL);
> 
> +    ASSERT_EFI_ERROR (Status);
> 
> +  }
> 
> +
> 
>    //
> 
>    // Initialize Debug Agent to support source level debug in DXE phase
> 
>    //
> 
> --
> 2.35.1.windows.2


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

end of thread, other threads:[~2022-06-11 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-10  8:49 [PATCH] DxeMain: Fix the bug that StackGuard is not enabled Ni, Ray
2022-06-11 14:20 ` Wang, Jian J

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