!240 [sync] PR-239: fix lscpu core dump
From: @openeuler-sync-bot Reviewed-by: @openeuler-basic Signed-off-by: @openeuler-basic
This commit is contained in:
commit
a6674deaaf
28
backport-lscpu-don-t-use-NULL-sharedmap.patch
Normal file
28
backport-lscpu-don-t-use-NULL-sharedmap.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From 9ce09ccc3c8eee9be4fb5f33ae382d92c69dc411 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Wed, 20 Mar 2024 14:42:28 +0100
|
||||||
|
Subject: [PATCH] lscpu: don't use NULL sharedmap
|
||||||
|
|
||||||
|
Fixes: https://github.com/util-linux/util-linux/issues/2846
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
sys-utils/lscpu-topology.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/sys-utils/lscpu-topology.c b/sys-utils/lscpu-topology.c
|
||||||
|
index 7ee18e785..e3742e319 100644
|
||||||
|
--- a/sys-utils/lscpu-topology.c
|
||||||
|
+++ b/sys-utils/lscpu-topology.c
|
||||||
|
@@ -253,7 +253,8 @@ struct lscpu_cache *lscpu_cpu_get_cache(struct lscpu_cxt *cxt,
|
||||||
|
for (i = 0; i < cxt->ncaches; i++) {
|
||||||
|
struct lscpu_cache *ca = &cxt->caches[i];
|
||||||
|
|
||||||
|
- if (strcmp(ca->name, name) == 0 &&
|
||||||
|
+ if (ca->sharedmap &&
|
||||||
|
+ strcmp(ca->name, name) == 0 &&
|
||||||
|
CPU_ISSET_S(cpu->logical_id, cxt->setsize, ca->sharedmap))
|
||||||
|
return ca;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
63
backport-lscpu-use-topology-maps-in-more-robust-way.patch
Normal file
63
backport-lscpu-use-topology-maps-in-more-robust-way.patch
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
From 01cb80bae8e79b21067b4a85eb4f82b14104130c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Mon, 19 Sep 2022 13:30:14 +0200
|
||||||
|
Subject: [PATCH] lscpu: use topology maps in more robust way
|
||||||
|
|
||||||
|
Addresses: https://github.com/util-linux/util-linux/issues/1810
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
sys-utils/lscpu-topology.c | 16 +++++++++-------
|
||||||
|
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sys-utils/lscpu-topology.c b/sys-utils/lscpu-topology.c
|
||||||
|
index fe4da7cd5..754b3fcb4 100644
|
||||||
|
--- a/sys-utils/lscpu-topology.c
|
||||||
|
+++ b/sys-utils/lscpu-topology.c
|
||||||
|
@@ -106,7 +106,7 @@ static int cputype_read_topology(struct lscpu_cxt *cxt, struct lscpu_cputype *ct
|
||||||
|
struct lscpu_cpu *cpu = cxt->cpus[i];
|
||||||
|
cpu_set_t *thread_siblings = NULL, *core_siblings = NULL;
|
||||||
|
cpu_set_t *book_siblings = NULL, *drawer_siblings = NULL;
|
||||||
|
- int num, n;
|
||||||
|
+ int num, n = 0;
|
||||||
|
|
||||||
|
if (!cpu || cpu->type != ct)
|
||||||
|
continue;
|
||||||
|
@@ -126,7 +126,8 @@ static int cputype_read_topology(struct lscpu_cxt *cxt, struct lscpu_cputype *ct
|
||||||
|
ul_path_readf_cpuset(sys, &drawer_siblings, cxt->maxcpus,
|
||||||
|
"cpu%d/topology/drawer_siblings", num);
|
||||||
|
|
||||||
|
- n = CPU_COUNT_S(cxt->setsize, thread_siblings);
|
||||||
|
+ if (thread_siblings)
|
||||||
|
+ n = CPU_COUNT_S(cxt->setsize, thread_siblings);
|
||||||
|
if (!n)
|
||||||
|
n = 1;
|
||||||
|
if (n > nthreads)
|
||||||
|
@@ -140,9 +141,9 @@ static int cputype_read_topology(struct lscpu_cxt *cxt, struct lscpu_cputype *ct
|
||||||
|
* E.g. completely virtualized architectures like s390 may
|
||||||
|
* have multiple sockets of different sizes.
|
||||||
|
*/
|
||||||
|
- if (!ct->coremaps)
|
||||||
|
+ if (!ct->coremaps && thread_siblings)
|
||||||
|
ct->coremaps = xcalloc(npos, sizeof(cpu_set_t *));
|
||||||
|
- if (!ct->socketmaps)
|
||||||
|
+ if (!ct->socketmaps && core_siblings)
|
||||||
|
ct->socketmaps = xcalloc(npos, sizeof(cpu_set_t *));
|
||||||
|
if (!ct->bookmaps && book_siblings)
|
||||||
|
ct->bookmaps = xcalloc(npos, sizeof(cpu_set_t *));
|
||||||
|
@@ -150,9 +151,10 @@ static int cputype_read_topology(struct lscpu_cxt *cxt, struct lscpu_cputype *ct
|
||||||
|
ct->drawermaps = xcalloc(npos, sizeof(cpu_set_t *));
|
||||||
|
|
||||||
|
/* add to topology maps */
|
||||||
|
- add_cpuset_to_array(ct->coremaps, &ct->ncores, thread_siblings, cxt->setsize);
|
||||||
|
- add_cpuset_to_array(ct->socketmaps, &ct->nsockets, core_siblings, cxt->setsize);
|
||||||
|
-
|
||||||
|
+ if (thread_siblings)
|
||||||
|
+ add_cpuset_to_array(ct->coremaps, &ct->ncores, thread_siblings, cxt->setsize);
|
||||||
|
+ if (core_siblings)
|
||||||
|
+ add_cpuset_to_array(ct->socketmaps, &ct->nsockets, core_siblings, cxt->setsize);
|
||||||
|
if (book_siblings)
|
||||||
|
add_cpuset_to_array(ct->bookmaps, &ct->nbooks, book_siblings, cxt->setsize);
|
||||||
|
if (drawer_siblings)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Name: util-linux
|
Name: util-linux
|
||||||
Version: 2.37.2
|
Version: 2.37.2
|
||||||
Release: 29
|
Release: 30
|
||||||
Summary: A random collection of Linux utilities
|
Summary: A random collection of Linux utilities
|
||||||
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
|
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
|
||||||
URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
|
URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
|
||||||
@ -144,6 +144,8 @@ Patch6122: backport-sys-utils-lscpu-Unblock-SIGSEGV-before-vmware_bdoor.pat
|
|||||||
Patch6123: backport-libblkid-Check-offset-in-LUKS2-header.patch
|
Patch6123: backport-libblkid-Check-offset-in-LUKS2-header.patch
|
||||||
Patch6124: backport-more-fix-poll-use.patch
|
Patch6124: backport-more-fix-poll-use.patch
|
||||||
Patch6125: backport-CVE-2024-28085.patch
|
Patch6125: backport-CVE-2024-28085.patch
|
||||||
|
Patch6126: backport-lscpu-don-t-use-NULL-sharedmap.patch
|
||||||
|
Patch6127: backport-lscpu-use-topology-maps-in-more-robust-way.patch
|
||||||
|
|
||||||
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
|
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
|
||||||
Patch9001: SKIPPED-no-root-permissions-test.patch
|
Patch9001: SKIPPED-no-root-permissions-test.patch
|
||||||
@ -517,6 +519,15 @@ fi
|
|||||||
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
|
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Apr 28 2024 zhangyao <zhangyao108@huawei.com> - 2.37.2-30
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:fix lscpu core dump
|
||||||
|
backport-lscpu-don-t-use-NULL-sharedmap.patch
|
||||||
|
backport-lscpu-use-topology-maps-in-more-robust-way.patch
|
||||||
|
|
||||||
|
|
||||||
* Mon Apr 22 2024 zhangyao <zhangyao108@huawei.com> - 2.37.2-29
|
* Mon Apr 22 2024 zhangyao <zhangyao108@huawei.com> - 2.37.2-29
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user