Accepting request 621187 from SUSE:SLE-15:GA

bsc#1091164
bsc#1072947
bsc#1080740

boo#1100255

OBS-URL: https://build.opensuse.org/request/show/621187
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=376
This commit is contained in:
Dirk Mueller 2018-07-09 16:37:09 +00:00 committed by Git OBS Bridge
parent 50b0c730e5
commit 2bf68516b3
11 changed files with 446 additions and 0 deletions

View File

@ -4,6 +4,25 @@ Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
- Do not run rfkill-block@.service and rfkill-unblock@service as it
is just template without parameter bsc#1092820 bsc#1093176
-------------------------------------------------------------------
Thu May 10 17:22:14 CEST 2018 - sbrabec@suse.com
- Fix lscpu and chcpu on systems with >1024 cores
(bnc#1091164, util-linux-lscpu-chcpu-new-cpu-macros.patch).
- Fix CPU count in chcpu
(bnc#1091164, util-linux-chcpu-cpu-count.patch).
-------------------------------------------------------------------
Thu Apr 19 19:30:25 CEST 2018 - sbrabec@suse.com
- Backport three upstream patches:
* Fix crash loop in lscpu
(bsc#1072947, util-linux-lscpu-loop.patch).
* Fix possible segfault of umount -a
(util-linux-libmount-umount-a-segfault.patch).
* Fix mount -a on NFS bind mounts (bsc#1080740,
util-linux-libmount-mount-a-nfs-bind-mount.patch).
-------------------------------------------------------------------
Thu Apr 12 17:09:30 CEST 2018 - sbrabec@suse.com

View File

@ -174,6 +174,16 @@ Patch5: util-linux-cramfs.patch
Patch6: util-linux-fincore-count.patch
# PATCH-FIX-UPSTREAM util-linux-sysfs-nvme-devno.patch bsc1078662 sbrabec@suse.com -- Fix lsblk on NVMe.
Patch7: util-linux-sysfs-nvme-devno.patch
# PATCH-FIX-UPSTREAM util-linux-lscpu-loop.patch bsc1072947 sbrabec@suse.com -- Fix crash loop in lscpu.
Patch8: util-linux-lscpu-loop.patch
# PATCH-FIX-UPSTREAM util-linux-libmount-umount-a-segfault.patch sbrabec@suse.com -- Fix possible segfault of umount -a.
Patch9: util-linux-libmount-umount-a-segfault.patch
# PATCH-FIX-UPSTREAM util-linux-libmount-mount-a-nfs-bind-mount.patch bsc1080740 sbrabec@suse.com -- Fix mount -a on NFS bind mounts.
Patch10: util-linux-libmount-mount-a-nfs-bind-mount.patch
# PATCH-FIX-UPSTREAM util-linux-lscpu-chcpu-new-cpu-macros.patch bnc1091164 sbrabec@suse.com -- Fix lscpu and chcpu on systems with >1024 cores.
Patch11: util-linux-lscpu-chcpu-new-cpu-macros.patch
# PATCH-FIX-UPSTREAM util-linux-chcpu-cpu-count.patch bnc1091164 sbrabec@suse.com -- chcpu: Properly count CPUs.
Patch12: util-linux-chcpu-cpu-count.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
%if %build_util_linux
@ -417,6 +427,11 @@ library.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
#
# setctsid
cp -p %{S:22} %{S:23} .

View File

@ -0,0 +1,72 @@
From 607274943bfd3d4856b872bc4278b36903fb2182 Mon Sep 17 00:00:00 2001
From: Stanislav Brabec <sbrabec@suse.cz>
Date: Wed, 9 May 2018 22:13:07 +0200
Subject: [PATCH] chcpu: Fix maximal number of CPUs
chcpu.c mixed maxcpus (number of cpus) and setsize (size of CPU bit
mask). It effectively limits number of CPUs to 1/8 of the supported
amount.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Michael Matz <matz@suse.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
---
sys-utils/chcpu.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
index f32b7a6fc..4b5c7579a 100644
--- a/sys-utils/chcpu.c
+++ b/sys-utils/chcpu.c
@@ -75,12 +75,12 @@ enum {
*/
static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
{
- unsigned int cpu;
+ int cpu;
int online, rc;
int configured = -1;
- size_t fails = 0;
+ int fails = 0;
- for (cpu = 0; cpu < setsize; cpu++) {
+ for (cpu = 0; cpu < maxcpus; cpu++) {
if (!CPU_ISSET_S(cpu, setsize, cpu_set))
continue;
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
@@ -132,7 +132,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
}
}
- return fails == 0 ? 0 : fails == setsize ? -1 : 1;
+ return fails == 0 ? 0 : fails == maxcpus ? -1 : 1;
}
static int cpu_rescan(void)
@@ -168,11 +168,11 @@ static int cpu_set_dispatch(int mode)
*/
static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
{
- unsigned int cpu;
+ int cpu;
int rc, current;
- size_t fails = 0;
+ int fails = 0;
- for (cpu = 0; cpu < setsize; cpu++) {
+ for (cpu = 0; cpu < maxcpus; cpu++) {
if (!CPU_ISSET_S(cpu, setsize, cpu_set))
continue;
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
@@ -217,7 +217,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
}
}
- return fails == 0 ? 0 : fails == setsize ? -1 : 1;
+ return fails == 0 ? 0 : fails == maxcpus ? -1 : 1;
}
static void cpu_parse(char *cpu_string, cpu_set_t *cpu_set, size_t setsize)
--
2.16.3

View File

@ -0,0 +1,73 @@
From 7966cbba53890e1010861b75bd9923e793bbc975 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Wed, 18 Apr 2018 13:31:38 +1000
Subject: [PATCH] libmount: fix mnt_table_is_fs_mounted() for NFS bind mounts.
When you bind-mount a subdirectory of a local filesystem, the
path to that subdirectory appears as the fourth field in mountinfo.
For nfs mounts, the fourth field is always "/", and the subdirectory
part is appended to the "special" (aka "device") field. This is
consistent with historical NFS usage which always includes a path in
the fs_spec field.
libmount needs to know about this when "mount -a" checks to see if
a filesystem is already mounted.
Without this fix, fstab lines like:
server::/path /dir nfs defaults 0 0
/dir/subdir /mnt/test none bind 0 0
result in a new mount at /mnt/test every time "mount -a" is run.
[kzak@redhat.com: - use strappend() rather than asprintf()]
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libmount/src/tab.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 968057e42..eb61dd33e 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -1542,6 +1542,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
struct libmnt_fs *fs;
char *root = NULL;
+ char *src2 = NULL;
const char *src = NULL, *tgt = NULL;
char *xtgt = NULL;
int rc = 0;
@@ -1566,8 +1567,17 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
flags = MS_BIND;
rootfs = mnt_table_get_fs_root(tb, fstab_fs, flags, &root);
- if (rootfs)
+ if (rootfs) {
+ const char *fstype = mnt_fs_get_fstype(rootfs);
+
src = mnt_fs_get_srcpath(rootfs);
+ if (fstype && strncmp(fstype, "nfs", 3) == 0 && root) {
+ /* NFS stores the root at the end of the source */
+ src = src2 = strappend(src, root);
+ free(root);
+ root = NULL;
+ }
+ }
}
if (!src)
@@ -1667,6 +1677,7 @@ done:
free(root);
DBG(TAB, ul_debugobj(tb, "mnt_table_is_fs_mounted: %s [rc=%d]", src, rc));
+ free(src2);
return rc;
}
--
2.16.3

View File

@ -0,0 +1,34 @@
From f958101d2ea55174f8cd584efe41d4cefa9578c6 Mon Sep 17 00:00:00 2001
From: Richard Fuchs <rfuchs@sipwise.com>
Date: Tue, 17 Apr 2018 09:40:20 -0400
Subject: [PATCH] bugfix: fix possible segfault during umount -a
mnt_context_get_mtab() doesn't set its return **tb argument on error,
and so in mnt_context_next_umount() mtab will remain uninitialized on
error, later resulting in cxt->mtab containing garbage, possibly
resulting in segfault on exit.
---
libmount/src/context_umount.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 45651b58e..240ec3be6 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -1003,11 +1003,12 @@ int mnt_context_next_umount(struct libmnt_context *cxt,
rc = mnt_context_get_mtab(cxt, &mtab);
cxt->mtab = NULL; /* do not reset mtab */
mnt_reset_context(cxt);
- cxt->mtab = mtab;
if (rc)
return rc;
+ cxt->mtab = mtab;
+
do {
rc = mnt_table_next_fs(mtab, itr, fs);
if (rc != 0)
--
2.16.3

View File

@ -0,0 +1,110 @@
From 538b50cb0a4aac56b6b3b6e4d1e8ce886854c6d8 Mon Sep 17 00:00:00 2001
From: Stanislav Brabec <sbrabec@suse.cz>
Date: Wed, 9 May 2018 18:08:32 +0200
Subject: [PATCH] lscpu, chcpu: Avoid use of the old CPU macros
The old CPU macros are limited to 1024 cores. As a result, lscpu cannot
count sockets on large systems. Use new scalable macros.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Michael Matz <matz@suse.de>
---
sys-utils/chcpu.c | 6 +++---
sys-utils/lscpu.c | 13 +++++++++----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
index 12e52d887..f32b7a6fc 100644
--- a/sys-utils/chcpu.c
+++ b/sys-utils/chcpu.c
@@ -81,7 +81,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
size_t fails = 0;
for (cpu = 0; cpu < setsize; cpu++) {
- if (!CPU_ISSET(cpu, cpu_set))
+ if (!CPU_ISSET_S(cpu, setsize, cpu_set))
continue;
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
warnx(_("CPU %u does not exist"), cpu);
@@ -127,7 +127,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
} else {
printf(_("CPU %u disabled\n"), cpu);
if (onlinecpus)
- CPU_CLR(cpu, onlinecpus);
+ CPU_CLR_S(cpu, setsize, onlinecpus);
}
}
}
@@ -173,7 +173,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
size_t fails = 0;
for (cpu = 0; cpu < setsize; cpu++) {
- if (!CPU_ISSET(cpu, cpu_set))
+ if (!CPU_ISSET_S(cpu, setsize, cpu_set))
continue;
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
warnx(_("CPU %u does not exist"), cpu);
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 2132511a5..fd6d63bbf 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -478,7 +478,7 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
desc->idx2cpunum = xcalloc(desc->ncpuspos, sizeof(int));
for (num = 0, idx = 0; num < maxcpus; num++) {
- if (CPU_ISSET(num, tmp))
+ if (CPU_ISSET_S(num, setsize, tmp))
desc->idx2cpunum[idx++] = num;
}
cpuset_free(tmp);
@@ -1109,10 +1109,11 @@ cpu_max_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
{
int i;
float cpu_freq = 0.0;
+ size_t setsize = CPU_ALLOC_SIZE(maxcpus);
if (desc->present) {
for (i = 0; i < desc->ncpuspos; i++) {
- if (CPU_ISSET(real_cpu_num(desc, i), desc->present)
+ if (CPU_ISSET_S(real_cpu_num(desc, i), setsize, desc->present)
&& desc->maxmhz[i]) {
float freq = atof(desc->maxmhz[i]);
@@ -1131,10 +1132,11 @@ cpu_min_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
{
int i;
float cpu_freq = -1.0;
+ size_t setsize = CPU_ALLOC_SIZE(maxcpus);
if (desc->present) {
for (i = 0; i < desc->ncpuspos; i++) {
- if (CPU_ISSET(real_cpu_num(desc, i), desc->present)
+ if (CPU_ISSET_S(real_cpu_num(desc, i), setsize, desc->present)
&& desc->minmhz[i]) {
float freq = atof(desc->minmhz[i]);
@@ -1931,6 +1933,7 @@ int main(int argc, char *argv[])
int c, i;
int columns[ARRAY_SIZE(coldescs)], ncolumns = 0;
int cpu_modifier_specified = 0;
+ size_t setsize;
static const struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
@@ -2034,10 +2037,12 @@ int main(int argc, char *argv[])
read_basicinfo(desc, mod);
+ setsize = CPU_ALLOC_SIZE(maxcpus);
+
for (i = 0; i < desc->ncpuspos; i++) {
/* only consider present CPUs */
if (desc->present &&
- !CPU_ISSET(real_cpu_num(desc, i), desc->present))
+ !CPU_ISSET_S(real_cpu_num(desc, i), setsize, desc->present))
continue;
read_topology(desc, i);
read_cache(desc, i);
--
2.16.3

View File

@ -0,0 +1,55 @@
From 95f09bc63c564c50ec2c393352801cc056faaea2 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dmueller@suse.com>
Date: Sat, 17 Mar 2018 13:18:38 +0100
Subject: [PATCH] Avoid crash in min/max caculation when cpu#0 being offline
When cpu#0 is offline, atof(NULL) is called which causes
a segfault or endless loop depending on implementation
circumstances. So instead of implicitely assumping that the
first cpu is always available, do the presence checks for
all including the first one.
---
sys-utils/lscpu.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 6d1fde555..2132511a5 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1108,10 +1108,10 @@ static char *
cpu_max_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
{
int i;
- float cpu_freq = atof(desc->maxmhz[0]);
+ float cpu_freq = 0.0;
if (desc->present) {
- for (i = 1; i < desc->ncpuspos; i++) {
+ for (i = 0; i < desc->ncpuspos; i++) {
if (CPU_ISSET(real_cpu_num(desc, i), desc->present)
&& desc->maxmhz[i]) {
float freq = atof(desc->maxmhz[i]);
@@ -1129,16 +1129,16 @@ cpu_max_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
static char *
cpu_min_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
{
- int i;
- float cpu_freq = atof(desc->minmhz[0]);
+ int i;
+ float cpu_freq = -1.0;
if (desc->present) {
- for (i = 1; i < desc->ncpuspos; i++) {
+ for (i = 0; i < desc->ncpuspos; i++) {
if (CPU_ISSET(real_cpu_num(desc, i), desc->present)
&& desc->minmhz[i]) {
float freq = atof(desc->minmhz[i]);
- if (freq < cpu_freq)
+ if (cpu_freq < 0.0 || freq < cpu_freq)
cpu_freq = freq;
}
}
--
2.16.3

View File

@ -4,6 +4,25 @@ Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
- Do not run rfkill-block@.service and rfkill-unblock@service as it
is just template without parameter bsc#1092820 bsc#1093176
-------------------------------------------------------------------
Thu May 10 17:22:14 CEST 2018 - sbrabec@suse.com
- Fix lscpu and chcpu on systems with >1024 cores
(bnc#1091164, util-linux-lscpu-chcpu-new-cpu-macros.patch).
- Fix CPU count in chcpu
(bnc#1091164, util-linux-chcpu-cpu-count.patch).
-------------------------------------------------------------------
Thu Apr 19 19:30:25 CEST 2018 - sbrabec@suse.com
- Backport three upstream patches:
* Fix crash loop in lscpu
(bsc#1072947, util-linux-lscpu-loop.patch).
* Fix possible segfault of umount -a
(util-linux-libmount-umount-a-segfault.patch).
* Fix mount -a on NFS bind mounts (bsc#1080740,
util-linux-libmount-mount-a-nfs-bind-mount.patch).
-------------------------------------------------------------------
Thu Apr 12 17:09:30 CEST 2018 - sbrabec@suse.com

View File

@ -174,6 +174,16 @@ Patch5: util-linux-cramfs.patch
Patch6: util-linux-fincore-count.patch
# PATCH-FIX-UPSTREAM util-linux-sysfs-nvme-devno.patch bsc1078662 sbrabec@suse.com -- Fix lsblk on NVMe.
Patch7: util-linux-sysfs-nvme-devno.patch
# PATCH-FIX-UPSTREAM util-linux-lscpu-loop.patch bsc1072947 sbrabec@suse.com -- Fix crash loop in lscpu.
Patch8: util-linux-lscpu-loop.patch
# PATCH-FIX-UPSTREAM util-linux-libmount-umount-a-segfault.patch sbrabec@suse.com -- Fix possible segfault of umount -a.
Patch9: util-linux-libmount-umount-a-segfault.patch
# PATCH-FIX-UPSTREAM util-linux-libmount-mount-a-nfs-bind-mount.patch bsc1080740 sbrabec@suse.com -- Fix mount -a on NFS bind mounts.
Patch10: util-linux-libmount-mount-a-nfs-bind-mount.patch
# PATCH-FIX-UPSTREAM util-linux-lscpu-chcpu-new-cpu-macros.patch bnc1091164 sbrabec@suse.com -- Fix lscpu and chcpu on systems with >1024 cores.
Patch11: util-linux-lscpu-chcpu-new-cpu-macros.patch
# PATCH-FIX-UPSTREAM util-linux-chcpu-cpu-count.patch bnc1091164 sbrabec@suse.com -- chcpu: Properly count CPUs.
Patch12: util-linux-chcpu-cpu-count.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
%if %build_util_linux
@ -417,6 +427,11 @@ library.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
#
# setctsid
cp -p %{S:22} %{S:23} .

View File

@ -4,6 +4,25 @@ Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
- Do not run rfkill-block@.service and rfkill-unblock@service as it
is just template without parameter bsc#1092820 bsc#1093176
-------------------------------------------------------------------
Thu May 10 17:22:14 CEST 2018 - sbrabec@suse.com
- Fix lscpu and chcpu on systems with >1024 cores
(bnc#1091164, util-linux-lscpu-chcpu-new-cpu-macros.patch).
- Fix CPU count in chcpu
(bnc#1091164, util-linux-chcpu-cpu-count.patch).
-------------------------------------------------------------------
Thu Apr 19 19:30:25 CEST 2018 - sbrabec@suse.com
- Backport three upstream patches:
* Fix crash loop in lscpu
(bsc#1072947, util-linux-lscpu-loop.patch).
* Fix possible segfault of umount -a
(util-linux-libmount-umount-a-segfault.patch).
* Fix mount -a on NFS bind mounts (bsc#1080740,
util-linux-libmount-mount-a-nfs-bind-mount.patch).
-------------------------------------------------------------------
Thu Apr 12 17:09:30 CEST 2018 - sbrabec@suse.com

View File

@ -174,6 +174,16 @@ Patch5: util-linux-cramfs.patch
Patch6: util-linux-fincore-count.patch
# PATCH-FIX-UPSTREAM util-linux-sysfs-nvme-devno.patch bsc1078662 sbrabec@suse.com -- Fix lsblk on NVMe.
Patch7: util-linux-sysfs-nvme-devno.patch
# PATCH-FIX-UPSTREAM util-linux-lscpu-loop.patch bsc1072947 sbrabec@suse.com -- Fix crash loop in lscpu.
Patch8: util-linux-lscpu-loop.patch
# PATCH-FIX-UPSTREAM util-linux-libmount-umount-a-segfault.patch sbrabec@suse.com -- Fix possible segfault of umount -a.
Patch9: util-linux-libmount-umount-a-segfault.patch
# PATCH-FIX-UPSTREAM util-linux-libmount-mount-a-nfs-bind-mount.patch bsc1080740 sbrabec@suse.com -- Fix mount -a on NFS bind mounts.
Patch10: util-linux-libmount-mount-a-nfs-bind-mount.patch
# PATCH-FIX-UPSTREAM util-linux-lscpu-chcpu-new-cpu-macros.patch bnc1091164 sbrabec@suse.com -- Fix lscpu and chcpu on systems with >1024 cores.
Patch11: util-linux-lscpu-chcpu-new-cpu-macros.patch
# PATCH-FIX-UPSTREAM util-linux-chcpu-cpu-count.patch bnc1091164 sbrabec@suse.com -- chcpu: Properly count CPUs.
Patch12: util-linux-chcpu-cpu-count.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
%if %build_util_linux
@ -417,6 +427,11 @@ library.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
#
# setctsid
cp -p %{S:22} %{S:23} .