]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuExceptionHandlerLib: fix incorrect init of exception stack
authorJian J Wang <jian.j.wang@intel.com>
Tue, 27 Feb 2018 01:04:23 +0000 (09:04 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 28 Feb 2018 07:30:26 +0000 (15:30 +0800)
This issue is introduced at following commit, which tried to add stack
switch support on behalf of Stack Guard feature.

    0ff5aa9cae1ea276668fa4398d047aa9fda3c2c7

The field KnownGoodStackTop in CPU_EXCEPTION_INIT_DATA is initialized to
the start address of array mNewStack. This is wrong. It must be the end
of mNewStack. This patch fixes this mistake.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c

index 6d1b54d31d3dc5b38dbc38a4570f364c12f0f115..2a090782fc22add2a6d500f477c4d81588c0e6c4 100644 (file)
@@ -270,7 +270,7 @@ InitializeCpuExceptionHandlersEx (
         AsmReadGdtr (&Gdtr);\r
 \r
         EssData.X64.Revision = CPU_EXCEPTION_INIT_DATA_REV;\r
-        EssData.X64.KnownGoodStackTop = (UINTN)mNewStack;\r
+        EssData.X64.KnownGoodStackTop = (UINTN)mNewStack + sizeof (mNewStack);\r
         EssData.X64.KnownGoodStackSize = CPU_KNOWN_GOOD_STACK_SIZE;\r
         EssData.X64.StackSwitchExceptions = CPU_STACK_SWITCH_EXCEPTION_LIST;\r
         EssData.X64.StackSwitchExceptionNumber = CPU_STACK_SWITCH_EXCEPTION_NUMBER;\r