[edk2] [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: fix incorrect init of exception stack

Jian J Wang posted 1 patch 6 years, 1 month ago
Failed in applying to current master (apply log)
UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2] [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: fix incorrect init of exception stack
Posted by Jian J Wang 6 years, 1 month ago
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>
---
 UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
index 6d1b54d31d..2a090782fc 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
@@ -270,7 +270,7 @@ InitializeCpuExceptionHandlersEx (
         AsmReadGdtr (&Gdtr);
 
         EssData.X64.Revision = CPU_EXCEPTION_INIT_DATA_REV;
-        EssData.X64.KnownGoodStackTop = (UINTN)mNewStack;
+        EssData.X64.KnownGoodStackTop = (UINTN)mNewStack + sizeof (mNewStack);
         EssData.X64.KnownGoodStackSize = CPU_KNOWN_GOOD_STACK_SIZE;
         EssData.X64.StackSwitchExceptions = CPU_STACK_SWITCH_EXCEPTION_LIST;
         EssData.X64.StackSwitchExceptionNumber = CPU_STACK_SWITCH_EXCEPTION_NUMBER;
-- 
2.15.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: fix incorrect init of exception stack
Posted by Laszlo Ersek 6 years, 1 month ago
On 02/27/18 06:19, Jian J Wang wrote:
> 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>
> ---
>  UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
> index 6d1b54d31d..2a090782fc 100644
> --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
> +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeException.c
> @@ -270,7 +270,7 @@ InitializeCpuExceptionHandlersEx (
>          AsmReadGdtr (&Gdtr);
>  
>          EssData.X64.Revision = CPU_EXCEPTION_INIT_DATA_REV;
> -        EssData.X64.KnownGoodStackTop = (UINTN)mNewStack;
> +        EssData.X64.KnownGoodStackTop = (UINTN)mNewStack + sizeof (mNewStack);
>          EssData.X64.KnownGoodStackSize = CPU_KNOWN_GOOD_STACK_SIZE;
>          EssData.X64.StackSwitchExceptions = CPU_STACK_SWITCH_EXCEPTION_LIST;
>          EssData.X64.StackSwitchExceptionNumber = CPU_STACK_SWITCH_EXCEPTION_NUMBER;
> 

Can you add the following to the commit message?

Fixes: 0ff5aa9cae1ea276668fa4398d047aa9fda3c2c7

With that,

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel