diff --git a/SPECS/openmpi/CVE-2022-47022.patch b/SPECS/openmpi/CVE-2022-47022.patch new file mode 100644 index 00000000000..aad2c0792be --- /dev/null +++ b/SPECS/openmpi/CVE-2022-47022.patch @@ -0,0 +1,68 @@ +From 55f49f6a6cd0cff80da956fe9740f18dd624becd Mon Sep 17 00:00:00 2001 +From: jykanase +Date: Wed, 12 Feb 2025 06:46:52 +0000 +Subject: [PATCH] CVE-2022-47022 + +--- + .../hwloc/hwloc201/hwloc/hwloc/topology-linux.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/opal/mca/hwloc/hwloc201/hwloc/hwloc/topology-linux.c b/opal/mca/hwloc/hwloc201/hwloc/hwloc/topology-linux.c +index 2c60b1e..62ddedf 100644 +--- a/opal/mca/hwloc/hwloc201/hwloc/hwloc/topology-linux.c ++++ b/opal/mca/hwloc/hwloc201/hwloc/hwloc/topology-linux.c +@@ -806,6 +806,8 @@ hwloc_linux_set_tid_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, + + setsize = CPU_ALLOC_SIZE(last+1); + plinux_set = CPU_ALLOC(last+1); ++ if (!plinux_set) ++ return -1; + + CPU_ZERO_S(setsize, plinux_set); + hwloc_bitmap_foreach_begin(cpu, hwloc_set) +@@ -886,7 +888,10 @@ hwloc_linux_find_kernel_nr_cpus(hwloc_topology_t topology) + while (1) { + cpu_set_t *set = CPU_ALLOC(nr_cpus); + size_t setsize = CPU_ALLOC_SIZE(nr_cpus); +- int err = sched_getaffinity(0, setsize, set); /* always works, unless setsize is too small */ ++ int err; ++ if (!set) ++ return -1; /* caller will return an error, and we'll try again later */ ++ err = sched_getaffinity(0, setsize, set); /* always works, unless setsize is too small */ + CPU_FREE(set); + nr_cpus = setsize * 8; /* that's the value that was actually tested */ + if (!err) +@@ -914,8 +919,12 @@ hwloc_linux_get_tid_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, + + /* find the kernel nr_cpus so as to use a large enough cpu_set size */ + kernel_nr_cpus = hwloc_linux_find_kernel_nr_cpus(topology); ++ if (kernel_nr_cpus < 0) ++ return -1; + setsize = CPU_ALLOC_SIZE(kernel_nr_cpus); + plinux_set = CPU_ALLOC(kernel_nr_cpus); ++ if (!plinux_set) ++ return -1; + + err = sched_getaffinity(tid, setsize, plinux_set); + +@@ -1269,6 +1278,8 @@ hwloc_linux_set_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_c + + setsize = CPU_ALLOC_SIZE(last+1); + plinux_set = CPU_ALLOC(last+1); ++ if (!plinux_set) ++ return -1; + + CPU_ZERO_S(setsize, plinux_set); + hwloc_bitmap_foreach_begin(cpu, hwloc_set) +@@ -1360,6 +1371,8 @@ hwloc_linux_get_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_b + + setsize = CPU_ALLOC_SIZE(last+1); + plinux_set = CPU_ALLOC(last+1); ++ if (!plinux_set) ++ return -1; + + err = pthread_getaffinity_np(tid, setsize, plinux_set); + if (err) { +-- +2.45.2 + diff --git a/SPECS/openmpi/openmpi.spec b/SPECS/openmpi/openmpi.spec index beb8bd84f1e..16d05ec74ac 100644 --- a/SPECS/openmpi/openmpi.spec +++ b/SPECS/openmpi/openmpi.spec @@ -28,7 +28,7 @@ Summary: Open Message Passing Interface Name: openmpi%{?_cc_name_suffix} Version: 4.1.7 -Release: 1%{?dist} +Release: 2%{?dist} License: BSD AND MIT Vendor: Microsoft Corporation Distribution: Azure Linux @@ -38,6 +38,7 @@ Source0: https://www.open-mpi.org/software/ompi/v4.1/downloads/openmpi-%{ Source1: openmpi.module.in Source3: openmpi.pth.py3 Source4: macros.openmpi +Patch0: CVE-2022-47022.patch BuildRequires: gcc-c++ BuildRequires: gcc-gfortran BuildRequires: hwloc-devel @@ -304,6 +305,9 @@ make check %{python3_sitearch}/openmpi.pth %changelog +* Wed Feb 12 2025 Jyoti Kanase - 4.1.7-2 +- Patch to fix CVE-2022-47022 + * Thu Jan 09 2025 Alberto David Perez Guevara - 4.1.7-1 - Upgrade to 4.1.7 - Azure Linux 3.0 - package upgrades