diff options
| -rw-r--r-- | meta-oe/recipes-extended/hwloc/files/CVE-2022-47022.patch | 77 | ||||
| -rw-r--r-- | meta-oe/recipes-extended/hwloc/hwloc_1.11.13.bb | 4 |
2 files changed, 80 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..bfeb9b405d --- /dev/null +++ b/meta-oe/recipes-extended/hwloc/files/CVE-2022-47022.patch | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | From ac1f8db9a0790d2bf153711ff4cbf6101f89aace Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Brice Goglin <Brice.Goglin@inria.fr> | ||
| 3 | Date: Wed, 23 Aug 2023 19:52:47 +0200 | ||
| 4 | Subject: [PATCH] linux: handle glibc cpuset allocation failures | ||
| 5 | |||
| 6 | Closes #544 | ||
| 7 | CVE-2022-47022 | ||
| 8 | |||
| 9 | Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr> | ||
| 10 | |||
| 11 | CVE: CVE-2022-47022 | ||
| 12 | |||
| 13 | Upstream-Status: Backport [https://github.com/open-mpi/hwloc/commit/ac1f8db9a0790d2bf153711ff4cbf6101f89aace] | ||
| 14 | |||
| 15 | Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com> | ||
| 16 | --- | ||
| 17 | src/topology-linux.c | 15 ++++++++++++++- | ||
| 18 | 1 file changed, 14 insertions(+), 1 deletion(-) | ||
| 19 | |||
| 20 | diff --git a/src/topology-linux.c b/src/topology-linux.c | ||
| 21 | index 62c3b44..86be150 100644 | ||
| 22 | --- a/src/topology-linux.c | ||
| 23 | +++ b/src/topology-linux.c | ||
| 24 | @@ -623,6 +623,8 @@ hwloc_linux_set_tid_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, | ||
| 25 | |||
| 26 | setsize = CPU_ALLOC_SIZE(last+1); | ||
| 27 | plinux_set = CPU_ALLOC(last+1); | ||
| 28 | + if (!plinux_set) | ||
| 29 | + return -1; | ||
| 30 | |||
| 31 | CPU_ZERO_S(setsize, plinux_set); | ||
| 32 | hwloc_bitmap_foreach_begin(cpu, hwloc_set) | ||
| 33 | @@ -703,7 +705,10 @@ hwloc_linux_find_kernel_nr_cpus(hwloc_topology_t topology) | ||
| 34 | while (1) { | ||
| 35 | cpu_set_t *set = CPU_ALLOC(nr_cpus); | ||
| 36 | size_t setsize = CPU_ALLOC_SIZE(nr_cpus); | ||
| 37 | - int err = sched_getaffinity(0, setsize, set); /* always works, unless setsize is too small */ | ||
| 38 | + int err; | ||
| 39 | + if (!set) | ||
| 40 | + return -1; /* caller will return an error, and we'll try again later */ | ||
| 41 | + err = sched_getaffinity(0, setsize, set); /* always works, unless setsize is too small */ | ||
| 42 | CPU_FREE(set); | ||
| 43 | nr_cpus = setsize * 8; /* that's the value that was actually tested */ | ||
| 44 | if (!err) | ||
| 45 | @@ -732,8 +737,12 @@ hwloc_linux_get_tid_cpubind(hwloc_topology_t topology __hwloc_attribute_unused, | ||
| 46 | |||
| 47 | /* find the kernel nr_cpus so as to use a large enough cpu_set size */ | ||
| 48 | kernel_nr_cpus = hwloc_linux_find_kernel_nr_cpus(topology); | ||
| 49 | + if (kernel_nr_cpus < 0) | ||
| 50 | + return -1; | ||
| 51 | setsize = CPU_ALLOC_SIZE(kernel_nr_cpus); | ||
| 52 | plinux_set = CPU_ALLOC(kernel_nr_cpus); | ||
| 53 | + if (!plinux_set) | ||
| 54 | + return -1; | ||
| 55 | |||
| 56 | err = sched_getaffinity(tid, setsize, plinux_set); | ||
| 57 | |||
| 58 | @@ -1092,6 +1101,8 @@ hwloc_linux_set_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_c | ||
| 59 | |||
| 60 | setsize = CPU_ALLOC_SIZE(last+1); | ||
| 61 | plinux_set = CPU_ALLOC(last+1); | ||
| 62 | + if (!plinux_set) | ||
| 63 | + return -1; | ||
| 64 | |||
| 65 | CPU_ZERO_S(setsize, plinux_set); | ||
| 66 | hwloc_bitmap_foreach_begin(cpu, hwloc_set) | ||
| 67 | @@ -1184,6 +1195,8 @@ hwloc_linux_get_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_b | ||
| 68 | |||
| 69 | setsize = CPU_ALLOC_SIZE(last+1); | ||
| 70 | plinux_set = CPU_ALLOC(last+1); | ||
| 71 | + if (!plinux_set) | ||
| 72 | + return -1; | ||
| 73 | |||
| 74 | err = pthread_getaffinity_np(tid, setsize, plinux_set); | ||
| 75 | if (err) { | ||
| 76 | -- | ||
| 77 | 2.40.0 | ||
diff --git a/meta-oe/recipes-extended/hwloc/hwloc_1.11.13.bb b/meta-oe/recipes-extended/hwloc/hwloc_1.11.13.bb index e6fed584f9..83c85dbe3e 100644 --- a/meta-oe/recipes-extended/hwloc/hwloc_1.11.13.bb +++ b/meta-oe/recipes-extended/hwloc/hwloc_1.11.13.bb | |||
| @@ -7,7 +7,9 @@ SECTION = "base" | |||
| 7 | LICENSE = "BSD-3-Clause" | 7 | LICENSE = "BSD-3-Clause" |
| 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=3282e20dc3cec311deda3c6d4b1f990b" | 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=3282e20dc3cec311deda3c6d4b1f990b" |
| 9 | 9 | ||
| 10 | SRC_URI = "https://www.open-mpi.org/software/${BPN}/v1.11/downloads/${BP}.tar.bz2" | 10 | SRC_URI = "https://www.open-mpi.org/software/${BPN}/v1.11/downloads/${BP}.tar.bz2 \ |
| 11 | file://CVE-2022-47022.patch \ | ||
| 12 | " | ||
| 11 | SRC_URI[md5sum] = "3c792e23c209e9e1bafe9bdbc613d401" | 13 | SRC_URI[md5sum] = "3c792e23c209e9e1bafe9bdbc613d401" |
| 12 | SRC_URI[sha256sum] = "a4494b7765f517c0990d1c7f09d98cb87755bb6b841e4e2cbfebca1b14bac9c8" | 14 | SRC_URI[sha256sum] = "a4494b7765f517c0990d1c7f09d98cb87755bb6b841e4e2cbfebca1b14bac9c8" |
| 13 | 15 | ||
