From: "Ard Biesheuvel" <ardb@kernel.org>
To: gua.guo@intel.com
Cc: devel@edk2.groups.io, Gerd Hoffmann <kraxel@redhat.com>,
Marc Beatove <mbeatove@google.com>,
Leif Lindholm <quic_llindhol@quicinc.com>,
Abner Chang <abner.chang@amd.com>,
John Mathew <john.mathews@intel.com>
Subject: Re: [edk2-devel] [PATCH v1 3/4] EmbeddedPkg/Hob: Integer Overflow in CreateHob()
Date: Thu, 11 Jan 2024 07:53:48 +0100 [thread overview]
Message-ID: <CAMj1kXHBHtevXE5YpgPTH7ygzOK_ViosUT6+HHUHVk=ukG6apA@mail.gmail.com> (raw)
In-Reply-To: <20240111051521.1366-4-gua.guo@intel.com>
On Thu, 11 Jan 2024 at 06:15, <gua.guo@intel.com> wrote:
>
> From: Gerd Hoffmann <kraxel@redhat.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: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: John Mathew <john.mathews@intel.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This is missing a signed-off line from the sender.
(the signoff is not a statement of authorship, it is a promise by the
sender that the contribution complies with the license)
With that fixed:
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> EmbeddedPkg/Library/PrePiHobLib/Hob.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/EmbeddedPkg/Library/PrePiHobLib/Hob.c b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> index 8eb175aa96..ee2e3176be 100644
> --- a/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> +++ b/EmbeddedPkg/Library/PrePiHobLib/Hob.c
> @@ -110,6 +110,12 @@ CreateHob (
>
> HandOffHob = GetHobList ();
>
> + //
> + // Check Length to avoid data overflow.
> + //
> + if (HobLength > MAX_UINT16 - 0x7) {
> + return NULL;
> + }
> HobLength = (UINT16)((HobLength + 0x7) & (~0x7));
>
> FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;
> --
> 2.39.2.windows.1
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113584): https://edk2.groups.io/g/devel/message/113584
Mute This Topic: https://groups.io/mt/103657273/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-01-11 6:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 5:15 [edk2-devel] [PATCH v1 0/4] Bz4166: Integer Overflow in CreateHob() Guo, Gua
2024-01-11 5:15 ` [edk2-devel] [PATCH v1 1/4] UefiPayloadPkg/Hob: " Guo, Gua
2024-01-11 5:15 ` [edk2-devel] [PATCH v1 2/4] StandaloneMmPkg/Hob: " Guo, Gua
2024-01-11 6:52 ` Ard Biesheuvel
2024-01-11 6:54 ` Ard Biesheuvel
2024-01-11 5:15 ` [edk2-devel] [PATCH v1 3/4] EmbeddedPkg/Hob: " Guo, Gua
2024-01-11 6:53 ` Ard Biesheuvel [this message]
2024-01-11 5:15 ` [edk2-devel] [PATCH v1 4/4] MdeModulePkg/Hob: " 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='CAMj1kXHBHtevXE5YpgPTH7ygzOK_ViosUT6+HHUHVk=ukG6apA@mail.gmail.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