]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CommonFeature: Always set FEATURE_CONTROL.Lock
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 13 Nov 2018 07:34:33 +0000 (15:34 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 14 Nov 2018 03:02:48 +0000 (11:02 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1305

The patch reverts commit 1ed6498c4a0210204bf4b95cc0c0cd6623ad6a0b
* UefiCpuPkg/CommonFeature: Skip locking when the feature is disabled

FEATURE_CONTROL.Lock bit is controlled by feature
CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER. The commit 1ed649 fixes
a bug that when the feature is disabled, the Lock bit is cleared.
But it's a security hole if the bit is cleared when booting OS.
We can argue that platform needs to make sure the value
of PcdCpuFeaturesUserConfiguration should be set properly to make
sure feature CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER is enabled.

But it's better to guarantee this in the generic core code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c

index 631c83685706cd00d8eb9451906206dc33ba478d..8c1eb5eb4f80a1996b177a8b2ee4d559a8598d23 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Features in MSR_IA32_FEATURE_CONTROL register.\r
 \r
-  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -184,15 +184,6 @@ LockFeatureControlRegisterInitialize (
 {\r
   MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;\r
 \r
-  //\r
-  // When Lock Feature Control Register feature is disabled,\r
-  // just skip the MSR lock bit setting.\r
-  // The MSR lock bit is cleared by default and write-once in a boot.\r
-  //\r
-  if (!State) {\r
-    return RETURN_SUCCESS;\r
-  }\r
-\r
   //\r
   // The scope of Lock bit in the MSR_IA32_FEATURE_CONTROL is core for\r
   // below processor type, only program MSR_IA32_FEATURE_CONTROL for thread 0 in each\r