From patchwork Fri Nov 22 05:17:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 52958 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B7F8E65D29 for ; Fri, 22 Nov 2024 05:18:14 +0000 (UTC) Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by mx.groups.io with SMTP id smtpd.web11.17931.1732252686250022707 for ; Thu, 21 Nov 2024 21:18:06 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.178.238, mailfrom: prvs=105629bf38=hongxu.jia@windriver.com) Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AM4M8He030547 for ; Fri, 22 Nov 2024 05:18:05 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 42xjc8eehr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 22 Nov 2024 05:18:05 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TahLY5sXFhEZcT5GNSbsr+Sq3xWuo/zYCJUe3eMBirvcF1Gk0eYwA0qT1MUqoySoB7PZicswX/kj+DoMCxu8rbAhbVvjf9CVyW34IYRFE8AlwHdkaZpbLdX9rV4WlyCx/PUGFHQYKeUSOxvndDo71kUeQVncqzI4+HtYgL/H4G3nuKeQP2Q1Nngeyjm4HYeG/YTSlZRj0qoPHPpqt48ZXEimHamwLl5/M74Pd0CsfoLmfju+e2U76/olpLhhleibT2BSuxeyq4JDH00msXV+FzZhDk9RLfFXdQLxfQROKmSmMeG5l41q0F3AiOoUUyYBkcred0L3FYSpM3soE7qtjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k9T8uygJbngYkhSQ03fh5vX6A65f5iJ7nlt/r8M2NNQ=; b=szVa/0HLllRzJyPxD0gEFM3MvBRnc2W2EP+ewMbh4pWLFhxk3Z4bzI3oomj2e6bIk46Th32uY/uVkXfUXcZEBYQIQEj14Pca1Nj9Ax+hYS9Kjfhv1xrTACIQeRhiE+IsOKFd0Ss4v/gmvtxbRusoXz9oiFRapCLdthKRboKlRSm+ZzjL3Iwju6Ki2KOOgA8cvczZpeaTB/ZPCdDHKRwveZeYAPoG3CwjnydABGdeFJN+jS5SpUOmTBlVnrvPcyCUNvNabBGDweBqlYABu26aCzCQwcsabFuLmVOykITCqcErt6hsrT3OlBMhSvSOxlP0qrjipJy/12owbK6hN6cWcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from PH7PR11MB7608.namprd11.prod.outlook.com (2603:10b6:510:269::20) by PH7PR11MB6882.namprd11.prod.outlook.com (2603:10b6:510:201::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Fri, 22 Nov 2024 05:18:00 +0000 Received: from PH7PR11MB7608.namprd11.prod.outlook.com ([fe80::ef64:bc9f:eb8c:e6e]) by PH7PR11MB7608.namprd11.prod.outlook.com ([fe80::ef64:bc9f:eb8c:e6e%4]) with mapi id 15.20.8158.017; Fri, 22 Nov 2024 05:18:00 +0000 From: Hongxu Jia To: openembedded-core@lists.openembedded.org Subject: [scarthgap][PATCH 2/2] ovmf: fix CVE-2024-1298 Date: Fri, 22 Nov 2024 13:17:49 +0800 Message-Id: <20241122051749.1260019-2-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241122051749.1260019-1-hongxu.jia@windriver.com> References: <20241122051749.1260019-1-hongxu.jia@windriver.com> X-ClientProxiedBy: TYAPR01CA0068.jpnprd01.prod.outlook.com (2603:1096:404:2b::32) To PH7PR11MB7608.namprd11.prod.outlook.com (2603:10b6:510:269::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR11MB7608:EE_|PH7PR11MB6882:EE_ X-MS-Office365-Filtering-Correlation-Id: b09a0812-1247-4f85-7a4d-08dd0ab50854 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: UBk2oLu0crmOAp+AhmgcgvsPTmD2fdA6N/7Mk3KDpLUMqdM8q3OaCXij/1z/jpmqA9eRjmZmfsPa7lmxEhLTKy8sEMWVj4LWox8hWijubHYWNQcJ/xdS9DUU3Y+xiMjjiWmnHX0LXrME03a/a9uRnQAI16acM9hPZHojY9n/lB9XkjcGc4QxrHmm9dWsz/wIr5zatdgculA3+Sx5vVCWO6yOQeygExT+PgwoFhRzYjgBJiZ1ZKQF1riiSAS4ioVb1q3WPMMTyJJ7yaLpFGWUpA4CF2/iR8wZlFgt/qHVM4alVKTVB60HiMa/Nq9bmIyhiAfaGzZ74DIB2m/57NIOQ99Tk04cE8w5mUPT+E4YTcHAYEs/N3kma0PokAq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RsS+y4Xzqw+Jxq0xVKZI7BqHTsW4RowhArHNCk9ay8Z8lFhMkKLXf5QhtsukMJYSUZm6Gy01HSQrytOeXgDtU4s///VjL3n7GrI651lQLBiYmNV4/0uYYTX/nbzF331KidbCiQ+eWbfwsJ7AihSvABJLEVPNng6ICEFrl4Q6XIJCmxl9OsUsCxL+HXjhrP+ylIz/o105N4ttmU4WNlETj5Ucn/sE+7C403Uz95W8Vy1ccCPe6bhf0d1jJAonG4OupbmpU66XGlMAEN+dbY0vxORnMAhliwDdagZi47SIpy+4CQecUMg9iRpR2JDwWdtbE7JupfEmvDT+0DdBIkf3iy6JjXK3INlr4LSdhSspK7lbLjAj910d0fKBgRaqaRr9gsi6/Hno7Ll/Kz63PR1QDuctMLjnbwxvuM+Fn8fbaRVSOwfueYitg6Bh6k6h9rGtcCiWhoHWR30NgBEMt4gAQbvbByqxGM6Ej6ON0qxFHftzdgWpjlxXG6xmLRvFj77Xa1JrjhilDYP7kAhACkLv/xQuADdj3ONiyYRUT3Y9yMRD2lRmIGAN60AeB+VaouhHNcOqmvcg/i/PvQr+ML5nXZjVPkAcPyWKb7qxvNUSMcMyxIB4OWF2txGvtfmb9F/8LoIppKHc3l+cS1tH2xs/mTb52uladRA== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: b09a0812-1247-4f85-7a4d-08dd0ab50854 X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB7608.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2024 05:18:00.3759 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a6yyt524+8RdnHMHLXcgtNieHku49WyUnZFw68MuNNW6gvEWvbVoj2BaA4oeXsHgh6zGKmTtCOU2z1PNdRtjnu7RD5rcnqOl5yblRqH7htw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6882 X-Proofpoint-GUID: nJ-9BJUV-2oTdPuaMiw8w4yasEIiESb2 X-Authority-Analysis: v=2.4 cv=R6hRGsRX c=1 sm=1 tr=0 ts=6740140d cx=c_pps a=ynuEE1Gfdg78pLiovR0MAg==:117 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=VlfZXiiP6vEA:10 a=bRTqI5nwn0kA:10 a=NEAV23lmAAAA:8 a=hqBzw_eTAAAA:8 a=t7CeM3EgAAAA:8 a=QyXUC8HyAAAA:8 a=jYJ61ryfAAAA:8 a=J6owyr6zO-tr3Sa6r84A:9 a=bkWp_v3HvcftT6DRAIDL:22 a=FdTzh2GWekK77mhwV6Dw:22 a=eNvJ01k53lG8zT5pDJgy:22 X-Proofpoint-ORIG-GUID: nJ-9BJUV-2oTdPuaMiw8w4yasEIiESb2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-21_17,2024-11-21_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 mlxscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 suspectscore=0 bulkscore=0 impostorscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2409260000 definitions=main-2411220043 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 22 Nov 2024 05:18:14 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/207589 Backport fix from upstream to resolve CVE-2024-1298 https://github.com/tianocore/edk2/commit/284dbac43da752ee34825c8b3f6f9e8281cb5a19 Signed-off-by: Hongxu Jia --- ...ential-UINT32-overflow-in-S3-ResumeC.patch | 51 +++++++++++++++++++ meta/recipes-core/ovmf/ovmf_git.bb | 1 + 2 files changed, 52 insertions(+) create mode 100644 meta/recipes-core/ovmf/ovmf/0001-MdeModulePkg-Potential-UINT32-overflow-in-S3-ResumeC.patch 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 @@ +From 150ea3ea4c821b133a782eeb33ef2a9c8fd8d7c3 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Fri, 22 Nov 2024 13:05:57 +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 +Cc: Dandan Bi +Cc: Liming Gao + +Signed-off-by: Pakkirisamy ShanmugavelX +Reviewed-by: Liming Gao + +CVE: CVE-2024-1298 +Upstream-Status: Backport [https://github.com/tianocore/edk2/commit/284dbac43da752ee34825c8b3f6f9e8281cb5a19] +Signed-off-by: Hongxu Jia +--- + .../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 2f2b2a8..2ba9215 100644 +--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c ++++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c +@@ -112,11 +112,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 ((DEBUG_INFO, "\nFPDT: S3 Resume Performance - AverageResume = 0x%x\n", AcpiS3ResumeRecord->AverageResume)); ++ } else { ++ DEBUG ((DEBUG_ERROR, "\nFPDT: S3 ResumeCount reaches the MAX_UINT32 value. S3 ResumeCount record reset to Zero.")); ++ } + +- DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - ResumeCount = %d\n", AcpiS3ResumeRecord->ResumeCount)); +- DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - FullResume = %ld\n", AcpiS3ResumeRecord->FullResume)); +- DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - AverageResume = %ld\n", AcpiS3ResumeRecord->AverageResume)); ++ DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - ResumeCount = 0x%x\n", AcpiS3ResumeRecord->ResumeCount)); ++ DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - FullResume = 0x%x\n", AcpiS3ResumeRecord->FullResume)); + + // + // Update S3 Suspend Performance Record. +-- +2.34.1 + 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 \ file://0003-debug-prefix-map.patch \ file://0004-reproducible.patch \ file://0001-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch \ + file://0001-MdeModulePkg-Potential-UINT32-overflow-in-S3-ResumeC.patch \ " PV = "edk2-stable202402"