From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.716.1571632103176489827 for ; Sun, 20 Oct 2019 21:28:23 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: jiewen.yao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Oct 2019 21:28:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,322,1566889200"; d="scan'208";a="397208144" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 20 Oct 2019 21:28:21 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 20 Oct 2019 21:28:21 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 20 Oct 2019 21:28:21 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 20 Oct 2019 21:28:21 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.176]) by SHSMSX151.ccr.corp.intel.com ([10.239.6.50]) with mapi id 14.03.0439.000; Mon, 21 Oct 2019 12:28:19 +0800 From: "Yao, Jiewen" To: "Gao, Liming" , "devel@edk2.groups.io" , "vit9696@protonmail.com" CC: "Wang, Jian J" , "Kinney, Michael D" Subject: Re: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe string constraint assertions Thread-Topic: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe string constraint assertions Thread-Index: AQHVh0clhHkPnZEQBE+EyRmVJ9DPH6dj50MAgACZCQA= Date: Mon, 21 Oct 2019 04:28:19 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503F80B477@shsmsx102.ccr.corp.intel.com> References: <20191020130553.42851-1-vit9696@protonmail.com> <20191020130553.42851-2-vit9696@protonmail.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E51F6EB@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E51F6EB@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzQyYzMwYWEtZjM1NS00YWI5LTk1YzEtNDczMGJhZmI5MjRhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNWorOURJMUgxdVpkREFJVVFKb290UHdybUxiU01Yb3NUN2dhZGJOWXNQd0JcLzk5RTluS0xZczhSXC9VcGtaVHFiIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jiewen.yao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Mike I remember we have discussed it before. The general concern is that: how many additional PCD we need introduce, to = control different ASSERT in different modules ? We may want to enable *some* assert in some modules, but disable *some othe= r* assert. E.g. the assert for linkedlist in base lib is another example... What is your thought? Thank you Yao Jiewen > -----Original Message----- > From: Gao, Liming > Sent: Monday, October 21, 2019 11:17 AM > To: devel@edk2.groups.io; vit9696@protonmail.com > Cc: Yao, Jiewen ; Wang, Jian J ; > Gao, Liming ; Kinney, Michael D > > Subject: RE: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe = string > constraint assertions >=20 > Include more people. >=20 > Basically, to keep the compatible behavior, PcdAssertOnSafeStringConstrai= nts > default value should be TRUE. > The different platform can configure it. >=20 > Thanks > Liming > >-----Original Message----- > >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > >Vitaly Cheptsov via Groups.Io > >Sent: Sunday, October 20, 2019 9:06 PM > >To: devel@edk2.groups.io > >Subject: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe str= ing > >constraint assertions > > > >REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2054 > > > >Runtime data checks are not meant to cause debug assertions > >unless explicitly needed by some debug code (thus the PCD) > >as this breaks debug builds validating data with BaseLib. > > > >Signed-off-by: Vitaly Cheptsov > > >--- > > MdePkg/MdePkg.dec | 6 ++++++ > > MdePkg/Library/BaseLib/BaseLib.inf | 11 ++++++----- > > MdePkg/Library/BaseLib/SafeString.c | 4 +++- > > MdePkg/MdePkg.uni | 6 ++++++ > > 4 files changed, 21 insertions(+), 6 deletions(-) > > > >diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec > >index 3fd7d1634c..dda2cdf401 100644 > >--- a/MdePkg/MdePkg.dec > >+++ b/MdePkg/MdePkg.dec > >@@ -2221,6 +2221,12 @@ [PcdsFixedAtBuild,PcdsPatchableInModule] > > # @Prompt Memory Address of GuidedExtractHandler Table. > > > >gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x10000 > >00|UINT64|0x30001015 > > > >+ ## Indicates if safe string constraint violation should assert.
> >+ # TRUE - Safe string constraint violation causes assertion.
> >+ # FALSE - Safe string constraint violation does not cause assertion= .
> >+ # @Prompt Enable safe string constraint violation assertions. > >+ > >gEfiMdePkgTokenSpaceGuid.PcdAssertOnSafeStringConstraints|FALSE|BOOL > >EAN|0x0000002e > >+ > > [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] > > ## This value is used to set the base address of PCI express hierarch= y. > > # @Prompt PCI Express Base Address. > >diff --git a/MdePkg/Library/BaseLib/BaseLib.inf > >b/MdePkg/Library/BaseLib/BaseLib.inf > >index 3586beb0ab..bc98bc6134 100644 > >--- a/MdePkg/Library/BaseLib/BaseLib.inf > >+++ b/MdePkg/Library/BaseLib/BaseLib.inf > >@@ -390,11 +390,12 @@ [LibraryClasses] > > BaseMemoryLib > > > > [Pcd] > >- gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength ## > >SOMETIMES_CONSUMES > >- gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ## > >SOMETIMES_CONSUMES > >- gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## > >SOMETIMES_CONSUMES > >- gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask > >## SOMETIMES_CONSUMES > >- gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType ## > >SOMETIMES_CONSUMES > >+ gEfiMdePkgTokenSpaceGuid.PcdAssertOnSafeStringConstraints ## > >SOMETIMES_CONSUMES > >+ gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength ## > >SOMETIMES_CONSUMES > >+ gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ## > >SOMETIMES_CONSUMES > >+ gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## > >SOMETIMES_CONSUMES > >+ gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask > >## SOMETIMES_CONSUMES > >+ gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType ## > >SOMETIMES_CONSUMES > > > > [FeaturePcd] > > gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList ## CONSUMES > >diff --git a/MdePkg/Library/BaseLib/SafeString.c > >b/MdePkg/Library/BaseLib/SafeString.c > >index 7dc03d2caa..56b5e34a8d 100644 > >--- a/MdePkg/Library/BaseLib/SafeString.c > >+++ b/MdePkg/Library/BaseLib/SafeString.c > >@@ -14,7 +14,9 @@ > > > > #define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status) \ > > do { \ > >- ASSERT (Expression); \ > >+ if (PcdGetBool (PcdAssertOnSafeStringConstraints)) { \ > >+ ASSERT (Expression); \ > >+ } \ > > if (!(Expression)) { \ > > return Status; \ > > } \ > >diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni > >index 5c1fa24065..425b66bb43 100644 > >--- a/MdePkg/MdePkg.uni > >+++ b/MdePkg/MdePkg.uni > >@@ -287,6 +287,12 @@ > > > > #string > >STR_gEfiMdePkgTokenSpaceGuid_PcdGuidedExtractHandlerTableAddress_H > >ELP #language en-US "This value is used to set the available memory add= ress > >to store Guided Extract Handlers. The required memory space is decided b= y > >the value of PcdMaximumGuidedExtractHandler." > > > >+#string > >STR_gEfiMdePkgTokenSpaceGuid_PcdAssertOnSafeStringConstraints_PROM > >PT #language en-US "Enable safe string constraint violation assertions" > >+ > >+#string > >STR_gEfiMdePkgTokenSpaceGuid_PcdAssertOnSafeStringConstraints_HELP > >#language en-US "Indicates if safe string constraint violation should > >assert.

\n" > >+ = "TRUE - Safe string constraint > >violation causes assertion.
\n" > >+ = "FALSE - Safe string constraint > >violation does not cause assertion.
" > >+ > > #string > >STR_gEfiMdePkgTokenSpaceGuid_PcdPciExpressBaseAddress_PROMPT > >#language en-US "PCI Express Base Address" > > > > #string STR_gEfiMdePkgTokenSpaceGuid_PcdPciExpressBaseAddress_HELP > >#language en-US "This value is used to set the base address of PCI expre= ss > >hierarchy." > >-- > >2.21.0 (Apple Git-122) > > > > > >-=3D-=3D-=3D-=3D-=3D-=3D > >Groups.io Links: You receive all messages sent to this group. > > > >View/Reply Online (#49255): https://edk2.groups.io/g/devel/message/49255 > >Mute This Topic: https://groups.io/mt/35943317/1759384 > >Group Owner: devel+owner@edk2.groups.io > >Unsubscribe: https://edk2.groups.io/g/devel/unsub [liming.gao@intel.com= ] > >-=3D-=3D-=3D-=3D-=3D-=3D