summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPolampalli, Archana <archana.polampalli@windriver.com>2023-08-30 09:21:58 +0000
committerArmin Kuster <akuster808@gmail.com>2023-08-31 09:10:29 -0400
commitc5a65353e194dc51422c652fd63466329a4324a5 (patch)
tree98ce9fd1a110c7e5c04a67666f2a1f04c6429f53
parent3862ca8fe196e4bbb4794d9f24ac2da7a7546ea3 (diff)
downloadmeta-openembedded-c5a65353e194dc51422c652fd63466329a4324a5.tar.gz
hwloc: fix CVE-2022-47022
An issue was discovered in open-mpi hwloc 2.1.0 allows attackers to cause a denial of service or other unspecified impacts via glibc-cpuset in topology-linux.c. References: https://nvd.nist.gov/vuln/detail/CVE-2022-47022 https://github.com/open-mpi/hwloc/issues/544 Upstream patches: https://github.com/open-mpi/hwloc/commit/ac1f8db9a0790d2bf153711ff4cbf6101f89aace Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-extended/hwloc/files/CVE-2022-47022.patch76
-rw-r--r--meta-oe/recipes-extended/hwloc/hwloc_2.9.0.bb4
2 files changed, 79 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/hwloc/files/CVE-2022-47022.patch b/meta-oe/recipes-extended/hwloc/files/CVE-2022-47022.patch
new file mode 100644
index 0000000000..1925e2605d
--- /dev/null
+++ b/meta-oe/recipes-extended/hwloc/files/CVE-2022-47022.patch
@@ -0,0 +1,76 @@
1From ac1f8db9a0790d2bf153711ff4cbf6101f89aace Mon Sep 17 00:00:00 2001
2From: Brice Goglin <Brice.Goglin@inria.fr>
3Date: Wed, 23 Aug 2023 19:52:47 +0200
4Subject: [PATCH] linux: handle glibc cpuset allocation failures
5
6Closes #544
7CVE-2022-47022
8
9CVE: CVE-2022-47022
10
11Upstream-Status: Backport [https://github.com/open-mpi/hwloc/commit/ac1f8db9a0790d2bf153711ff4cbf6101f89aace]
12
13Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
14Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
15---
16 hwloc/topology-linux.c | 15 ++++++++++++++-
17 1 file changed, 14 insertions(+), 1 deletion(-)
18
19diff --git a/hwloc/topology-linux.c b/hwloc/topology-linux.c
20index 3f059465d..030076e7f 100644
21--- a/hwloc/topology-linux.c
22+++ b/hwloc/topology-linux.c
23@@ -878,6 +878,8 @@ hwloc_linux_set_tid_cpubind(hwloc_topology_t topology __hwloc_attribute_unused,
24
25 setsize = CPU_ALLOC_SIZE(last+1);
26 plinux_set = CPU_ALLOC(last+1);
27+ if (!plinux_set)
28+ return -1;
29
30 CPU_ZERO_S(setsize, plinux_set);
31 hwloc_bitmap_foreach_begin(cpu, hwloc_set)
32@@ -958,7 +960,10 @@ hwloc_linux_find_kernel_nr_cpus(hwloc_topology_t topology)
33 while (1) {
34 cpu_set_t *set = CPU_ALLOC(nr_cpus);
35 size_t setsize = CPU_ALLOC_SIZE(nr_cpus);
36- int err = sched_getaffinity(0, setsize, set); /* always works, unless setsize is too small */
37+ int err;
38+ if (!set)
39+ return -1; /* caller will return an error, and we'll try again later */
40+ err = sched_getaffinity(0, setsize, set); /* always works, unless setsize is too small */
41 CPU_FREE(set);
42 nr_cpus = setsize * 8; /* that's the value that was actually tested */
43 if (!err)
44@@ -986,8 +991,12 @@ hwloc_linux_get_tid_cpubind(hwloc_topology_t topology __hwloc_attribute_unused,
45
46 /* find the kernel nr_cpus so as to use a large enough cpu_set size */
47 kernel_nr_cpus = hwloc_linux_find_kernel_nr_cpus(topology);
48+ if (kernel_nr_cpus < 0)
49+ return -1;
50 setsize = CPU_ALLOC_SIZE(kernel_nr_cpus);
51 plinux_set = CPU_ALLOC(kernel_nr_cpus);
52+ if (!plinux_set)
53+ return -1;
54
55 err = sched_getaffinity(tid, setsize, plinux_set);
56
57@@ -1341,6 +1350,8 @@ hwloc_linux_set_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_c
58
59 setsize = CPU_ALLOC_SIZE(last+1);
60 plinux_set = CPU_ALLOC(last+1);
61+ if (!plinux_set)
62+ return -1;
63
64 CPU_ZERO_S(setsize, plinux_set);
65 hwloc_bitmap_foreach_begin(cpu, hwloc_set)
66@@ -1432,6 +1443,8 @@ hwloc_linux_get_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_b
67
68 setsize = CPU_ALLOC_SIZE(last+1);
69 plinux_set = CPU_ALLOC(last+1);
70+ if (!plinux_set)
71+ return -1;
72
73 err = pthread_getaffinity_np(tid, setsize, plinux_set);
74 if (err) {
75--
762.40.0
diff --git a/meta-oe/recipes-extended/hwloc/hwloc_2.9.0.bb b/meta-oe/recipes-extended/hwloc/hwloc_2.9.0.bb
index 51ceb4c262..ee766c8391 100644
--- a/meta-oe/recipes-extended/hwloc/hwloc_2.9.0.bb
+++ b/meta-oe/recipes-extended/hwloc/hwloc_2.9.0.bb
@@ -7,7 +7,9 @@ SECTION = "base"
7LICENSE = "BSD-3-Clause" 7LICENSE = "BSD-3-Clause"
8LIC_FILES_CHKSUM = "file://COPYING;md5=79179bb373cd55cbd834463a514fb714" 8LIC_FILES_CHKSUM = "file://COPYING;md5=79179bb373cd55cbd834463a514fb714"
9 9
10SRC_URI = "https://www.open-mpi.org/software/${BPN}/v2.9/downloads/${BP}.tar.bz2" 10SRC_URI = "https://www.open-mpi.org/software/${BPN}/v2.9/downloads/${BP}.tar.bz2 \
11 file://CVE-2022-47022.patch \
12 "
11SRC_URI[sha256sum] = "2070e963596a2421b9af8eca43bdec113ee1107aaf7ccb475d4d3767a8856887" 13SRC_URI[sha256sum] = "2070e963596a2421b9af8eca43bdec113ee1107aaf7ccb475d4d3767a8856887"
12UPSTREAM_CHECK_URI = "https://www.open-mpi.org/software/hwloc/v2.9/" 14UPSTREAM_CHECK_URI = "https://www.open-mpi.org/software/hwloc/v2.9/"
13 15