public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wang, Jian J" <jian.j.wang@intel.com>
To: "Bi, Dandan" <dandan.bi@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Gao, Liming" <liming.gao@intel.com>, "Dong, Eric" <eric.dong@intel.com>
Subject: Re: [patch] MdeModulePkg/HiiDB: Remove configuration table when it's freed (CVE-2019-14586)
Date: Thu, 13 Feb 2020 04:05:24 +0000	[thread overview]
Message-ID: <D827630B58408649ACB04F44C510003625A0D9A5@SHSMSX107.ccr.corp.intel.com> (raw)
In-Reply-To: <20200213040303.53336-1-dandan.bi@intel.com>

Reviewed-by: Jian J Wang <jian.j.wang@intel.com>

Regards,
Jian

> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Thursday, February 13, 2020 12:03 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>;
> Wang, Jian J <jian.j.wang@intel.com>
> Subject: [patch] MdeModulePkg/HiiDB: Remove configuration table when it's
> freed (CVE-2019-14586)
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1995
> 
> Fix the corner case issue that the original configuration runtime
> memory is freed, but it is still exposed to the OS runtime.
> So this patch is to remove the configuration table to avoid being
> used in OS runtime when the configuration runtime memory is freed.
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> Reviewed-by: Eric Dong <eric.dong@intel.com>
> ---
>  MdeModulePkg/Universal/HiiDatabaseDxe/Database.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
> b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
> index d3791ca68b..36265b8ff9 100644
> --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
> +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
> @@ -3374,10 +3374,14 @@ HiiGetConfigRespInfo(
>        }
>        gRTConfigRespBuffer = (EFI_STRING) AllocateRuntimeZeroPool
> (gConfigRespSize);
>        if (gRTConfigRespBuffer == NULL){
>          FreePool(ConfigAltResp);
>          DEBUG ((DEBUG_ERROR, "[HiiDatabase]: No enough memory resource to
> store the ConfigResp string.\n"));
> +        //
> +        // Remove from the System Table when the configuration runtime buffer is
> freed.
> +        //
> +        gBS->InstallConfigurationTable (&gEfiHiiConfigRoutingProtocolGuid,
> NULL);
>          return EFI_OUT_OF_RESOURCES;
>        }
>      } else {
>        ZeroMem(gRTConfigRespBuffer,gConfigRespSize);
>      }
> @@ -3429,10 +3433,14 @@ HiiGetDatabaseInfo(
>        DEBUG ((DEBUG_WARN, "[HiiDatabase]: Memory allocation is required
> after ReadyToBoot, which may change memory map and cause S4 resume
> issue.\n"));
>      }
>      gRTDatabaseInfoBuffer = AllocateRuntimeZeroPool (gDatabaseInfoSize);
>      if (gRTDatabaseInfoBuffer == NULL){
>        DEBUG ((DEBUG_ERROR, "[HiiDatabase]: No enough memory resource to
> store the HiiDatabase info.\n"));
> +      //
> +      // Remove from the System Table when the configuration runtime buffer is
> freed.
> +      //
> +      gBS->InstallConfigurationTable (&gEfiHiiDatabaseProtocolGuid, NULL);
>        return EFI_OUT_OF_RESOURCES;
>      }
>    } else {
>      ZeroMem(gRTDatabaseInfoBuffer,gDatabaseInfoSize);
>    }
> --
> 2.18.0.windows.1


      parent reply	other threads:[~2020-02-13  4:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  4:03 [patch] MdeModulePkg/HiiDB: Remove configuration table when it's freed (CVE-2019-14586) Dandan Bi
2020-02-13  4:03 ` [patch 1/2] MdeModulePkg/String.c: Zero memory before free (CVE-2019-14558) Dandan Bi
2020-02-13  4:06   ` Wang, Jian J
2020-02-14  6:44   ` Dong, Eric
2020-02-13  4:03 ` [patch 2/2] MdeModulePkg/DisplayEngine: " Dandan Bi
2020-02-13  4:11   ` Wang, Jian J
2020-02-14  6:45   ` Dong, Eric
2020-02-13  4:05 ` Wang, Jian J [this message]

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=D827630B58408649ACB04F44C510003625A0D9A5@SHSMSX107.ccr.corp.intel.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