From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: michael.d.kinney@intel.com) Received: from mga04.intel.com (mga04.intel.com []) by groups.io with SMTP; Mon, 29 Apr 2019 18:30:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Apr 2019 18:30:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,411,1549958400"; d="scan'208";a="139954329" Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.111.157]) by orsmga006.jf.intel.com with ESMTP; 29 Apr 2019 18:30:14 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Liming Gao Subject: [Patch V2 1/6] MdePkg: Add PcdSpeculationBarrierType Date: Mon, 29 Apr 2019 18:30:07 -0700 Message-Id: <20190430013012.24008-2-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190430013012.24008-1-michael.d.kinney@intel.com> References: <20190430013012.24008-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType that uses the PCD type FixedAtBuild. This performs a build time selection for the type of speculation barrier to use in the BaseLib function SpeculationBarrier(). The recommended speculation barrier for x86 is LFENCE and this is the default value for this PCD. x86 CPUs that do not support LFENCE must select one of the other supported values which includes CPUID and nothing. Cc: Liming Gao Signed-off-by: Michael D Kinney --- MdePkg/MdePkg.dec | 9 +++++++++ MdePkg/MdePkg.uni | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index e2ea8fff66..28d4a966c2 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -2062,6 +2062,15 @@ [PcdsFixedAtBuild] # @Prompt Enable control flow enforcement. gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask|0x0|UINT32|0x30001017 + ## Indicates the type of instruction sequence to use for a speculation + # barrier. The default instruction sequence is LFENCE.

+ # 0x00 - No operation.
+ # 0x01 - LFENCE (IA32/X64).
+ # 0x02 - CPUID (IA32/X64).
+ # Other - reserved + # @Prompt Speculation Barrier Type. + gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x01|UINT8|0x30001018 + [PcdsFixedAtBuild,PcdsPatchableInModule] ## Indicates the maximum length of unicode string used in the following # BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), StrnCpy()

diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni index c359bb4b5b..5c1fa24065 100644 --- a/MdePkg/MdePkg.uni +++ b/MdePkg/MdePkg.uni @@ -149,6 +149,14 @@ " BIT0 - SMM CET Shadow Stack is enabled.
\n" " Other - reserved" +#string STR_gEfiMdePkgTokenSpaceGuid_PcdSpeculationBarrierType_PROMPT #language en-US "Speculation Barrier Type." + +#string STR_gEfiMdePkgTokenSpaceGuid_PcdSpeculationBarrierType_HELP #language en-US "Indicates the type of instruction sequence to use for a speculation.barrier. The default instruction sequence is LFENCE.

\n" + "0x00 - No operation.
\n" + "0x01 - LFENCE (IA32/X64).
\n" + "0x02 - CPUID (IA32/X64).
\n" + "Other - reserved" + #string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumAsciiStringLength_PROMPT #language en-US "Maximum Length of Ascii String" #string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumAsciiStringLength_HELP #language en-US "Sets the maximum number of ASCII characters used for string functions. This affects the following BaseLib functions: AsciiStrLen(), AsciiStrSize(), AsciiStrCmp(), AsciiStrnCmp(), AsciiStrCpy(), AsciiStrnCpy().

\n" -- 2.21.0.windows.1