summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorSaravanan <saravanan.kadambathursubramaniyam@windriver.com>2025-10-16 19:37:58 +0530
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-10-27 11:37:43 +0000
commit6f85697140fe4a6a53b480e7164391fd5edcd6a5 (patch)
tree1a428844aaa3b6898692eb231de8a51f3a633608 /meta/recipes-devtools
parent2111e3d4af7a3ce7e712a5b009c05c19fa797d8a (diff)
downloadpoky-6f85697140fe4a6a53b480e7164391fd5edcd6a5.tar.gz
cmake: fix CVE-2025-9301
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 (From OE-Core rev: d31b2201bba808ec82c8d88df25b1106c588720e) Signed-off-by: Saravanan <saravanan.kadambathursubramaniyam@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/cmake/cmake/CVE-2025-9301.patch71
-rw-r--r--meta/recipes-devtools/cmake/cmake_4.1.2.bb2
2 files changed, 73 insertions, 0 deletions
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..5e765c6d9d
--- /dev/null
+++ b/meta/recipes-devtools/cmake/cmake/CVE-2025-9301.patch
@@ -0,0 +1,71 @@
1From 37e27f71bc356d880c908040cd0cb68fa2c371b8 Mon Sep 17 00:00:00 2001
2From: Tyler Yankee <tyler.yankee@kitware.com>
3Date: Wed, 13 Aug 2025 15:22:28 -0400
4Subject: [PATCH] foreach: Explicitly skip replay without iterations
5
6As written, foreach loops with a trailing `IN` (i.e., no loop
7variable(s) given) lead to an assertion error. Handle this case by
8exiting early when we know the loop won't execute anything.
9
10Fixes: #27135
11
12CVE: CVE-2025-9301
13
14Upstream-Status: Backport
15https://gitlab.kitware.com/cmake/cmake/-/commit/37e27f71bc356d880c908040cd0cb68fa2c371b8
16
17Signed-off-by: Tyler Yankee <tyler.yankee@kitware.com>
18Signed-off-by: Saravanan <saravanan.kadambathursubramaniyam@windriver.com>
19---
20 Source/cmForEachCommand.cxx | 3 +++
21 Tests/RunCMake/foreach/RunCMakeTest.cmake | 1 +
22 Tests/RunCMake/foreach/TrailingIn-result.txt | 1 +
23 Tests/RunCMake/foreach/TrailingIn.cmake | 5 +++++
24 4 files changed, 10 insertions(+)
25 create mode 100644 Tests/RunCMake/foreach/TrailingIn-result.txt
26 create mode 100644 Tests/RunCMake/foreach/TrailingIn.cmake
27
28diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
29index 96867e26..8b741183 100644
30--- a/Source/cmForEachCommand.cxx
31+++ b/Source/cmForEachCommand.cxx
32@@ -100,6 +100,9 @@ bool cmForEachFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
33 bool cmForEachFunctionBlocker::Replay(
34 std::vector<cmListFileFunction> functions, cmExecutionStatus& inStatus)
35 {
36+ if (this->Args.size() == this->IterationVarsCount) {
37+ return true;
38+ }
39 return this->ZipLists ? this->ReplayZipLists(functions, inStatus)
40 : this->ReplayItems(functions, inStatus);
41 }
42diff --git a/Tests/RunCMake/foreach/RunCMakeTest.cmake b/Tests/RunCMake/foreach/RunCMakeTest.cmake
43index 15ca4770..acfc742e 100644
44--- a/Tests/RunCMake/foreach/RunCMakeTest.cmake
45+++ b/Tests/RunCMake/foreach/RunCMakeTest.cmake
46@@ -22,3 +22,4 @@ run_cmake(foreach-RANGE-invalid-test)
47 run_cmake(foreach-RANGE-out-of-range-test)
48 run_cmake(foreach-var-scope-CMP0124-OLD)
49 run_cmake(foreach-var-scope-CMP0124-NEW)
50+run_cmake(TrailingIn)
51diff --git a/Tests/RunCMake/foreach/TrailingIn-result.txt b/Tests/RunCMake/foreach/TrailingIn-result.txt
52new file mode 100644
53index 00000000..573541ac
54--- /dev/null
55+++ b/Tests/RunCMake/foreach/TrailingIn-result.txt
56@@ -0,0 +1 @@
57+0
58diff --git a/Tests/RunCMake/foreach/TrailingIn.cmake b/Tests/RunCMake/foreach/TrailingIn.cmake
59new file mode 100644
60index 00000000..e2b5b2f2
61--- /dev/null
62+++ b/Tests/RunCMake/foreach/TrailingIn.cmake
63@@ -0,0 +1,5 @@
64+foreach(v IN)
65+endforeach()
66+
67+foreach(v1 v2 IN)
68+endforeach()
69--
702.48.1
71
diff --git a/meta/recipes-devtools/cmake/cmake_4.1.2.bb b/meta/recipes-devtools/cmake/cmake_4.1.2.bb
index cfc5cb1b93..de86625892 100644
--- a/meta/recipes-devtools/cmake/cmake_4.1.2.bb
+++ b/meta/recipes-devtools/cmake/cmake_4.1.2.bb
@@ -11,6 +11,8 @@ SRC_URI:append:class-nativesdk = " \
11 file://environment.d-cmake.sh \ 11 file://environment.d-cmake.sh \
12" 12"
13 13
14SRC_URI += "file://CVE-2025-9301.patch"
15
14LICENSE:append = " & BSD-1-Clause & MIT" 16LICENSE:append = " & BSD-1-Clause & MIT"
15LIC_FILES_CHKSUM:append = " \ 17LIC_FILES_CHKSUM:append = " \
16 file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \ 18 file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \