diff options
author | Jeff Fan <jeff.fan@intel.com> | 2015-11-02 03:04:19 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-11-02 03:04:19 +0000 |
commit | f6b0cb17b1b0edff35b2e73e3bc9085769f13eca (patch) | |
tree | fc000a416eb9093426f2c1b8a9580a7438f5837b | |
parent | 32c8c88df50e0757a3fddfe9c81b54d266a6d4e7 (diff) | |
download | edk2-f6b0cb17b1b0edff35b2e73e3bc9085769f13eca.tar.gz edk2-f6b0cb17b1b0edff35b2e73e3bc9085769f13eca.tar.bz2 edk2-f6b0cb17b1b0edff35b2e73e3bc9085769f13eca.zip |
UefiCpuPkg/PiSmmCpuDxeSmm: Shouldn't use gSmst->CurrentlyExecutingCpu
In ConfigSmmCodeAccessCheck(), we used gSmst->CurrentlyExecutingCpu to get the
current SMM BSP. But ConfigSmmCodeAccessCheck() maybe invoked before executing
SmmCoreEntry() and gSmst->CurrentlyExecutingCpu hasn't been updated to the
latest value. The code flow is as below:
BSPHandler()
gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu = CpuIndex;
//
// when mRestoreSmmConfigurationInS3 is set:
//
ConfigSmmCodeAccessCheck()
//
// reads gSmst->CurrentlyExecutingCpu to early
//
gSmmCpuPrivate->SmmCoreEntry (&gSmmCpuPrivate->SmmCoreEntryContext)
//
// sets gSmst->CurrentlyExecutingCpu with CopyMem() too late
//
CopyMem (&gSmmCoreSmst.SmmStartupThisAp,
SmmEntryContext, sizeof (EFI_SMM_ENTRY_CONTEXT));
Instead, we should use
gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu directly.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18715 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c index e210c8d446..c351875262 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -1386,7 +1386,7 @@ ConfigSmmCodeAccessCheck ( //
// Check to see if the Feature Control MSR is supported on this CPU
//
- Index = gSmst->CurrentlyExecutingCpu;
+ Index = gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu;
if (!SmmCpuFeaturesIsSmmRegisterSupported (Index, SmmRegFeatureControl)) {
mSmmCodeAccessCheckEnable = FALSE;
return;
@@ -1428,7 +1428,7 @@ ConfigSmmCodeAccessCheck ( // Enable SMM Code Access Check feature for the APs.
//
for (Index = 0; Index < gSmst->NumberOfCpus; Index++) {
- if (Index != gSmst->CurrentlyExecutingCpu) {
+ if (Index != gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu) {
//
// Acquire Config SMM Code Access Check spin lock. The AP will release the
|