Reviewed-by: Star Zeng <[email protected]> -----Original Message----- From: Wang, Jian J Sent: Thursday, September 28, 2017 9:04 AM To: [email protected] Cc: Wang, Jian J <[email protected]>; Zeng, Star <[email protected]>; Dong, Eric <[email protected]>; Laszlo Ersek <[email protected]>; Yao, Jiewen <[email protected]>; Kinney, Michael D <[email protected]>; Justen, Jordan L <[email protected]>; Wolman, Ayellet <[email protected]> Subject: [PATCH v3 1/6] MdeModulePkg/MdeModulePkg.dec,.uni: Add NULL pointer detection PCD
From: "Wang, Jian J" <[email protected]> > According to Star's feedback, add prompt and help string in uni file PCD PcdNullPointerDetectionPropertyMask is a bitmask used to control the NULL address detection functionality in code for different phases. If enabled, accessing NULL address in UEFI or SMM code can be caught as a page fault exception. BIT0 - Enable NULL pointer detection for UEFI. BIT1 - Enable NULL pointer detection for SMM. BIT2..6 - Reserved for future uses. BIT7 - Disable NULL pointer detection just after EndOfDxe. This is a workaround for those unsolvable NULL access issues in OptionROM, boot loader, etc. It can also help to avoid unnecessary exception caused by legacy memory (0-4095) access after EndOfDxe, such as Windows 7 boot on Qemu. Cc: Star Zeng <[email protected]> Cc: Eric Dong <[email protected]> Cc: Laszlo Ersek <[email protected]> Cc: Jiewen Yao <[email protected]> Cc: Michael Kinney <[email protected]> Cc: Jordan Justen <[email protected]> Cc: Ayellet Wolman <[email protected]> Suggested-by: Ayellet Wolman <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <[email protected]> --- MdeModulePkg/MdeModulePkg.dec | 13 +++++++++++++ MdeModulePkg/MdeModulePkg.uni | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index a3c0633ee1..9248d10da8 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -867,6 +867,19 @@ # @ValidList 0x80000006 | 0x03058002 gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable|0x03058002|UINT32|0x30001040 + ## Mask to control the NULL address detection in code for different phases. + # If enabled, accessing NULL address in UEFI or SMM code can be caught.<BR><BR> + # BIT0 - Enable NULL pointer detection for UEFI.<BR> + # BIT1 - Enable NULL pointer detection for SMM.<BR> + # BIT2..6 - Reserved for future uses.<BR> + # BIT7 - Disable NULL pointer detection just after EndOfDxe. <BR> + # This is a workaround for those unsolvable NULL access issues in + # OptionROM, boot loader, etc. It can also help to avoid unnecessary + # exception caused by legacy memory (0-4095) access after EndOfDxe, + # such as Windows 7 boot on Qemu.<BR> + # @Prompt Enable NULL address detection. + + gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask|0x0 + |UINT8|0x30001050 + [PcdsFixedAtBuild, PcdsPatchableInModule] ## Dynamic type PCD can be registered callback function for Pcd setting action. # PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni index d6015de75f..f8b31694ba 100644 --- a/MdeModulePkg/MdeModulePkg.uni +++ b/MdeModulePkg/MdeModulePkg.uni @@ -1127,3 +1127,16 @@ "enabled on AMD processors supporting the Secure Encrypted Virtualization (SEV) feature.\n" "This mask should be applied when creating 1:1 virtual to physical mapping tables." +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNullPointerDetectionPropertyMask_PROMPT #language en-US "Enable NULL pointer detection" + +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNullPointerDetectionPropertyMask_HELP #language en-US "Mask to control the NULL address detection in code for different phases.\n" + " If enabled, accessing NULL address in UEFI or SMM code can be caught.\n\n" + " BIT0 - Enable NULL pointer detection for UEFI.\n" + " BIT1 - Enable NULL pointer detection for SMM.\n" + " BIT2..6 - Reserved for future uses.\n" + " BIT7 - Disable NULL pointer detection just after EndOfDxe." + " This is a workaround for those unsolvable NULL access issues in" + " OptionROM, boot loader, etc. It can also help to avoid unnecessary" + " exception caused by legacy memory (0-4095) access after EndOfDxe," + " such as Windows 7 boot on Qemu.\n" + -- 2.14.1.windows.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

