Skip to content

Commit 65cae39

Browse files
authored
edk2: add patch for CVE-2024-1298 (#9335)
1 parent 6af9f3d commit 65cae39

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

SPECS/edk2/CVE-2024-1298.patch

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From 284dbac43da752ee34825c8b3f6f9e8281cb5a19 Mon Sep 17 00:00:00 2001
2+
From: Shanmugavel Pakkirisamy <shanmugavelx.pakkirisamy@intel.com>
3+
Date: Mon, 6 May 2024 17:53:09 +0800
4+
Subject: [PATCH] MdeModulePkg: Potential UINT32 overflow in S3 ResumeCount
5+
6+
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4677
7+
8+
Attacker able to modify physical memory and ResumeCount.
9+
System will crash/DoS when ResumeCount reaches its MAX_UINT32.
10+
11+
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
12+
Cc: Dandan Bi <dandan.bi@intel.com>
13+
Cc: Liming Gao <gaoliming@byosoft.com.cn>
14+
15+
Signed-off-by: Pakkirisamy ShanmugavelX <shanmugavelx.pakkirisamy@intel.com>
16+
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
17+
---
18+
.../FirmwarePerformancePei.c | 12 ++++++++----
19+
1 file changed, 8 insertions(+), 4 deletions(-)
20+
21+
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
22+
index 2f2b2a80b25b..2ba9215226d5 100644
23+
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
24+
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
25+
@@ -112,11 +112,15 @@ FpdtStatusCodeListenerPei (
26+
//
27+
S3ResumeTotal = MultU64x32 (AcpiS3ResumeRecord->AverageResume, AcpiS3ResumeRecord->ResumeCount);
28+
AcpiS3ResumeRecord->ResumeCount++;
29+
- AcpiS3ResumeRecord->AverageResume = DivU64x32 (S3ResumeTotal + AcpiS3ResumeRecord->FullResume, AcpiS3ResumeRecord->ResumeCount);
30+
+ if (AcpiS3ResumeRecord->ResumeCount > 0) {
31+
+ AcpiS3ResumeRecord->AverageResume = DivU64x32 (S3ResumeTotal + AcpiS3ResumeRecord->FullResume, AcpiS3ResumeRecord->ResumeCount);
32+
+ DEBUG ((DEBUG_INFO, "\nFPDT: S3 Resume Performance - AverageResume = 0x%x\n", AcpiS3ResumeRecord->AverageResume));
33+
+ } else {
34+
+ DEBUG ((DEBUG_ERROR, "\nFPDT: S3 ResumeCount reaches the MAX_UINT32 value. S3 ResumeCount record reset to Zero."));
35+
+ }
36+
37+
- DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - ResumeCount = %d\n", AcpiS3ResumeRecord->ResumeCount));
38+
- DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - FullResume = %ld\n", AcpiS3ResumeRecord->FullResume));
39+
- DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - AverageResume = %ld\n", AcpiS3ResumeRecord->AverageResume));
40+
+ DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - ResumeCount = 0x%x\n", AcpiS3ResumeRecord->ResumeCount));
41+
+ DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - FullResume = 0x%x\n", AcpiS3ResumeRecord->FullResume));
42+
43+
//
44+
// Update S3 Suspend Performance Record.

SPECS/edk2/edk2.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ExclusiveArch: x86_64
4545

4646
Name: edk2
4747
Version: %{GITDATE}git%{GITCOMMIT}
48-
Release: 38%{?dist}
48+
Release: 39%{?dist}
4949
Summary: UEFI firmware for 64-bit virtual machines
5050
License: BSD-2-Clause-Patent and OpenSSL and MIT
5151
URL: http://www.tianocore.org
@@ -108,6 +108,7 @@ Patch0014: 0014-SecurityPkg-add-TIS-sanity-check-tpm2.patch
108108
Patch0015: 0015-SecurityPkg-add-TIS-sanity-check-tpm12.patch
109109
Patch0016: 0016-OvmfPkg-Clarify-invariants-for-NestedInterruptTplLib.patch
110110
Patch0017: 0017-OvmfPkg-Relax-assertion-that-interrupts-do-not-occur.patch
111+
Patch0018: CVE-2024-1298.patch
111112

112113
Patch1000: CVE-2023-0464.patch
113114
Patch1001: CVE-2023-3817.patch
@@ -699,6 +700,9 @@ $tests_ok
699700

700701

701702
%changelog
703+
* Thu Jun 06 2024 Archana Choudhary <archana1@microsoft.com> - 20230301gitf80f052277c8-39
704+
- Apply CVE-2024-1298 patch
705+
702706
* Wed Dec 13 2023 Andrew Phelps <anphel@microsoft.com> - 20230301gitf80f052277c8-38
703707
- Apply patch to vendored source
704708

0 commit comments

Comments
 (0)