diff --git a/0092-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch b/0092-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch new file mode 100644 index 0000000000000000000000000000000000000000..82620e66a208e4ad58eedbedcad8a2231645abe7 --- /dev/null +++ b/0092-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch @@ -0,0 +1,32 @@ +From c95233b8525ca6828921affd1496146cff262e65 Mon Sep 17 00:00:00 2001 +From: Doug Flick +Date: Fri, 27 Sep 2024 12:08:55 -0700 +Subject: [PATCH] MdePkg: Fix overflow issue in BasePeCoffLib + +The RelocDir->Size is a UINT32 value, and RelocDir->VirtualAddress is +also a UINT32 value. The current code does not check for overflow when +adding RelocDir->Size to RelocDir->VirtualAddress. This patch adds a +check to ensure that the addition does not overflow. + +Signed-off-by: Doug Flick +Authored-by: sriraamx gobichettipalayam +--- + MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +index 1102833..7fa4714 100644 +--- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c ++++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +@@ -991,7 +991,7 @@ PeCoffLoaderRelocateImage ( + RelocDir = &Hdr.Te->DataDirectory[0]; + } + +- if ((RelocDir != NULL) && (RelocDir->Size > 0)) { ++ if ((RelocDir != NULL) && (RelocDir->Size > 0) && (RelocDir->Size - 1 < MAX_UINT32 - RelocDir->VirtualAddress)) { + RelocBase = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress, TeStrippedOffset); + RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (ImageContext, + RelocDir->VirtualAddress + RelocDir->Size - 1, +-- +2.43.0 + diff --git a/edk2.spec b/edk2.spec index 135443b0f9426176acb0c4669418a1af6c44da11..b6614a0c06b2e94b8ec94fdf204eeae66a168a2b 100644 --- a/edk2.spec +++ b/edk2.spec @@ -5,7 +5,7 @@ Name: edk2 Version: %{stable_date} -Release: 21 +Release: 22 Summary: EFI Development Kit II License: BSD-2-Clause-Patent URL: https://github.com/tianocore/edk2 @@ -131,6 +131,9 @@ Patch0089: 0089-VirtioDxe-add-support-of-MMIO-Bar-for-virtio-devices.patch Patch0090: 0090-Virtio-wait-virtio-device-reset-done.patch Patch0091: 0091-VirtioBlk-split-large-IO-according-to-segment_size_m.patch +# Fix CVE-2024-38796 +patch0092: 0092-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch + BuildRequires: acpica-tools gcc gcc-c++ libuuid-devel python3 bc nasm python3-unversioned-command %description @@ -331,6 +334,9 @@ chmod +x %{buildroot}%{_bindir}/Rsa2048Sha256GenerateKeys %endif %changelog +* Wed Oct 09 2024 zhangxianting - 202011-22 +- fix CVE-2024-38796 + * Wed Sep 18 2024 jiangdongxu - 202011-21 - vdpa: support vdpa blk/scsi device boot