public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "gaoliming via groups.io" <gaoliming=byosoft.com.cn@groups.io>
To: <devel@edk2.groups.io>, <gua.guo@intel.com>
Cc: "'Marc Beatove'" <mbeatove@google.com>,
	"'John Mathew'" <john.mathews@intel.com>,
	"'Gerd Hoffmann'" <kraxel@redhat.com>
Subject: 回复: [edk2-devel] [PATCH v3 4/4] MdeModulePkg/Hob: Integer Overflow in CreateHob()
Date: Tue, 16 Jan 2024 22:39:19 +0800	[thread overview]
Message-ID: <02c401da4889$ca5ad200$5f107600$@byosoft.com.cn> (raw)
In-Reply-To: <20240112022521.710-5-gua.guo@intel.com>

Gua:
 I think new code logic is same to old one. Can you point what difference
here?

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Guo, Gua
> 发送时间: 2024年1月12日 10:25
> 收件人: devel@edk2.groups.io
> 抄送: gua.guo@intel.com; Marc Beatove <mbeatove@google.com>; Liming
> Gao <gaoliming@byosoft.com.cn>; John Mathew <john.mathews@intel.com>;
> Gerd Hoffmann <kraxel@redhat.com>
> 主题: [edk2-devel] [PATCH v3 4/4] MdeModulePkg/Hob: Integer Overflow in
> CreateHob()
> 
> From: Gua Guo <gua.guo@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166
> 
> Fix integer overflow in various CreateHob instances.
> Fixes: CVE-2022-36765
> 
> The CreateHob() function aligns the requested size to 8
> performing the following operation:
> ```
> HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
> ```
> 
> No checks are performed to ensure this value doesn't
> overflow, and could lead to CreateHob() returning a smaller
> HOB than requested, which could lead to OOB HOB accesses.
> 
> Reported-by: Marc Beatove <mbeatove@google.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: John Mathew <john.mathews@intel.com>
> Authored-by: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Gua Guo <gua.guo@intel.com>
> ---
>  MdeModulePkg/Core/Pei/Hob/Hob.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Core/Pei/Hob/Hob.c
> b/MdeModulePkg/Core/Pei/Hob/Hob.c
> index c4882a23cd..985da50995 100644
> --- a/MdeModulePkg/Core/Pei/Hob/Hob.c
> +++ b/MdeModulePkg/Core/Pei/Hob/Hob.c
> @@ -85,7 +85,7 @@ PeiCreateHob (
>    //
> 
>    // Check Length to avoid data overflow.
> 
>    //
> 
> -  if (0x10000 - Length <= 0x7) {
> 
> +  if (MAX_UINT16 - Length < 0x7) {
> 
>      return EFI_INVALID_PARAMETER;
> 
>    }
> 
> 
> 
> --
> 2.39.2.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#113643):
> https://edk2.groups.io/g/devel/message/113643
> Mute This Topic: https://groups.io/mt/103675965/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113905): https://edk2.groups.io/g/devel/message/113905
Mute This Topic: https://groups.io/mt/103762835/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-01-16 14:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12  2:25 [edk2-devel] [PATCH v3 0/4] Bz4166: Integer Overflow in CreateHob() Guo, Gua
2024-01-12  2:25 ` [edk2-devel] [PATCH v3 1/4] UefiPayloadPkg/Hob: " Guo, Gua
2024-01-12  2:25 ` [edk2-devel] [PATCH v3 2/4] StandaloneMmPkg/Hob: " Guo, Gua
2024-01-12  8:56   ` Ni, Ray
2024-01-24 12:40     ` Gerd Hoffmann
2024-01-25  1:33       ` Ni, Ray
2024-01-12  2:25 ` [edk2-devel] [PATCH v3 3/4] EmbeddedPkg/Hob: " Guo, Gua
2024-01-12  2:25 ` [edk2-devel] [PATCH v3 4/4] MdeModulePkg/Hob: " Guo, Gua
2024-01-16 14:39   ` gaoliming via groups.io [this message]
2024-01-19  9:53 ` [edk2-devel] [PATCH v3 0/4] Bz4166: " Sami Mujawar
2024-01-23 14:49 ` Gerd Hoffmann
2024-01-23 15:16   ` Guo, Gua
2024-01-24 12:48     ` Gerd Hoffmann
2024-01-25  8:08       ` Guo, Gua

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='02c401da4889$ca5ad200$5f107600$@byosoft.com.cn' \
    --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