From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"kuqin12@gmail.com" <kuqin12@gmail.com>
Cc: "Dong, Eric" <eric.dong@intel.com>,
Laszlo Ersek <lersek@redhat.com>,
"Kumar, Rahul1" <rahul1.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH v1 1/1] UefiCpuPkg: PiSmmCpuDxeSmm: Check buffer size before accessing
Date: Fri, 2 Apr 2021 06:21:42 +0000 [thread overview]
Message-ID: <CO1PR11MB493011F12FD7FD93327856588C7A9@CO1PR11MB4930.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210326234142.1973-2-kuqin12@gmail.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kun Qin
> Sent: Saturday, March 27, 2021 7:42 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar, Rahul1
> <rahul1.kumar@intel.com>
> Subject: [edk2-devel] [PATCH v1 1/1] UefiCpuPkg: PiSmmCpuDxeSmm: Check buffer size before accessing
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3283
>
> Current SMM Save State routine does not check the number of bytes to be
> read, when it comse to read IO_INFO, before casting the incoming buffer
> to EFI_SMM_SAVE_STATE_IO_INFO. This could potentially cause memory
> corruption due to extra bytes are written out of buffer boundary.
>
> This change adds a width check before copying IoInfo into output buffer.
>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>
> Signed-off-by: Kun Qin <kuqin12@gmail.com>
> ---
> UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
> index 661cc51f361a..ec760e4c37ca 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
> @@ -418,6 +418,13 @@ ReadSaveStateRegister (
> return EFI_NOT_FOUND;
> }
>
> + //
> + // Make sure the incoming buffer is large enough to hold IoInfo before accessing
> + //
> + if (Width < sizeof (EFI_SMM_SAVE_STATE_IO_INFO)) {
> + return EFI_INVALID_PARAMETER;
> + }
> +
> //
> // Zero the IoInfo structure that will be returned in Buffer
> //
> --
> 2.31.0.windows.1
>
>
>
>
>
next prev parent reply other threads:[~2021-04-02 6:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 23:41 [PATCH v1 0/1] Add buffer size check before save state read Kun Qin
2021-03-26 23:41 ` [PATCH v1 1/1] UefiCpuPkg: PiSmmCpuDxeSmm: Check buffer size before accessing Kun Qin
2021-04-02 6:21 ` Ni, Ray [this message]
2021-04-06 12:09 ` [edk2-devel] " Laszlo Ersek
2021-04-06 18:45 ` Kun Qin
-- strict thread matches above, loose matches on Subject: below --
2021-04-06 19:52 [PATCH v1 0/1] Add buffer size check before save state read Kun Qin
2021-04-06 19:52 ` [PATCH v1 1/1] UefiCpuPkg: PiSmmCpuDxeSmm: Check buffer size before accessing Kun Qin
2021-04-07 16:08 ` Laszlo Ersek
2021-04-12 17:36 ` [edk2-devel] " Laszlo Ersek
2021-04-12 17:43 ` Kun Qin
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=CO1PR11MB493011F12FD7FD93327856588C7A9@CO1PR11MB4930.namprd11.prod.outlook.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