audk/UefiCpuPkg
Jeff Fan f6b0cb17b1 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
2015-11-02 03:04:19 +00:00
..
CpuDxe UefiCpuPkg: CpuDxe: Update GDT to be consistent with DxeIplPeim 2015-10-30 17:32:27 +00:00
CpuIo2Dxe UefiCpuPkg: Convert non DOS format files to DOS format 2014-09-03 08:48:53 +00:00
CpuIo2Smm UefiCpuPkg: Convert non DOS format files to DOS format 2014-09-03 08:48:53 +00:00
CpuIoPei UefiCpuPkg: Convert non DOS format files to DOS format 2014-09-03 08:48:53 +00:00
CpuMpPei UefiCpuPkg: Add Cpuid.h include files for CPUID related defines 2015-10-19 19:09:15 +00:00
Include UefiCpuPkg: LocalApicLib: Add API to set SoftwareEnable bit 2015-10-30 17:53:31 +00:00
Library UefiCpuPkg: LocalApicLib: Add API to set SoftwareEnable bit 2015-10-30 17:53:31 +00:00
PiSmmCommunication UefiCpuPkg: Add SMM Communication PPI and Handler Modules 2015-10-19 19:09:33 +00:00
PiSmmCpuDxeSmm UefiCpuPkg/PiSmmCpuDxeSmm: Shouldn't use gSmst->CurrentlyExecutingCpu 2015-11-02 03:04:19 +00:00
ResetVector UefiCpuPkg: Convert non DOS format files to DOS format 2014-09-03 08:48:53 +00:00
SecCore UefiCpuPkg: Add SecCore module 2015-10-19 19:10:14 +00:00
Universal/Acpi/S3Resume2Pei UefiCpuPkg S3Resume2Pei: Fix ASSERT in WriteToOsS3PerformanceData 2015-07-13 01:24:24 +00:00
Contributions.txt */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
License.txt Update copyright format 2012-04-24 06:49:39 +00:00
UefiCpuPkg.dec UefiCpuPkg: Add PiSmmCpuDxeSmm module no IA32/X64 files 2015-10-19 19:12:53 +00:00
UefiCpuPkg.dsc UefiCpuPkg: PiSmmCpuDxeSmm: Remove unused references to SmmLib 2015-10-26 16:40:52 +00:00
UefiCpuPkg.uni UefiCpuPkg: Add PiSmmCpuDxeSmm module no IA32/X64 files 2015-10-19 19:12:53 +00:00
UefiCpuPkgExtra.uni UefiCpuPkg: INF/DEC file updates to EDK II packages 2014-08-28 05:12:05 +00:00