MdeModulePkg/PeiCore: Enable T-RAM evacuation in PeiCore (CVE-2019-11098)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1614 Introduces new changes to PeiCore to move the contents of temporary RAM visible to the PeiCore to permanent memory. This expands on pre-existing shadowing support in the PeiCore to perform the following additional actions: 1. Migrate pointers in PPIs installed in PeiCore to the permanent memory copy of PeiCore. 2. Copy all installed firmware volumes to permanent memory. 3. Relocate and fix up the PEIMs within the firmware volumes. 4. Convert all PPIs into the migrated firmware volume to the corresponding PPI address in the permanent memory location. This applies to PPIs and PEI notifications. 5. Convert all status code callbacks in the migrated firmware volume to the corresponding address in the permanent memory location. 6. Update the FV HOB to the corresponding firmware volume in permanent memory. 7. Use PcdMigrateTemporaryRamFirmwareVolumes to control if enable the feature or not. when disable the PCD, the EvacuateTempRam() will never be called. The function control flow as below: PeiCore() DumpPpiList() EvacuateTempRam() ConvertPeiCorePpiPointers() ConvertPpiPointersFv() MigratePeimsInFv() MigratePeim() PeiGetPe32Data() LoadAndRelocatePeCoffImageInPlace() MigrateSecModulesInFv() ConvertPpiPointersFv() ConvertStatusCodeCallbacks() ConvertFvHob() RemoveFvHobsInTemporaryMemory() DumpPpiList() Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Debkumar De <debkumar.de@intel.com> Cc: Harry Han <harry.han@intel.com> Cc: Catharine West <catharine.west@intel.com> Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
1facb8fdef
commit
9bedaec05b
@@ -319,8 +319,9 @@ PeiCore (
|
||||
// PEI Core and PEIMs to get high performance.
|
||||
//
|
||||
OldCoreData->ShadowedPeiCore = (PEICORE_FUNCTION_POINTER) (UINTN) PeiCore;
|
||||
if ((HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnS3Boot))
|
||||
|| (HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnBoot))) {
|
||||
if (PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes) ||
|
||||
(HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnS3Boot)) ||
|
||||
(HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnBoot))) {
|
||||
OldCoreData->ShadowedPeiCore = ShadowPeiCore (OldCoreData);
|
||||
}
|
||||
|
||||
@@ -418,6 +419,23 @@ PeiCore (
|
||||
ProcessPpiListFromSec ((CONST EFI_PEI_SERVICES **) &PrivateData.Ps, PpiList);
|
||||
}
|
||||
} else {
|
||||
if (PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes)) {
|
||||
//
|
||||
// When PcdMigrateTemporaryRamFirmwareVolumes is TRUE, alway shadow all
|
||||
// PEIMs no matter the condition of PcdShadowPeimOnBoot and PcdShadowPeimOnS3Boot
|
||||
//
|
||||
DEBUG ((DEBUG_VERBOSE, "PPI lists before temporary RAM evacuation:\n"));
|
||||
DumpPpiList (&PrivateData);
|
||||
|
||||
//
|
||||
// Migrate installed content from Temporary RAM to Permanent RAM
|
||||
//
|
||||
EvacuateTempRam (&PrivateData, SecCoreData);
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "PPI lists after temporary RAM evacuation:\n"));
|
||||
DumpPpiList (&PrivateData);
|
||||
}
|
||||
|
||||
//
|
||||
// Try to locate Temporary RAM Done Ppi.
|
||||
//
|
||||
|
Reference in New Issue
Block a user