Revision: 18849
http://sourceforge.net/p/edk2/code/18849
Author: vanjeff
Date: 2015-11-17 05:13:43 +0000 (Tue, 17 Nov 2015)
Log Message:
-----------
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.
(Sync patch r18715 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/18715
Modified Paths:
--------------
branches/UDK2015/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
Modified: branches/UDK2015/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
===================================================================
--- branches/UDK2015/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c 2015-11-17
05:12:32 UTC (rev 18848)
+++ branches/UDK2015/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c 2015-11-17
05:13:43 UTC (rev 18849)
@@ -1386,7 +1386,7 @@
//
// 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 @@
// 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
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits