48 lines
2.5 KiB
Diff
48 lines
2.5 KiB
Diff
From c65a8a1641b91575d20d4afd5cdd83e977c715a7 Mon Sep 17 00:00:00 2001
|
|
From: ShenYage <shenyage1@huawei.com>
|
|
Date: Tue, 11 Jun 2024 17:02:24 +0800
|
|
Subject: [PATCH] MdeModulePkg: Potential UINT32 overflow in S3 ResumeCount
|
|
|
|
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4677
|
|
|
|
Attacker able to modify physical memory and ResumeCount.
|
|
System will crash/DoS when ResumeCount reaches its MAX_UINT32.
|
|
|
|
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
|
|
Cc: Dandan Bi <dandan.bi@intel.com>
|
|
Cc: Liming Gao <gaoliming@byosoft.com.cn>
|
|
|
|
Signed-off-by: Pakkirisamy ShanmugavelX <shanmugavelx.pakkirisamy@intel.com>
|
|
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
|
|
---
|
|
.../FirmwarePerformancePei.c | 12 ++++++++----
|
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
|
|
index 493d09c..bfd8d5f 100644
|
|
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
|
|
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c
|
|
@@ -110,11 +110,15 @@ FpdtStatusCodeListenerPei (
|
|
//
|
|
S3ResumeTotal = MultU64x32 (AcpiS3ResumeRecord->AverageResume, AcpiS3ResumeRecord->ResumeCount);
|
|
AcpiS3ResumeRecord->ResumeCount++;
|
|
- AcpiS3ResumeRecord->AverageResume = DivU64x32 (S3ResumeTotal + AcpiS3ResumeRecord->FullResume, AcpiS3ResumeRecord->ResumeCount);
|
|
+ if (AcpiS3ResumeRecord->ResumeCount > 0) {
|
|
+ AcpiS3ResumeRecord->AverageResume = DivU64x32 (S3ResumeTotal + AcpiS3ResumeRecord->FullResume, AcpiS3ResumeRecord->ResumeCount);
|
|
+ DEBUG ((EFI_D_INFO, "\nFPDT: S3 Resume Performance - AverageResume = 0x%x\n", AcpiS3ResumeRecord->AverageResume));
|
|
+ } else {
|
|
+ DEBUG ((EFI_D_ERROR, "\nFPDT: S3 ResumeCount reaches the MAX_UINT32 value. S3 ResumeCount record reset to Zero."));
|
|
+ }
|
|
|
|
- DEBUG ((EFI_D_INFO, "FPDT: S3 Resume Performance - ResumeCount = %d\n", AcpiS3ResumeRecord->ResumeCount));
|
|
- DEBUG ((EFI_D_INFO, "FPDT: S3 Resume Performance - FullResume = %ld\n", AcpiS3ResumeRecord->FullResume));
|
|
- DEBUG ((EFI_D_INFO, "FPDT: S3 Resume Performance - AverageResume = %ld\n", AcpiS3ResumeRecord->AverageResume));
|
|
+ DEBUG ((EFI_D_INFO, "FPDT: S3 Resume Performance - ResumeCount = 0x%x\n", AcpiS3ResumeRecord->ResumeCount));
|
|
+ DEBUG ((EFI_D_INFO, "FPDT: S3 Resume Performance - FullResume = 0x%x\n", AcpiS3ResumeRecord->FullResume));
|
|
|
|
//
|
|
// Update S3 Suspend Performance Record.
|
|
--
|
|
2.33.0
|
|
|