From 6676162f64ad39949ed44f17ce40e5c49ab33e31 Mon Sep 17 00:00:00 2001 From: Ray Ni Date: Fri, 10 Jun 2022 16:43:32 +0800 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 Reviewed-by: Jian J Wang Cc: Liming Gao --- 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.39.2