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>,
	Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
	Rahul Kumar <rahul1.kumar@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 4/9] UefiCpuPkg/SecMigrationPei: Add initial PEIM (CVE-2019-11098)
Date: Wed, 8 Jul 2020 19:35:33 +0200	[thread overview]
Message-ID: <a940dd9e-e149-e810-120f-95478934907f@redhat.com> (raw)
In-Reply-To: <20200708081059.691-5-guomin.jiang@intel.com>

On 07/08/20 10:10, Guomin Jiang wrote:
> From: Michael Kubacki <michael.a.kubacki@intel.com>
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1614
> 
> Adds a PEIM that republishes structures produced in SEC. This
> is done because SEC modules may not be shadowed in some platforms
> due to space constraints or special alignment requirements. The
> SecMigrationPei module locates interfaces that may be published in
> SEC and reinstalls the interface with permanent memory addresses.
> 
> This is important if pre-memory address access is forbidden after
> memory initialization and data such as a PPI descriptor, PPI GUID,
> or PPI inteface reside in pre-memory.

[...]

> +EFI_STATUS
> +EFIAPI
> +SecMigrationPeiInitialize (
> +  IN EFI_PEI_FILE_HANDLE     FileHandle,
> +  IN CONST EFI_PEI_SERVICES  **PeiServices
> +  )
> +{
> +  EFI_STATUS  Status = EFI_SUCCESS;
> +
> +  if (PcdGetBool (PcdMigrateTemporaryRamFirmwareVolumes)) {
> +    Status = PeiServicesInstallPpi (&mEdkiiRepublishSecPpiDescriptor);
> +    ASSERT_EFI_ERROR (Status);
> +  }
> +
> +  return Status;
> +}

Thank you for squashing the PCD check into the patch that introduces the
PEIM.

I have two superficial comments:

(a) In the edk2 coding style, we don't initialize local variables
(meaning "initialization" in the strict C language sense). That is,

  EFI_STATUS  Status = EFI_whatever;

should be replaced with

  EFI_STATUS Status;

  Status = EFI_whatever;

(b) If the PCD is false (and so we don't install the PPI), then keeping
the PEIM loaded seems useless. When a module determines that it should
not stay resident (because it does not expose services to other
modules), it usually returns EFI_ABORTED or something similar from the
entry point function. Then the PEI or DXE (or SMM) core unloads the
module at once.

Therefore I think it would make sense to set Status to EFI_ABORTED,
before the PCD check.

With (a) and (b) updated:

Acked-by: Laszlo Ersek <lersek@redhat.com>

Thanks
Laszlo


  reply	other threads:[~2020-07-08 17:35 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   ` [edk2-devel] " Laszlo Ersek
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   ` Laszlo Ersek [this message]
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=a940dd9e-e149-e810-120f-95478934907f@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