From patchwork Thu Oct 16 14:16:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan X-Patchwork-Id: 72511 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 B672ACCD199 for ; Thu, 16 Oct 2025 14:16:33 +0000 (UTC) Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by mx.groups.io with SMTP id smtpd.web10.9838.1760624192214282854 for ; Thu, 16 Oct 2025 07:16:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=PONf8fv8; 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=23844c9b6c=saravanan.kadambathursubramaniyam@windriver.com) Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 59G4c5TL945732 for ; Thu, 16 Oct 2025 14:16:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=PPS06212021; bh=Qc6yJ1FO3BirxNMiGzSP aVUcdZBjVFVukJOEXimOcIg=; b=PONf8fv8Z8O9/7Y7RhGRrQuGhQk3SC6rUicf O3E72/Hlmf0hL3ryEcytTctS/QkfBGHXpWLbrrVdYQ3J5RRh3ylilUy2nRWzYiKN N9lQnLrOOlaQMXXNw9InmnlbU8xs2InSXijMqXSngVw7YvQhiC3g/3boybFx0ESt 3AE3br6nRf9TnNN6kCjGERFj45LMrCG6x0fITa4r+ng6m9a+K5uzNwkV+ch/rX6O 6wRGuiX7CqtIc0EP74G9VMuiUyPks8KPGD7l1htbzns7JCHk099kAEaZlj/SyDPM 2hU5xbI6UQIdwH5/DYVgoskMzUYrSYabRIhlKs8LYjWSgnKfnQ== Received: from ala-exchng02.corp.ad.wrs.com ([128.224.246.37]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 49qcewpefd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 16 Oct 2025 14:16:30 +0000 (GMT) Received: from ala-exchng01.corp.ad.wrs.com (10.11.224.121) by ALA-EXCHNG02.corp.ad.wrs.com (10.11.224.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.59; Thu, 16 Oct 2025 07:16:29 -0700 Received: from blr-linux-engg1.wrs.com (10.11.232.110) by ala-exchng01.corp.ad.wrs.com (10.11.224.121) with Microsoft SMTP Server id 15.1.2507.59 via Frontend Transport; Thu, 16 Oct 2025 07:16:28 -0700 From: Saravanan To: Subject: [oe-core][scarthgap][PATCH 1/1] cmake: fix CVE-2025-9301 Date: Thu, 16 Oct 2025 19:46:27 +0530 Message-ID: <20251016141627.2268259-1-saravanan.kadambathursubramaniyam@windriver.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Proofpoint-GUID: qgdEfzUIc9IqZmrZpr2M-8vC-kSguzNZ X-Proofpoint-ORIG-GUID: qgdEfzUIc9IqZmrZpr2M-8vC-kSguzNZ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDE2MDEwNCBTYWx0ZWRfX0FU3o9wVVU3T AZOEvqvE0g9Q5PjTlWd4SpuFcWKyt0Uy1bVKSyjZMjr74RXzWwnHtMHnrSplp8MA1ufc1NVH1jk RD423s39ziIs4bd+lYkhdA3Jmx78H/IgPeKRc+qOTvYp/q2d4oFijlMYETgWq+uQyUs8V4mgvSl E3VlKRUGx5IJpxyeeefIh8A412I6/XZYydGj8NfYy/XI5DyfCed09xgT1GF4/+UgFebdTmM97YW x/XGjele2OzgQ5Prvx3gD0tKCyCccH4BJst4LL0jAmuJiYelIv/yIZtfnfl2Htvef5X0vy1IQmO 6LX/3KuG9TppvuuNJZ648e9uyTXMobe8RYTO2+QeJFbYcgPSmD76JMkoOmyA4OluVgchMuIuPmd BDq5SiFDcfo4amlGrcjc/On2JvV0iA== X-Authority-Analysis: v=2.4 cv=M+xA6iws c=1 sm=1 tr=0 ts=68f0fe3e cx=c_pps a=Lg6ja3A245NiLSnFpY5YKQ==:117 a=Lg6ja3A245NiLSnFpY5YKQ==:17 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=PYnjg3YJAAAA:8 a=Ud-fGmwBAAAA:8 a=t7CeM3EgAAAA:8 a=qzKz8tMykHLvCfsI9dIA:9 a=H0_BfbLtyfsadj6IJfz3:22 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-16_02,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 suspectscore=0 adultscore=0 phishscore=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510020000 definitions=main-2510160104 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 ; Thu, 16 Oct 2025 14:16:33 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/224968 Reference: https://nvd.nist.gov/vuln/detail/CVE-2025-9301 https://gitlab.kitware.com/cmake/cmake/-/issues/27135 Upstream-patch: https://gitlab.kitware.com/cmake/cmake/-/commit/37e27f71bc356d880c908040cd0cb68fa2c371b8 Signed-off-by: Saravanan --- .../cmake/cmake/CVE-2025-9301.patch | 71 +++++++++++++++++++ meta/recipes-devtools/cmake/cmake_3.28.3.bb | 1 + 2 files changed, 72 insertions(+) create mode 100644 meta/recipes-devtools/cmake/cmake/CVE-2025-9301.patch diff --git a/meta/recipes-devtools/cmake/cmake/CVE-2025-9301.patch b/meta/recipes-devtools/cmake/cmake/CVE-2025-9301.patch new file mode 100644 index 0000000000..2d8974e394 --- /dev/null +++ b/meta/recipes-devtools/cmake/cmake/CVE-2025-9301.patch @@ -0,0 +1,71 @@ +From 37e27f71bc356d880c908040cd0cb68fa2c371b8 Mon Sep 17 00:00:00 2001 +From: Tyler Yankee +Date: Wed, 13 Aug 2025 15:22:28 -0400 +Subject: [PATCH] foreach: Explicitly skip replay without iterations + +As written, foreach loops with a trailing `IN` (i.e., no loop +variable(s) given) lead to an assertion error. Handle this case by +exiting early when we know the loop won't execute anything. + +Fixes: #27135 + +CVE: CVE-2025-9301 + +Upstream-Status: Backport +https://gitlab.kitware.com/cmake/cmake/-/commit/37e27f71bc356d880c908040cd0cb68fa2c371b8 + +Signed-off-by: Tyler Yankee +Signed-off-by: Saravanan +--- + Source/cmForEachCommand.cxx | 3 +++ + Tests/RunCMake/foreach/RunCMakeTest.cmake | 1 + + Tests/RunCMake/foreach/TrailingIn-result.txt | 1 + + Tests/RunCMake/foreach/TrailingIn.cmake | 5 +++++ + 4 files changed, 10 insertions(+) + create mode 100644 Tests/RunCMake/foreach/TrailingIn-result.txt + create mode 100644 Tests/RunCMake/foreach/TrailingIn.cmake + +diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx +index 21a140d0..23f953a5 100644 +--- a/Source/cmForEachCommand.cxx ++++ b/Source/cmForEachCommand.cxx +@@ -101,6 +101,9 @@ bool cmForEachFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff, + bool cmForEachFunctionBlocker::Replay( + std::vector functions, cmExecutionStatus& inStatus) + { ++ if (this->Args.size() == this->IterationVarsCount) { ++ return true; ++ } + return this->ZipLists ? this->ReplayZipLists(functions, inStatus) + : this->ReplayItems(functions, inStatus); + } +diff --git a/Tests/RunCMake/foreach/RunCMakeTest.cmake b/Tests/RunCMake/foreach/RunCMakeTest.cmake +index 15ca4770..acfc742e 100644 +--- a/Tests/RunCMake/foreach/RunCMakeTest.cmake ++++ b/Tests/RunCMake/foreach/RunCMakeTest.cmake +@@ -22,3 +22,4 @@ run_cmake(foreach-RANGE-invalid-test) + run_cmake(foreach-RANGE-out-of-range-test) + run_cmake(foreach-var-scope-CMP0124-OLD) + run_cmake(foreach-var-scope-CMP0124-NEW) ++run_cmake(TrailingIn) +diff --git a/Tests/RunCMake/foreach/TrailingIn-result.txt b/Tests/RunCMake/foreach/TrailingIn-result.txt +new file mode 100644 +index 00000000..573541ac +--- /dev/null ++++ b/Tests/RunCMake/foreach/TrailingIn-result.txt +@@ -0,0 +1 @@ ++0 +diff --git a/Tests/RunCMake/foreach/TrailingIn.cmake b/Tests/RunCMake/foreach/TrailingIn.cmake +new file mode 100644 +index 00000000..e2b5b2f2 +--- /dev/null ++++ b/Tests/RunCMake/foreach/TrailingIn.cmake +@@ -0,0 +1,5 @@ ++foreach(v IN) ++endforeach() ++ ++foreach(v1 v2 IN) ++endforeach() +-- +2.44.3 + diff --git a/meta/recipes-devtools/cmake/cmake_3.28.3.bb b/meta/recipes-devtools/cmake/cmake_3.28.3.bb index 2d47b4c027..1841bfd1cf 100644 --- a/meta/recipes-devtools/cmake/cmake_3.28.3.bb +++ b/meta/recipes-devtools/cmake/cmake_3.28.3.bb @@ -11,6 +11,7 @@ SRC_URI:append:class-nativesdk = " \ file://cmake-setup.py \ file://environment.d-cmake.sh \ " +SRC_URI += "file://CVE-2025-9301.patch" LICENSE:append = " & BSD-1-Clause & MIT" LIC_FILES_CHKSUM:append = " \