diff options
| -rw-r--r-- | meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-Potential-UINT32-overflow-in-S3-ResumeC.patch | 51 | ||||
| -rw-r--r-- | meta/recipes-core/ovmf/ovmf_git.bb | 1 |
2 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-Potential-UINT32-overflow-in-S3-ResumeC.patch b/meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-Potential-UINT32-overflow-in-S3-ResumeC.patch new file mode 100644 index 0000000000..264820138f --- /dev/null +++ b/meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-Potential-UINT32-overflow-in-S3-ResumeC.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | From 150ea3ea4c821b133a782eeb33ef2a9c8fd8d7c3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 3 | Date: Fri, 22 Nov 2024 13:05:57 +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 | CVE: CVE-2024-1298 | ||
| 19 | Upstream-Status: Backport [https://github.com/tianocore/edk2/commit/284dbac43da752ee34825c8b3f6f9e8281cb5a19] | ||
| 20 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 21 | --- | ||
| 22 | .../FirmwarePerformancePei.c | 12 ++++++++---- | ||
| 23 | 1 file changed, 8 insertions(+), 4 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c | ||
| 26 | index 2f2b2a8..2ba9215 100644 | ||
| 27 | --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c | ||
| 28 | +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c | ||
| 29 | @@ -112,11 +112,15 @@ FpdtStatusCodeListenerPei ( | ||
| 30 | // | ||
| 31 | S3ResumeTotal = MultU64x32 (AcpiS3ResumeRecord->AverageResume, AcpiS3ResumeRecord->ResumeCount); | ||
| 32 | AcpiS3ResumeRecord->ResumeCount++; | ||
| 33 | - AcpiS3ResumeRecord->AverageResume = DivU64x32 (S3ResumeTotal + AcpiS3ResumeRecord->FullResume, AcpiS3ResumeRecord->ResumeCount); | ||
| 34 | + if (AcpiS3ResumeRecord->ResumeCount > 0) { | ||
| 35 | + AcpiS3ResumeRecord->AverageResume = DivU64x32 (S3ResumeTotal + AcpiS3ResumeRecord->FullResume, AcpiS3ResumeRecord->ResumeCount); | ||
| 36 | + DEBUG ((DEBUG_INFO, "\nFPDT: S3 Resume Performance - AverageResume = 0x%x\n", AcpiS3ResumeRecord->AverageResume)); | ||
| 37 | + } else { | ||
| 38 | + DEBUG ((DEBUG_ERROR, "\nFPDT: S3 ResumeCount reaches the MAX_UINT32 value. S3 ResumeCount record reset to Zero.")); | ||
| 39 | + } | ||
| 40 | |||
| 41 | - DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - ResumeCount = %d\n", AcpiS3ResumeRecord->ResumeCount)); | ||
| 42 | - DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - FullResume = %ld\n", AcpiS3ResumeRecord->FullResume)); | ||
| 43 | - DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - AverageResume = %ld\n", AcpiS3ResumeRecord->AverageResume)); | ||
| 44 | + DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - ResumeCount = 0x%x\n", AcpiS3ResumeRecord->ResumeCount)); | ||
| 45 | + DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - FullResume = 0x%x\n", AcpiS3ResumeRecord->FullResume)); | ||
| 46 | |||
| 47 | // | ||
| 48 | // Update S3 Suspend Performance Record. | ||
| 49 | -- | ||
| 50 | 2.34.1 | ||
| 51 | |||
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb index cc2ac4268c..ada6ee72db 100644 --- a/meta/recipes-core/ovmf/ovmf_git.bb +++ b/meta/recipes-core/ovmf/ovmf_git.bb | |||
| @@ -25,6 +25,7 @@ SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \ | |||
| 25 | file://0003-debug-prefix-map.patch \ | 25 | file://0003-debug-prefix-map.patch \ |
| 26 | file://0004-reproducible.patch \ | 26 | file://0004-reproducible.patch \ |
| 27 | file://0001-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch \ | 27 | file://0001-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch \ |
| 28 | file://0001-MdeModulePkg-Potential-UINT32-overflow-in-S3-ResumeC.patch \ | ||
| 28 | " | 29 | " |
| 29 | 30 | ||
| 30 | PV = "edk2-stable202402" | 31 | PV = "edk2-stable202402" |
