[edk2-devel] [PATCH 1/2] MdeModulePkg/dec: update the PcdCpuStackGuard property

Chen, Gang C posted 2 patches 3 years, 10 months ago
[edk2-devel] [PATCH 1/2] MdeModulePkg/dec: update the PcdCpuStackGuard property
Posted by Chen, Gang C 3 years, 10 months ago
Update the PcdCpuStackGuard from PcdsFixedAtBuild to PcdsDynamicEx
for the requirement to set different value in FSP API mode and FSP
Dispatch mode.

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

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: devel@edk2.groups.io

Signed-off-by: Gang Chen <gang.c.chen@intel.com>
---
 MdeModulePkg/MdeModulePkg.dec | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 463e889e9a..72e7e2eced 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1070,13 +1070,6 @@
   # @Prompt The Heap Guard feature mask
   gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask|0x0|UINT8|0x30001054
 
-  ## Indicates if UEFI Stack Guard will be enabled.
-  #  If enabled, stack overflow in UEFI can be caught, preventing chaotic consequences.<BR><BR>
-  #   TRUE  - UEFI Stack Guard will be enabled.<BR>
-  #   FALSE - UEFI Stack Guard will be disabled.<BR>
-  # @Prompt Enable UEFI Stack Guard.
-  gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x30001055
-
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   ## Dynamic type PCD can be registered callback function for Pcd setting action.
   #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function
@@ -2079,6 +2072,13 @@
   # @Prompt Enable PCIe Resizable BAR Capability support.
   gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport|FALSE|BOOLEAN|0x10000024
 
+  ## Indicates if UEFI Stack Guard will be enabled.
+  #  If enabled, stack overflow in UEFI can be caught, preventing chaotic consequences.<BR><BR>
+  #   TRUE  - UEFI Stack Guard will be enabled.<BR>
+  #   FALSE - UEFI Stack Guard will be disabled.<BR>
+  # @Prompt Enable UEFI Stack Guard.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x00010025
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88692): https://edk2.groups.io/g/devel/message/88692
Mute This Topic: https://groups.io/mt/90391665/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/dec: update the PcdCpuStackGuard property
Posted by Ni, Ray 3 years, 10 months ago
FixedAtBuild PCD can be accessed at any time from any CPU.
But dynamic PCD can only be accessed from BSP and after PCD database is initialized.

This impact of this change is not as simple as what the patch does.

Why cannot FSP API and Dispatch mode use the same setting? (either enabled or disabled)

Thanks,
Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chen, Gang C
> Sent: Monday, April 11, 2022 6:14 PM
> To: devel@edk2.groups.io
> Cc: Jiang, Guomin <guomin.jiang@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Zhang, Di <di.zhang@intel.com>; Wang,
> Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
> Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/dec: update the PcdCpuStackGuard property
> 
> Update the PcdCpuStackGuard from PcdsFixedAtBuild to PcdsDynamicEx
> for the requirement to set different value in FSP API mode and FSP
> Dispatch mode.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3897
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: devel@edk2.groups.io
> 
> Signed-off-by: Gang Chen <gang.c.chen@intel.com>
> ---
>  MdeModulePkg/MdeModulePkg.dec | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
> index 463e889e9a..72e7e2eced 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -1070,13 +1070,6 @@
>    # @Prompt The Heap Guard feature mask
>    gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask|0x0|UINT8|0x30001054
> 
> -  ## Indicates if UEFI Stack Guard will be enabled.
> -  #  If enabled, stack overflow in UEFI can be caught, preventing chaotic consequences.<BR><BR>
> -  #   TRUE  - UEFI Stack Guard will be enabled.<BR>
> -  #   FALSE - UEFI Stack Guard will be disabled.<BR>
> -  # @Prompt Enable UEFI Stack Guard.
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x30001055
> -
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>    ## Dynamic type PCD can be registered callback function for Pcd setting action.
>    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function
> @@ -2079,6 +2072,13 @@
>    # @Prompt Enable PCIe Resizable BAR Capability support.
>    gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport|FALSE|BOOLEAN|0x10000024
> 
> +  ## Indicates if UEFI Stack Guard will be enabled.
> +  #  If enabled, stack overflow in UEFI can be caught, preventing chaotic consequences.<BR><BR>
> +  #   TRUE  - UEFI Stack Guard will be enabled.<BR>
> +  #   FALSE - UEFI Stack Guard will be disabled.<BR>
> +  # @Prompt Enable UEFI Stack Guard.
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x00010025
> +
>  [PcdsPatchableInModule]
>    ## Specify memory size with page number for PEI code when
>    #  Loading Module at Fixed Address feature is enabled.
> --
> 2.35.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88704): https://edk2.groups.io/g/devel/message/88704
Mute This Topic: https://groups.io/mt/90391665/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/dec: update the PcdCpuStackGuard property
Posted by Chen, Gang C 3 years, 10 months ago
This impact of this change is not as simple as what the patch does.
-->You're correct, that's why the PATCH 2/2 removed the check in AP.

Why cannot FSP API and Dispatch mode use the same setting? (either enabled or disabled)
-->For example, in coreboot, it's 32-bit, so there is no Paging needed. In this case, it needs to disable it for FSP API mode. But this feature is needed for Dispatch mode. 

@Liu, Shuo, if any information is wrong or missed, please correct me. Thanks.

Best Regards
Gang

-----Original Message-----
From: Ni, Ray <ray.ni@intel.com> 
Sent: Monday, April 11, 2022 9:55 PM
To: devel@edk2.groups.io; Chen, Gang C <gang.c.chen@intel.com>
Cc: Jiang, Guomin <guomin.jiang@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Zhang, Di <di.zhang@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
Subject: RE: [edk2-devel] [PATCH 1/2] MdeModulePkg/dec: update the PcdCpuStackGuard property

FixedAtBuild PCD can be accessed at any time from any CPU.
But dynamic PCD can only be accessed from BSP and after PCD database is initialized.

This impact of this change is not as simple as what the patch does.

Why cannot FSP API and Dispatch mode use the same setting? (either enabled or disabled)

Thanks,
Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chen, 
> Gang C
> Sent: Monday, April 11, 2022 6:14 PM
> To: devel@edk2.groups.io
> Cc: Jiang, Guomin <guomin.jiang@intel.com>; Bi, Dandan 
> <dandan.bi@intel.com>; Zhang, Di <di.zhang@intel.com>; Wang, Jian J 
> <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
> Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/dec: update the 
> PcdCpuStackGuard property
> 
> Update the PcdCpuStackGuard from PcdsFixedAtBuild to PcdsDynamicEx for 
> the requirement to set different value in FSP API mode and FSP 
> Dispatch mode.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3897
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: devel@edk2.groups.io
> 
> Signed-off-by: Gang Chen <gang.c.chen@intel.com>
> ---
>  MdeModulePkg/MdeModulePkg.dec | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/MdeModulePkg/MdeModulePkg.dec 
> b/MdeModulePkg/MdeModulePkg.dec index 463e889e9a..72e7e2eced 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -1070,13 +1070,6 @@
>    # @Prompt The Heap Guard feature mask
>    
> gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask|0x0|UINT8|0x30
> 001054
> 
> -  ## Indicates if UEFI Stack Guard will be enabled.
> -  #  If enabled, stack overflow in UEFI can be caught, preventing chaotic consequences.<BR><BR>
> -  #   TRUE  - UEFI Stack Guard will be enabled.<BR>
> -  #   FALSE - UEFI Stack Guard will be disabled.<BR>
> -  # @Prompt Enable UEFI Stack Guard.
> -  
> gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x300010
> 55
> -
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>    ## Dynamic type PCD can be registered callback function for Pcd setting action.
>    #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum 
> number of callback function @@ -2079,6 +2072,13 @@
>    # @Prompt Enable PCIe Resizable BAR Capability support.
>    
> gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport|FALSE|BOOLEA
> N|0x10000024
> 
> +  ## Indicates if UEFI Stack Guard will be enabled.
> +  #  If enabled, stack overflow in UEFI can be caught, preventing chaotic consequences.<BR><BR>
> +  #   TRUE  - UEFI Stack Guard will be enabled.<BR>
> +  #   FALSE - UEFI Stack Guard will be disabled.<BR>
> +  # @Prompt Enable UEFI Stack Guard.
> +  
> + gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x0001
> + 0025
> +
>  [PcdsPatchableInModule]
>    ## Specify memory size with page number for PEI code when
>    #  Loading Module at Fixed Address feature is enabled.
> --
> 2.35.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88705): https://edk2.groups.io/g/devel/message/88705
Mute This Topic: https://groups.io/mt/90391665/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-