public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, guomin.jiang@intel.com
Cc: Michael Kubacki <michael.a.kubacki@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>, Dandan Bi <dandan.bi@intel.com>,
	Liming Gao <liming.gao@intel.com>,
	Debkumar De <debkumar.de@intel.com>,
	Harry Han <harry.han@intel.com>,
	Catharine West <catharine.west@intel.com>
Subject: Re: [edk2-devel] [PATCH v4 2/9] MdeModulePkg/PeiCore: Enable T-RAM evacuation in PeiCore (CVE-2019-11098)
Date: Wed, 8 Jul 2020 19:13:01 +0200	[thread overview]
Message-ID: <0558be59-abf9-5ad4-5439-f55b41758ef7@redhat.com> (raw)
In-Reply-To: <20200708081059.691-3-guomin.jiang@intel.com>

Hi Guomin,

On 07/08/20 10:10, Guomin Jiang wrote:

[...]

>  7. Add PcdMigrateTemporaryRamFirmwareVolumes to control if enable the
>     feature or not. when the PCD disable, 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()

[...]

> diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
> index cca57c4c0686..7be6e9f3b06c 100644
> --- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
> +++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
> @@ -176,6 +176,7 @@ PeiCore (
>    EFI_HOB_HANDOFF_INFO_TABLE  *HandoffInformationTable;
>    EFI_PEI_TEMPORARY_RAM_DONE_PPI *TemporaryRamDonePpi;
>    UINTN                       Index;
> +  BOOLEAN                     Shadow;
>  
>    //
>    // Retrieve context passed into PEI Core
> @@ -418,6 +419,27 @@ PeiCore (
>        ProcessPpiListFromSec ((CONST EFI_PEI_SERVICES **) &PrivateData.Ps, PpiList);
>      }
>    } else {
> +    if (PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes)) {
> +      if (PrivateData.HobList.HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME) {
> +        Shadow = PcdGetBool (PcdShadowPeimOnS3Boot);
> +      } else {
> +        Shadow = PcdGetBool (PcdShadowPeimOnBoot);
> +      }
> +    }
> +
> +    if (Shadow) {
> +      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.
>      //

[...]

this is almost good, from my perspective, but you forgot to initialize
Shadow to FALSE. That's a problem because, if
PcdMigrateTemporaryRamFirmwareVolumes is FALSE, then Shadow is never
assigned (it will have an indeterminate value).

In my review here:

  https://edk2.groups.io/g/devel/message/62029

I inculded

  Shadow = FALSE;

too.

Please include this assignment either at the top of the function, or
just before you fetch "PcdMigrateTemporaryRamFirmwareVolumes".

Thanks!
Laszlo


  reply	other threads:[~2020-07-08 17:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08  8:10 [PATCH v4 0/9] Add new feature that evacuate temporary to permanent memory (CVE-2019-11098) Guomin Jiang
2020-07-08  8:10 ` [PATCH v4 1/9] MdeModulePkg: Add new PCD to control the evacuate temporary memory feature (CVE-2019-11098) Guomin Jiang
2020-07-08 17:03   ` [edk2-devel] " Laszlo Ersek
2020-07-08  8:10 ` [PATCH v4 2/9] MdeModulePkg/PeiCore: Enable T-RAM evacuation in PeiCore (CVE-2019-11098) Guomin Jiang
2020-07-08 17:13   ` Laszlo Ersek [this message]
2020-07-08  8:10 ` [PATCH v4 3/9] UefiCpuPkg/CpuMpPei: Add GDT and IDT migration support (CVE-2019-11098) Guomin Jiang
2020-07-08 17:23   ` [edk2-devel] " Laszlo Ersek
2020-07-08  8:10 ` [PATCH v4 4/9] UefiCpuPkg/SecMigrationPei: Add initial PEIM (CVE-2019-11098) Guomin Jiang
2020-07-08 17:35   ` [edk2-devel] " Laszlo Ersek
2020-07-08  8:10 ` [PATCH v4 5/9] MdeModulePkg/Core: Create Migrated FV Info Hob for calculating hash (CVE-2019-11098) Guomin Jiang
2020-07-08 17:29   ` [edk2-devel] " Laszlo Ersek
2020-07-08  8:10 ` [PATCH v4 6/9] SecurityPkg/Tcg2Pei: Use " Guomin Jiang
2020-07-08  8:10 ` [PATCH v4 7/9] UefiCpuPkg/CpuMpPei: Enable paging and set NP flag to avoid TOCTOU (CVE-2019-11098) Guomin Jiang
2020-07-08 17:54   ` [edk2-devel] " Laszlo Ersek
2020-07-08  8:10 ` [PATCH v4 8/9] UefiCpuPkg: Correct some typos Guomin Jiang
2020-07-08 18:02   ` [edk2-devel] " Laszlo Ersek
2020-07-08  8:10 ` [PATCH v4 9/9] SecurityPkg/TcgPei: Use Migrated FV Info Hob for calculating hash (CVE-2019-11098) Guomin Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0558be59-abf9-5ad4-5439-f55b41758ef7@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox