From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 768AC2095E532 for ; Wed, 27 Sep 2017 20:32:03 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2017 20:35:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,448,1500966000"; d="scan'208";a="133061864" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 27 Sep 2017 20:35:17 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 27 Sep 2017 20:35:16 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 27 Sep 2017 20:35:16 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Thu, 28 Sep 2017 11:35:14 +0800 From: "Zeng, Star" To: "Wang, Jian J" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , Laszlo Ersek , "Yao, Jiewen" , "Kinney, Michael D" , "Justen, Jordan L" , "Wolman, Ayellet" , "Zeng, Star" Thread-Topic: [PATCH v3 1/6] MdeModulePkg/MdeModulePkg.dec,.uni: Add NULL pointer detection PCD Thread-Index: AQHTN/WyJJqcO9X6k0G72XE2VtcdpaLJpZUA Date: Thu, 28 Sep 2017 03:35:12 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B97BF11@shsmsx102.ccr.corp.intel.com> References: <20170928010353.11968-1-jian.j.wang@intel.com> <20170928010353.11968-2-jian.j.wang@intel.com> In-Reply-To: <20170928010353.11968-2-jian.j.wang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 1/6] MdeModulePkg/MdeModulePkg.dec, .uni: Add NULL pointer detection PCD X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 03:32:03 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Wang, Jian J=20 Sent: Thursday, September 28, 2017 9:04 AM To: edk2-devel@lists.01.org Cc: Wang, Jian J ; Zeng, Star ;= Dong, Eric ; Laszlo Ersek ; Yao, J= iewen ; Kinney, Michael D ; Justen, Jordan L ; Wolman, Ayellet Subject: [PATCH v3 1/6] MdeModulePkg/MdeModulePkg.dec,.uni: Add NULL pointe= r detection PCD From: "Wang, Jian J" > According to Star's feedback, add prompt and help string in uni file PCD PcdNullPointerDetectionPropertyMask is a bitmask used to control the NU= LL address detection functionality in code for different phases. If enabled, accessing NULL address in UEFI or SMM code can be caught as a p= age 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 Cc: Eric Dong Cc: Laszlo Ersek Cc: Jiewen Yao Cc: Michael Kinney Cc: Jordan Justen Cc: Ayellet Wolman Suggested-by: Ayellet Wolman Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang --- MdeModulePkg/MdeModulePkg.dec | 13 +++++++++++++ MdeModulePkg/MdeModulePk= g.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 =20 + ## Mask to control the NULL address detection in code for different phas= es. + # If enabled, accessing NULL address in UEFI or SMM code can be caught.=

+ # 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 iss= ues in + # OptionROM, boot loader, etc. It can also help to avoid un= necessary + # exception caused by legacy memory (0-4095) access after E= ndOfDxe, + # such as Windows 7 boot on Qemu.
+ # @Prompt Enable NULL address detection. + =20 + 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/MdeModulePk= g/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 v= irtual to physical mapping tables." =20 +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNullPointerDetectionProperty= Mask_PROMPT #language en-US "Enable NULL pointer detection" + +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNullPointerDetectionProperty= Mask_HELP #language en-US "Mask to control the NULL address detection in= code for different phases.\n" + = " If enabled, accessing NULL address in UEFI o= r SMM code can be caught.\n\n" + = " BIT0 - Enable NULL pointer detection fo= r UEFI.\n" + = " BIT1 - Enable NULL pointer detection fo= r SMM.\n" + = " BIT2..6 - Reserved for future uses.\n" + = " BIT7 - Disable NULL pointer detection j= ust after EndOfDxe." + = " This is a workaround for those unsolvable NU= LL access issues in" + = " OptionROM, boot loader, etc. It can also hel= p to avoid unnecessary" + = " exception caused by legacy memory (0-4095) a= ccess after EndOfDxe," + = " such as Windows 7 boot on Qemu.\n" + -- 2.14.1.windows.1