From d4100875c308a14891ca68e698a249edea8911af Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Wed, 6 Jan 2021 20:12:34 +0000 Subject: [PATCH] import util-linux-2.32.1-26.el8 --- ...FLAG_RESET_ON_FORK-for-sched_setattr.patch | 46 ++++ ...ict-reset-on-fork-add-more-info-to-m.patch | 146 ++++++++++++ ...no-suid-behavior-on-file-capabilitie.patch | 41 ++++ .../0046-lsblk-Fall-back-to-ID_SERIAL.patch | 59 +++++ ...ault-on-PowerPC-systems-with-valid-h.patch | 32 +++ ...nt-gaps-to-possible-size-when-resize.patch | 33 +++ ...fix-memory-leak-on-error-before-end-.patch | 116 ++++++++++ ...-lscpu-update-ARM-identifiers-tables.patch | 104 +++++++++ ...r-on-aarch64-machine-which-doesn-t-h.patch | 214 ++++++++++++++++++ ...2-lscpu-dmi-split-to-parse-dmi-table.patch | 115 ++++++++++ ...u-add-helper-to-get-physical-sockets.patch | 91 ++++++++ ...cal-socket-on-aarch64-without-ACPI-P.patch | 49 ++++ ...-arm-read-vendor-and-model-from-BIOS.patch | 137 +++++++++++ SOURCES/0056-tests-update-sfdisk-resize.patch | 28 +++ SPECS/util-linux.spec | 39 +++- 15 files changed, 1249 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0043-chrt-use-SCHED_FLAG_RESET_ON_FORK-for-sched_setattr.patch create mode 100644 SOURCES/0044-chrt-don-t-restrict-reset-on-fork-add-more-info-to-m.patch create mode 100644 SOURCES/0045-mount.8-clarify-no-suid-behavior-on-file-capabilitie.patch create mode 100644 SOURCES/0046-lsblk-Fall-back-to-ID_SERIAL.patch create mode 100644 SOURCES/0047-lscpu-avoid-segfault-on-PowerPC-systems-with-valid-h.patch create mode 100644 SOURCES/0048-libfdisk-count-gaps-to-possible-size-when-resize.patch create mode 100644 SOURCES/0049-libmount-parser-fix-memory-leak-on-error-before-end-.patch create mode 100644 SOURCES/0050-lscpu-update-ARM-identifiers-tables.patch create mode 100644 SOURCES/0051-lscpu-use-cluster-on-aarch64-machine-which-doesn-t-h.patch create mode 100644 SOURCES/0052-lscpu-dmi-split-to-parse-dmi-table.patch create mode 100644 SOURCES/0053-lscpu-add-helper-to-get-physical-sockets.patch create mode 100644 SOURCES/0054-lscpu-show-physical-socket-on-aarch64-without-ACPI-P.patch create mode 100644 SOURCES/0055-lscpu-arm-read-vendor-and-model-from-BIOS.patch create mode 100644 SOURCES/0056-tests-update-sfdisk-resize.patch diff --git a/SOURCES/0043-chrt-use-SCHED_FLAG_RESET_ON_FORK-for-sched_setattr.patch b/SOURCES/0043-chrt-use-SCHED_FLAG_RESET_ON_FORK-for-sched_setattr.patch new file mode 100644 index 0000000..53a6454 --- /dev/null +++ b/SOURCES/0043-chrt-use-SCHED_FLAG_RESET_ON_FORK-for-sched_setattr.patch @@ -0,0 +1,46 @@ +From f575b6e0857087f46d54f494d9a435af715ea19d Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 1 Oct 2020 10:40:27 +0200 +Subject: [PATCH 43/55] chrt: use SCHED_FLAG_RESET_ON_FORK for sched_setattr() + +Reviewed by many people, used for years (but probably nobody uses +SCHED_DEADLINE with reset-on-fork), but we all missed: + +- sched_setscheduler() uses SCHED_RESET_ON_FORK (0x40000000) +- sched_setattr() uses SCHED_FLAG_RESET_ON_FORK (0x01) + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1884194 +Signed-off-by: Karel Zak +--- + schedutils/chrt.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/schedutils/chrt.c b/schedutils/chrt.c +index b08c78ed8..15556bbad 100644 +--- a/schedutils/chrt.c ++++ b/schedutils/chrt.c +@@ -123,7 +123,7 @@ struct chrt_ctl { + uint64_t period; + + unsigned int all_tasks : 1, /* all threads of the PID */ +- reset_on_fork : 1, /* SCHED_RESET_ON_FORK */ ++ reset_on_fork : 1, /* SCHED_RESET_ON_FORK or SCHED_FLAG_RESET_ON_FORK */ + altered : 1, /* sched_set**() used */ + verbose : 1; /* verbose output */ + }; +@@ -376,9 +376,10 @@ static int set_sched_one(struct chrt_ctl *ctl, pid_t pid) + sa.sched_period = ctl->period; + sa.sched_deadline = ctl->deadline; + +-# ifdef SCHED_RESET_ON_FORK ++# ifdef SCHED_FLAG_RESET_ON_FORK ++ /* Don't use SCHED_RESET_ON_FORK for sched_setattr()! */ + if (ctl->reset_on_fork) +- sa.sched_flags |= SCHED_RESET_ON_FORK; ++ sa.sched_flags |= SCHED_FLAG_RESET_ON_FORK; + # endif + errno = 0; + return sched_setattr(pid, &sa, 0); +-- +2.29.2 + diff --git a/SOURCES/0044-chrt-don-t-restrict-reset-on-fork-add-more-info-to-m.patch b/SOURCES/0044-chrt-don-t-restrict-reset-on-fork-add-more-info-to-m.patch new file mode 100644 index 0000000..519b090 --- /dev/null +++ b/SOURCES/0044-chrt-don-t-restrict-reset-on-fork-add-more-info-to-m.patch @@ -0,0 +1,146 @@ +From c4caa5b973f9cdb4c43edea3c32cda62cdf15b3b Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 1 Oct 2020 11:20:01 +0200 +Subject: [PATCH 44/55] chrt: don't restrict --reset-on-fork, add more info to + man page + +The flag works (= kernel accepts it) for all scheduling policies +and sched_getattr() returns the flag for all policies. + +There is no reason for userspace to be more smart than kernel or hide +the flag when it prints sched_getattr()/sched_getscheduler() results. + + # chrt -v --reset-on-fork --batch 0 /bin/true + pid 1315019's new scheduling policy: SCHED_BATCH|SCHED_RESET_ON_FORK + + # chrt -v --reset-on-fork --fifo 1 /bin/true + pid 1315055's new scheduling policy: SCHED_FIFO|SCHED_RESET_ON_FORK + + # chrt -v --reset-on-fork --deadline --sched-period 10000 0 /bin/true + pid 1315182's new scheduling policy: SCHED_DEADLINE|SCHED_RESET_ON_FORK + + # chrt -v --reset-on-fork --idle 0 /bin/true + pid 1315247's new scheduling policy: SCHED_IDLE|SCHED_RESET_ON_FORK + + # chrt -v --reset-on-fork --rr 1 /bin/true + pid 1315275's new scheduling policy: SCHED_RR|SCHED_RESET_ON_FORK + + # chrt -v --reset-on-fork --other 0 /bin/true + pid 1315311's new scheduling policy: SCHED_OTHER|SCHED_RESET_ON_FORK + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1884194 +Signed-off-by: Karel Zak +--- + schedutils/chrt.1 | 32 ++++++++++++++++++++++++++++---- + schedutils/chrt.c | 18 +++++------------- + 2 files changed, 33 insertions(+), 17 deletions(-) + +diff --git a/schedutils/chrt.1 b/schedutils/chrt.1 +index 4b8b1e9da..a9adfb316 100644 +--- a/schedutils/chrt.1 ++++ b/schedutils/chrt.1 +@@ -92,13 +92,37 @@ Specifies period parameter for SCHED_DEADLINE policy (Linux-specific). + Specifies deadline parameter for SCHED_DEADLINE policy (Linux-specific). + .TP + \fB\-R\fR, \fB\-\-reset-on-fork\fR +-Add ++Use + .B SCHED_RESET_ON_FORK +-flag to the ++or ++.B SCHED_FLAG_RESET_ON_FORK ++flag. Linux-specific, supported since 2.6.31. ++ ++Each thread has a reset-on-fork scheduling flag. When this flag is set, children created by ++.BR fork (2) ++do not inherit privileged scheduling policies. After the reset-on-fork flag has been enabled, ++it can be reset only if the thread has the ++.BR CAP_SYS_NICE ++capability. This flag is disabled in child processes created by ++.BR fork (2). ++ ++More precisely, if the reset-on-fork flag is set, ++the following rules apply for subsequently created children: ++.RS ++.IP * 3 ++If the calling thread has a scheduling policy of + .B SCHED_FIFO + or +-.B SCHED_RR +-scheduling policy (Linux-specific, supported since 2.6.31). ++.BR SCHED_RR , ++the policy is reset to ++.BR SCHED_OTHER ++in child processes. ++.IP * ++If the calling process has a negative nice value, ++the nice value is reset to zero in child processes. ++.RE ++ ++ + + .SH OPTIONS + .TP +diff --git a/schedutils/chrt.c b/schedutils/chrt.c +index 15556bbad..2a6f1e151 100644 +--- a/schedutils/chrt.c ++++ b/schedutils/chrt.c +@@ -152,7 +152,7 @@ static void __attribute__((__noreturn__)) usage(void) + + fputs(USAGE_SEPARATOR, out); + fputs(_("Scheduling options:\n"), out); +- fputs(_(" -R, --reset-on-fork set SCHED_RESET_ON_FORK for FIFO or RR\n"), out); ++ fputs(_(" -R, --reset-on-fork set reset-on-fork flag\n"), out); + fputs(_(" -T, --sched-runtime runtime parameter for DEADLINE\n"), out); + fputs(_(" -P, --sched-period period parameter for DEADLINE\n"), out); + fputs(_(" -D, --sched-deadline deadline parameter for DEADLINE\n"), out); +@@ -173,22 +173,19 @@ static void __attribute__((__noreturn__)) usage(void) + + static const char *get_policy_name(int policy) + { ++#ifdef SCHED_RESET_ON_FORK ++ policy &= ~SCHED_RESET_ON_FORK; ++#endif + switch (policy) { + case SCHED_OTHER: + return "SCHED_OTHER"; + case SCHED_FIFO: +-#ifdef SCHED_RESET_ON_FORK +- case SCHED_FIFO | SCHED_RESET_ON_FORK: +-#endif + return "SCHED_FIFO"; + #ifdef SCHED_IDLE + case SCHED_IDLE: + return "SCHED_IDLE"; + #endif + case SCHED_RR: +-#ifdef SCHED_RESET_ON_FORK +- case SCHED_RR | SCHED_RESET_ON_FORK: +-#endif + return "SCHED_RR"; + #ifdef SCHED_BATCH + case SCHED_BATCH: +@@ -257,7 +254,7 @@ fallback: + else + prio = sp.sched_priority; + # ifdef SCHED_RESET_ON_FORK +- if (policy == (SCHED_FIFO|SCHED_RESET_ON_FORK) || policy == (SCHED_BATCH|SCHED_RESET_ON_FORK)) ++ if (policy & SCHED_RESET_ON_FORK) + reset_on_fork = 1; + # endif + } +@@ -515,11 +512,6 @@ int main(int argc, char **argv) + errno = 0; + ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument")); + +-#ifdef SCHED_RESET_ON_FORK +- if (ctl->reset_on_fork && ctl->policy != SCHED_FIFO && ctl->policy != SCHED_RR) +- errx(EXIT_FAILURE, _("--reset-on-fork option is supported for " +- "SCHED_FIFO and SCHED_RR policies only")); +-#endif + #ifdef SCHED_DEADLINE + if ((ctl->runtime || ctl->deadline || ctl->period) && ctl->policy != SCHED_DEADLINE) + errx(EXIT_FAILURE, _("--sched-{runtime,deadline,period} options " +-- +2.29.2 + diff --git a/SOURCES/0045-mount.8-clarify-no-suid-behavior-on-file-capabilitie.patch b/SOURCES/0045-mount.8-clarify-no-suid-behavior-on-file-capabilitie.patch new file mode 100644 index 0000000..a65c8e6 --- /dev/null +++ b/SOURCES/0045-mount.8-clarify-no-suid-behavior-on-file-capabilitie.patch @@ -0,0 +1,41 @@ +From 8704fa57c3b93152df6c10fd6a35ebdd59e1a5b7 Mon Sep 17 00:00:00 2001 +From: Peter Wu +Date: Fri, 1 Feb 2019 15:40:53 +0100 +Subject: [PATCH 45/55] mount.8: clarify (no)suid behavior on file capabilities + +Clarify that the nosuid option also affects file capabilities and that +it only limits execution of programs. (setgid on directories still +inherit the group regardless of the nosuid option.) The new text is +taken from the mount(2) manual page from the man-pages project. + +Addresses: https://github.com/karelzak/util-linux/issues/482 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1855759 +Signed-off-by: Peter Wu +--- + sys-utils/mount.8 | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 +index 1cc792979..a4d7de2c0 100644 +--- a/sys-utils/mount.8 ++++ b/sys-utils/mount.8 +@@ -1107,12 +1107,12 @@ or + Do not use the lazytime feature. + .TP + .B suid +-Allow set-user-ID or set-group-ID bits to take +-effect. ++Honor set-user-ID and set-group-ID bits or file capabilities when ++executing programs from this filesystem. + .TP + .B nosuid +-Do not allow set-user-ID or set-group-ID bits to take +-effect. ++Do not honor set-user-ID and set-group-ID bits or file capabilities when ++executing programs from this filesystem. + .TP + .B silent + Turn on the silent flag. +-- +2.29.2 + diff --git a/SOURCES/0046-lsblk-Fall-back-to-ID_SERIAL.patch b/SOURCES/0046-lsblk-Fall-back-to-ID_SERIAL.patch new file mode 100644 index 0000000..603e628 --- /dev/null +++ b/SOURCES/0046-lsblk-Fall-back-to-ID_SERIAL.patch @@ -0,0 +1,59 @@ +From afe6545483a881ccde41dcaa6718c71c74b38d7b Mon Sep 17 00:00:00 2001 +From: Sven Wiltink +Date: Fri, 1 May 2020 16:35:40 +0200 +Subject: [PATCH 46/55] lsblk: Fall back to ID_SERIAL + +In some cases ID_SERIAL_SHORT isn't provided by libudev, but ID_SERIAL +is. An example of this are virtio devices. See the output of udevadm +info: +P: /devices/pci0000:00/0000:00:06.0/virtio2/block/vdb +N: vdb +S: disk/by-id/virtio-08491434ee711d3420e9 +S: disk/by-path/pci-0000:00:06.0 +S: disk/by-path/virtio-pci-0000:00:06.0 +E: DEVLINKS=/dev/disk/by-id/virtio-08491434ee711d3420e9 /dev/disk/by-path/pci-0000:00:06.0 /dev/disk/by-path/virtio-pci-0000:00:06.0 +E: DEVNAME=/dev/vdb +E: DEVPATH=/devices/pci0000:00/0000:00:06.0/virtio2/block/vdb +E: DEVTYPE=disk +E: ID_PATH=pci-0000:00:06.0 +E: ID_PATH_TAG=pci-0000_00_06_0 +E: ID_SERIAL=08491434ee711d3420e9 +E: MAJOR=252 +E: MINOR=16 +E: SUBSYSTEM=block +E: TAGS=:systemd: +E: USEC_INITIALIZED=1403804 + +[RHEL-8 backport: add ID_SERIAL and also ID_SCSI_SERIAL to be compatible with upstream] + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1861670 +Upstream: http://github.com/karelzak/util-linux/commit/e81d0f80068086147434fa947a4f723c00318772 +Upstream: http://github.com/karelzak/util-linux/commit/de6c2a4aec140e6086e278688d97f4655ced1a9a +Signed-off-by: Karel Zak +--- + misc-utils/lsblk.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c +index ae97f9f05..d0369d3e7 100644 +--- a/misc-utils/lsblk.c ++++ b/misc-utils/lsblk.c +@@ -567,8 +567,14 @@ static int get_udev_properties(struct blkdev_cxt *cxt) + if (data) + cxt->wwn = xstrdup(data); + +- if ((data = udev_device_get_property_value(dev, "ID_SERIAL_SHORT"))) ++ data = udev_device_get_property_value(dev, "ID_SCSI_SERIAL"); ++ if (!data) ++ data = udev_device_get_property_value(dev, "ID_SERIAL_SHORT"); ++ if (!data) ++ data = udev_device_get_property_value(dev, "ID_SERIAL"); ++ if (data) + cxt->serial = xstrdup(data); ++ + udev_device_unref(dev); + cxt->probed = 1; + DBG(DEV, ul_debugobj(cxt, "%s: found udev properties", cxt->name)); +-- +2.29.2 + diff --git a/SOURCES/0047-lscpu-avoid-segfault-on-PowerPC-systems-with-valid-h.patch b/SOURCES/0047-lscpu-avoid-segfault-on-PowerPC-systems-with-valid-h.patch new file mode 100644 index 0000000..21bca67 --- /dev/null +++ b/SOURCES/0047-lscpu-avoid-segfault-on-PowerPC-systems-with-valid-h.patch @@ -0,0 +1,32 @@ +From 4ac8e70822313b0c6b35ebf633c6e8fbca558998 Mon Sep 17 00:00:00 2001 +From: Thomas Abraham +Date: Thu, 24 Sep 2020 14:52:33 -0400 +Subject: [PATCH 47/55] lscpu: avoid segfault on PowerPC systems with valid + hardware configurations + +ntypes greater than 1 is valid in some hardware configurations, and an assert() +on the value isn't necessary or very future proof + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1883783 +Upstream: http://github.com/karelzak/util-linux/commit/cbe3304bc43b3fceb06fb6e5dd822bb59abf1b84 +Signed-off-by: Karel Zak +--- + sys-utils/lscpu.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index 1aa7bff4d..748d545b6 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -369,8 +369,6 @@ static void read_physical_info_powerpc(struct lscpu_desc *desc) + return; + + ntypes = strbe16toh(buf, 2); +- +- assert(ntypes <= 1); + if (!ntypes) + return; + +-- +2.29.2 + diff --git a/SOURCES/0048-libfdisk-count-gaps-to-possible-size-when-resize.patch b/SOURCES/0048-libfdisk-count-gaps-to-possible-size-when-resize.patch new file mode 100644 index 0000000..86f4e98 --- /dev/null +++ b/SOURCES/0048-libfdisk-count-gaps-to-possible-size-when-resize.patch @@ -0,0 +1,33 @@ +From b3c5c1f39db58b057bb581f1d3bebcbeedeee1cb Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 17 Sep 2018 11:58:50 +0200 +Subject: [PATCH 48/55] libfdisk: count gaps to possible size when resize + +The current code counts only partition sizes when it counts possible +space, but we have gaps between the partitions. It seems better to +count all based on offsets rather than sizes. + +Addresses: https://github.com/karelzak/util-linux/issues/693 +Upstream: http://github.com/karelzak/util-linux/commit/2f35c1ead621f42f32f7777232568cb03185b473 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1900498 +Signed-off-by: Karel Zak +--- + libfdisk/src/partition.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c +index a790dc9c9..ebcf6bf5c 100644 +--- a/libfdisk/src/partition.c ++++ b/libfdisk/src/partition.c +@@ -1113,7 +1113,7 @@ static int resize_get_last_possible( + break; + } else { + last = pa; +- *maxsz += pa->size; ++ *maxsz = pa->size - (start - pa->start); + DBG(TAB, ul_debugobj(tb, " new max=%ju (last updated)", (uintmax_t) *maxsz)); + } + } +-- +2.29.2 + diff --git a/SOURCES/0049-libmount-parser-fix-memory-leak-on-error-before-end-.patch b/SOURCES/0049-libmount-parser-fix-memory-leak-on-error-before-end-.patch new file mode 100644 index 0000000..9482386 --- /dev/null +++ b/SOURCES/0049-libmount-parser-fix-memory-leak-on-error-before-end-.patch @@ -0,0 +1,116 @@ +From 780f79420073e0c09cd41afea28ac217a6d4ef29 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 26 Jun 2020 12:59:32 +0200 +Subject: [PATCH 49/55] libmount: (parser) fix memory leak on error before + end-of-file + +Let's simplify the loop where we add FS to the table. The optimization +for recoverable errors is a fragile overkill. The new code always +allocates and unrefs FS for each loop. + +Addresses: https://github.com/karelzak/util-linux/pull/1068 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1900498 +Upstream: http://github.com/karelzak/util-linux/commit/fe0d12d4f82269096f8d0cffc51ca9590814c284 +Signed-off-by: Karel Zak +--- + libmount/src/fs.c | 2 +- + libmount/src/tab_parse.c | 49 ++++++++++++++++++++++------------------ + 2 files changed, 28 insertions(+), 23 deletions(-) + +diff --git a/libmount/src/fs.c b/libmount/src/fs.c +index def32253c..aae4961c3 100644 +--- a/libmount/src/fs.c ++++ b/libmount/src/fs.c +@@ -34,7 +34,7 @@ struct libmnt_fs *mnt_new_fs(void) + + fs->refcount = 1; + INIT_LIST_HEAD(&fs->ents); +- /*DBG(FS, ul_debugobj(fs, "alloc"));*/ ++ DBG(FS, ul_debugobj(fs, "alloc")); + return fs; + } + +diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c +index 10fc68279..719c1abca 100644 +--- a/libmount/src/tab_parse.c ++++ b/libmount/src/tab_parse.c +@@ -608,7 +608,6 @@ static int __table_parse_stream(struct libmnt_table *tb, FILE *f, const char *fi + int rc = -1; + int flags = 0; + pid_t tid = -1; +- struct libmnt_fs *fs = NULL; + struct libmnt_parser pa = { .line = 0 }; + + assert(tb); +@@ -628,19 +627,25 @@ static int __table_parse_stream(struct libmnt_table *tb, FILE *f, const char *fi + if (filename && strcmp(filename, _PATH_PROC_MOUNTS) == 0) + flags = MNT_FS_KERNEL; + +- while (!feof(f)) { +- if (!fs) { +- fs = mnt_new_fs(); +- if (!fs) +- goto err; ++ do { ++ struct libmnt_fs *fs; ++ ++ if (feof(f)) { ++ DBG(TAB, ul_debugobj(tb, "end-of-file")); ++ break; + } ++ fs = mnt_new_fs(); ++ if (!fs) ++ goto err; + ++ /* parse */ + rc = mnt_table_parse_next(&pa, tb, fs); + +- if (!rc && tb->fltrcb && tb->fltrcb(fs, tb->fltrcb_data)) +- rc = 1; /* filtered out by callback... */ ++ if (rc != 0 && tb->fltrcb && tb->fltrcb(fs, tb->fltrcb_data)) ++ rc = 1; /* error filtered out by callback... */ + +- if (!rc) { ++ /* add to the table */ ++ if (rc == 0) { + rc = mnt_table_add_fs(tb, fs); + fs->flags |= flags; + +@@ -651,21 +656,21 @@ static int __table_parse_stream(struct libmnt_table *tb, FILE *f, const char *fi + } + } + +- if (rc) { +- if (rc > 0) { +- mnt_reset_fs(fs); +- assert(fs->refcount == 1); +- continue; /* recoverable error, reuse fs*/ +- } ++ /* remove refernece (or deallocate on error) */ ++ mnt_unref_fs(fs); + +- mnt_unref_fs(fs); +- if (feof(f)) +- break; +- goto err; /* fatal error */ ++ /* recoverable error */ ++ if (rc > 0) { ++ DBG(TAB, ul_debugobj(tb, "recoverable error (continue)")); ++ continue; + } +- mnt_unref_fs(fs); +- fs = NULL; +- } ++ ++ /* fatal errors */ ++ if (rc < 0 && !feof(f)) { ++ DBG(TAB, ul_debugobj(tb, "fatal error")); ++ goto err; ++ } ++ } while (1); + + DBG(TAB, ul_debugobj(tb, "%s: stop parsing (%d entries)", + filename, mnt_table_get_nents(tb))); +-- +2.29.2 + diff --git a/SOURCES/0050-lscpu-update-ARM-identifiers-tables.patch b/SOURCES/0050-lscpu-update-ARM-identifiers-tables.patch new file mode 100644 index 0000000..bc3ae6c --- /dev/null +++ b/SOURCES/0050-lscpu-update-ARM-identifiers-tables.patch @@ -0,0 +1,104 @@ +From 6700a458ef1bcd8fe2c066411bc415bc43ccdb8a Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 15 Dec 2020 11:17:42 +0100 +Subject: [PATCH 50/55] lscpu: update ARM identifiers tables + +Use the latest upstream identifiers to add FUJITSU and HiSilicon +implementers and many new ARM CPUs. + +Upstream: http://github.com/karelzak/util-linux/commit/dd9b4cb32042def5b7767e26ebd294f7f52cd07f +Upstream: http://github.com/karelzak/util-linux/commit/a625b32e2c716723a28a49702a02c78274dd3bb6 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1883056 +Signed-off-by: Karel Zak +--- + sys-utils/lscpu-arm.c | 27 ++++++++++++++++++++++++--- + 1 file changed, 24 insertions(+), 3 deletions(-) + +diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c +index f3a746a62..2b178a72e 100644 +--- a/sys-utils/lscpu-arm.c ++++ b/sys-utils/lscpu-arm.c +@@ -49,7 +49,7 @@ static const struct id_part arm_part[] = { + { 0xc07, "Cortex-A7" }, + { 0xc08, "Cortex-A8" }, + { 0xc09, "Cortex-A9" }, +- { 0xc0d, "Cortex-A12" }, ++ { 0xc0d, "Cortex-A17" }, /* Originally A12 */ + { 0xc0f, "Cortex-A15" }, + { 0xc0e, "Cortex-A17" }, + { 0xc14, "Cortex-R4" }, +@@ -60,19 +60,28 @@ static const struct id_part arm_part[] = { + { 0xc21, "Cortex-M1" }, + { 0xc23, "Cortex-M3" }, + { 0xc24, "Cortex-M4" }, +- { 0xc20, "Cortex-M7" }, ++ { 0xc27, "Cortex-M7" }, + { 0xc60, "Cortex-M0+" }, + { 0xd01, "Cortex-A32" }, + { 0xd03, "Cortex-A53" }, + { 0xd04, "Cortex-A35" }, + { 0xd05, "Cortex-A55" }, ++ { 0xd06, "Cortex-A65" }, + { 0xd07, "Cortex-A57" }, + { 0xd08, "Cortex-A72" }, + { 0xd09, "Cortex-A73" }, + { 0xd0a, "Cortex-A75" }, ++ { 0xd0b, "Cortex-A76" }, ++ { 0xd0c, "Neoverse-N1" }, ++ { 0xd0d, "Cortex-A77" }, ++ { 0xd0e, "Cortex-A76AE" }, + { 0xd13, "Cortex-R52" }, + { 0xd20, "Cortex-M23" }, + { 0xd21, "Cortex-M33" }, ++ { 0xd41, "Cortex-A78" }, ++ { 0xd42, "Cortex-A78AE" }, ++ { 0xd4a, "Neoverse-E1" }, ++ { 0xd4b, "Cortex-A78C" }, + { -1, "unknown" }, + }; + +@@ -126,6 +135,7 @@ static const struct id_part samsung_part[] = { + static const struct id_part nvidia_part[] = { + { 0x000, "Denver" }, + { 0x003, "Denver 2" }, ++ { 0x004, "Carmel" }, + { -1, "unknown" }, + }; + +@@ -167,6 +177,16 @@ static const struct id_part intel_part[] = { + { -1, "unknown" }, + }; + ++static const struct id_part fujitsu_part[] = { ++ { 0x001, "A64FX" }, ++ { -1, "unknown" }, ++}; ++ ++static const struct id_part hisi_part[] = { ++ { 0xd01, "Kunpeng-920" }, /* aka tsv110 */ ++ { -1, "unknown" }, ++}; ++ + static const struct id_part unknown_part[] = { + { -1, "unknown" }, + }; +@@ -182,6 +202,8 @@ static const struct hw_impl hw_implementer[] = { + { 0x42, brcm_part, "Broadcom" }, + { 0x43, cavium_part, "Cavium" }, + { 0x44, dec_part, "DEC" }, ++ { 0x46, fujitsu_part, "FUJITSU" }, ++ { 0x48, hisi_part, "HiSilicon" }, + { 0x4e, nvidia_part, "Nvidia" }, + { 0x50, apm_part, "APM" }, + { 0x51, qcom_part, "Qualcomm" }, +@@ -191,7 +213,6 @@ static const struct hw_impl hw_implementer[] = { + { 0x69, intel_part, "Intel" }, + { -1, unknown_part, "unknown" }, + }; +- + void arm_cpu_decode(struct lscpu_desc *desc) + { + int j, impl, part; +-- +2.29.2 + diff --git a/SOURCES/0051-lscpu-use-cluster-on-aarch64-machine-which-doesn-t-h.patch b/SOURCES/0051-lscpu-use-cluster-on-aarch64-machine-which-doesn-t-h.patch new file mode 100644 index 0000000..1d27e96 --- /dev/null +++ b/SOURCES/0051-lscpu-use-cluster-on-aarch64-machine-which-doesn-t-h.patch @@ -0,0 +1,214 @@ +From 63d8d3e8d54326842677bc3d3a3e43a133846a71 Mon Sep 17 00:00:00 2001 +From: Masayoshi Mizuma +Date: Tue, 15 Dec 2020 12:07:38 +0100 +Subject: [PATCH 51/55] lscpu: use cluster on aarch64 machine which doesn't + have ACPI PPTT + +lscpu may show the wrong number of sockets if the machine is aarch64 and +doesn't have ACPI PPTT. + +That's because lscpu show the number of sockets by using a sysfs entry +(cpu/cpuX/topology/core_siblings). The sysfs entry is set by MPIDR_EL1 +register if the machine doesn't have ACPI PPTT. MPIDR_EL1 doesn't show +the physical socket information directly. It shows the affinity level. + +According to linux/arch/arm64/kernel/topology.c:store_cpu_topology(), +the top level of affinity is called as 'Cluster'. + +Use Cluster instead of Socket on the machine which doesn't have ACPI PPTT. + +Note, ARM SBBR v1.2 requires ACPI PPTT, so this patch is needed for the +machine which is based on SBBR v1.0 and v1.1. + +[kzak@redhat.com: - port to old code + - change semantic to be same as current upstream] + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1883056 +Upstream: 73c0a766ffbe60e013b55cfd716d531b5a6ae22a +Upstream: https://marc.info/?l=util-linux-ng&m=159984070611464&w=2 +Signed-off-by: Masayoshi Mizuma +Signed-off-by: Karel Zak +--- + sys-utils/lscpu.1 | 3 +++ + sys-utils/lscpu.c | 65 ++++++++++++++++++++++++++++++++++++++++++----- + sys-utils/lscpu.h | 3 +++ + 3 files changed, 65 insertions(+), 6 deletions(-) + +diff --git a/sys-utils/lscpu.1 b/sys-utils/lscpu.1 +index b70f2e151..cf981d708 100644 +--- a/sys-utils/lscpu.1 ++++ b/sys-utils/lscpu.1 +@@ -47,6 +47,9 @@ The logical core number. A core can contain several CPUs. + .B SOCKET + The logical socket number. A socket can contain several cores. + .TP ++.B CLUSTER ++The logical cluster number. A cluster can contain several cores. ++.TP + .B BOOK + The logical book number. A book can contain several sockets. + .TP +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index 748d545b6..a8b448fa0 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -70,6 +70,7 @@ + #define _PATH_SYS_HYP_FEATURES "/sys/hypervisor/properties/features" + #define _PATH_SYS_CPU _PATH_SYS_SYSTEM "/cpu" + #define _PATH_SYS_NODE _PATH_SYS_SYSTEM "/node" ++#define _PATH_ACPI_PPTT "/sys/firmware/acpi/tables/PPTT" + #define _PATH_PROC_XEN "/proc/xen" + #define _PATH_PROC_XENCAP _PATH_PROC_XEN "/capabilities" + #define _PATH_PROC_CPUINFO "/proc/cpuinfo" +@@ -168,6 +169,7 @@ enum { + COL_CPU, + COL_CORE, + COL_SOCKET, ++ COL_CLUSTER, + COL_NODE, + COL_BOOK, + COL_DRAWER, +@@ -194,6 +196,7 @@ static struct lscpu_coldesc coldescs[] = + [COL_CPU] = { "CPU", N_("logical CPU number"), 1 }, + [COL_CORE] = { "CORE", N_("logical core number") }, + [COL_SOCKET] = { "SOCKET", N_("logical socket number") }, ++ [COL_CLUSTER] = { "CLUSTER", N_("logical cluster number") }, + [COL_NODE] = { "NODE", N_("logical NUMA node number") }, + [COL_BOOK] = { "BOOK", N_("logical book number") }, + [COL_DRAWER] = { "DRAWER", N_("logical drawer number") }, +@@ -383,6 +386,26 @@ static void read_physical_info_powerpc( + } + #endif + ++static int is_fallback_to_cluster(struct lscpu_desc *desc) ++{ ++ char *arch; ++ struct stat st; ++ struct utsname utsbuf; ++ ++ if (desc) ++ arch = desc->arch; ++ else { ++ if (uname(&utsbuf) == -1) ++ err(EXIT_FAILURE, _("error: uname failed")); ++ arch = utsbuf.machine; ++ } ++ ++ if (!(strcmp(arch, "aarch64")) && (stat(_PATH_ACPI_PPTT, &st) < 0)) ++ return 1; ++ else ++ return 0; ++} ++ + + static void + read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod) +@@ -1344,6 +1367,10 @@ get_cell_data(struct lscpu_desc *desc, int idx, int col, + snprintf(buf, bufsz, "%zu", i); + } + break; ++ case COL_CLUSTER: ++ if (!desc->is_cluster) ++ break; ++ /* fallthrough */ + case COL_SOCKET: + if (mod->physical) { + if (desc->socketids[idx] == -1) +@@ -1799,12 +1826,18 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod) + if (fd) + fclose(fd); + } ++ ++ + if (desc->mtid) + threads_per_core = atoi(desc->mtid) + 1; + add_summary_n(tb, _("Thread(s) per core:"), + threads_per_core ?: desc->nthreads / desc->ncores); +- add_summary_n(tb, _("Core(s) per socket:"), +- cores_per_socket ?: desc->ncores / desc->nsockets); ++ if (desc->is_cluster) ++ add_summary_n(tb, _("Core(s) per cluster:"), ++ cores_per_socket ?: desc->ncores / desc->nsockets); ++ else ++ add_summary_n(tb, _("Core(s) per socket:"), ++ cores_per_socket ?: desc->ncores / desc->nsockets); + if (desc->nbooks) { + add_summary_n(tb, _("Socket(s) per book:"), + sockets_per_book ?: desc->nsockets / desc->nbooks); +@@ -1816,7 +1849,17 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod) + add_summary_n(tb, _("Book(s):"), books_per_drawer ?: desc->nbooks); + } + } else { +- add_summary_n(tb, _("Socket(s):"), sockets_per_book ?: desc->nsockets); ++ if (desc->is_cluster) { ++ if (desc->nr_socket_on_cluster > 0) ++ add_summary_n(tb, _("Socket(s):"), desc->nr_socket_on_cluster); ++ else ++ add_summary_s(tb, _("Socket(s):"), "-"); ++ ++ add_summary_n(tb, _("Cluster(s):"), ++ sockets_per_book ?: desc->nsockets); ++ } else ++ add_summary_n(tb, _("Socket(s):"), ++ sockets_per_book ?: desc->nsockets); + } + } + if (desc->nnodes) +@@ -2060,10 +2103,13 @@ int main(int argc, char *argv[]) + qsort(desc->ecaches, desc->necaches, + sizeof(struct cpu_cache), cachecmp); + ++ desc->is_cluster = is_fallback_to_cluster(desc); ++ + read_nodes(desc); + read_hypervisor(desc, mod); + arm_cpu_decode(desc); + ++ + switch(mod->mode) { + case OUTPUT_SUMMARY: + print_summary(desc, mod); +@@ -2072,7 +2118,10 @@ int main(int argc, char *argv[]) + if (!ncolumns) { + columns[ncolumns++] = COL_CPU; + columns[ncolumns++] = COL_CORE; +- columns[ncolumns++] = COL_SOCKET; ++ if (desc->is_cluster) ++ columns[ncolumns++] = COL_CLUSTER; ++ else ++ columns[ncolumns++] = COL_SOCKET; + columns[ncolumns++] = COL_NODE; + columns[ncolumns++] = COL_CACHE; + mod->compat = 1; +@@ -2089,8 +2138,12 @@ int main(int argc, char *argv[]) + columns[ncolumns++] = COL_DRAWER; + if (desc->bookmaps) + columns[ncolumns++] = COL_BOOK; +- if (desc->socketmaps) +- columns[ncolumns++] = COL_SOCKET; ++ if (desc->socketmaps) { ++ if (desc->is_cluster) ++ columns[ncolumns++] = COL_CLUSTER; ++ else ++ columns[ncolumns++] = COL_SOCKET; ++ } + if (desc->coremaps) + columns[ncolumns++] = COL_CORE; + if (desc->caches) +diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h +index 3d1885a3e..bffa9df60 100644 +--- a/sys-utils/lscpu.h ++++ b/sys-utils/lscpu.h +@@ -158,6 +158,9 @@ struct lscpu_desc { + int physsockets; /* Physical sockets (modules) */ + int physchips; /* Physical chips */ + int physcoresperchip; /* Physical cores per chip */ ++ ++ int is_cluster; ++ int nr_socket_on_cluster; + }; + + enum { +-- +2.29.2 + diff --git a/SOURCES/0052-lscpu-dmi-split-to-parse-dmi-table.patch b/SOURCES/0052-lscpu-dmi-split-to-parse-dmi-table.patch new file mode 100644 index 0000000..b77d264 --- /dev/null +++ b/SOURCES/0052-lscpu-dmi-split-to-parse-dmi-table.patch @@ -0,0 +1,115 @@ +From 60a1a900b22e6d714fbbde03322569ad4732b4ba Mon Sep 17 00:00:00 2001 +From: Masayoshi Mizuma +Date: Fri, 11 Sep 2020 09:53:26 -0400 +Subject: [PATCH 52/55] lscpu-dmi: split to parse dmi table + +Split out a function to parse dmi table. + +Signed-off-by: Masayoshi Mizuma +--- + sys-utils/lscpu-dmi.c | 60 ++++++++++++++++++++++++++++--------------- + 1 file changed, 40 insertions(+), 20 deletions(-) + +diff --git a/sys-utils/lscpu-dmi.c b/sys-utils/lscpu-dmi.c +index 29bd2e4fc..9b57fe9e6 100644 +--- a/sys-utils/lscpu-dmi.c ++++ b/sys-utils/lscpu-dmi.c +@@ -42,6 +42,12 @@ struct dmi_header + uint8_t *data; + }; + ++struct dmi_info { ++ char *vendor; ++ char *product; ++ char *manufacturer; ++}; ++ + static int checksum(const uint8_t *buf, size_t len) + { + uint8_t sum = 0; +@@ -105,20 +111,13 @@ static char *dmi_string(const struct dmi_header *dm, uint8_t s) + return bp; + } + +-static int hypervisor_from_dmi_table(uint32_t base, uint16_t len, +- uint16_t num, const char *devmem) ++static int parse_dmi_table(uint16_t len, uint16_t num, ++ uint8_t *data, ++ struct dmi_info *di) + { +- uint8_t *buf; +- uint8_t *data; ++ uint8_t *buf = data; ++ int rc = -1; + int i = 0; +- char *vendor = NULL; +- char *product = NULL; +- char *manufacturer = NULL; +- int rc = HYPER_NONE; +- +- data = buf = get_mem_chunk(base, len, devmem); +- if (!buf) +- goto done; + + /* 4 is the length of an SMBIOS structure header */ + while (i < num && data + 4 <= buf + len) { +@@ -142,11 +141,11 @@ static int hypervisor_from_dmi_table(uint32_t base, uint16_t len, + next += 2; + switch (h.type) { + case 0: +- vendor = dmi_string(&h, data[0x04]); ++ di->vendor = dmi_string(&h, data[0x04]); + break; + case 1: +- manufacturer = dmi_string(&h, data[0x04]); +- product = dmi_string(&h, data[0x05]); ++ di->manufacturer = dmi_string(&h, data[0x04]); ++ di->product = dmi_string(&h, data[0x05]); + break; + default: + break; +@@ -155,15 +154,36 @@ static int hypervisor_from_dmi_table(uint32_t base, uint16_t len, + data = next; + i++; + } +- if (manufacturer && !strcmp(manufacturer, "innotek GmbH")) ++ rc = 0; ++done: ++ return rc; ++} ++ ++static int hypervisor_from_dmi_table(uint32_t base, uint16_t len, ++ uint16_t num, const char *devmem) ++{ ++ uint8_t *data; ++ int rc = HYPER_NONE; ++ struct dmi_info di; ++ ++ data = get_mem_chunk(base, len, devmem); ++ if (!data) ++ return rc; ++ ++ memset(&di, 0, sizeof(struct dmi_info)); ++ rc = parse_dmi_table(len, num, data, &di); ++ if (rc < 0) ++ goto done; ++ ++ if (di.manufacturer && !strcmp(di.manufacturer, "innotek GmbH")) + rc = HYPER_INNOTEK; +- else if (manufacturer && strstr(manufacturer, "HITACHI") && +- product && strstr(product, "LPAR")) ++ else if (di.manufacturer && strstr(di.manufacturer, "HITACHI") && ++ di.product && strstr(di.product, "LPAR")) + rc = HYPER_HITACHI; +- else if (vendor && !strcmp(vendor, "Parallels")) ++ else if (di.vendor && !strcmp(di.vendor, "Parallels")) + rc = HYPER_PARALLELS; + done: +- free(buf); ++ free(data); + return rc; + } + +-- +2.29.2 + diff --git a/SOURCES/0053-lscpu-add-helper-to-get-physical-sockets.patch b/SOURCES/0053-lscpu-add-helper-to-get-physical-sockets.patch new file mode 100644 index 0000000..8a384e0 --- /dev/null +++ b/SOURCES/0053-lscpu-add-helper-to-get-physical-sockets.patch @@ -0,0 +1,91 @@ +From 32c4fe66ae9107a7fae556be02c1401e5046071b Mon Sep 17 00:00:00 2001 +From: Masayoshi Mizuma +Date: Fri, 11 Sep 2020 09:53:27 -0400 +Subject: [PATCH 53/55] lscpu: add helper to get physical sockets + +Add a helper function, get_number_of_physical_sockets_from_dmi(), +to get physical sockets from DMI table in case of the sysfs for +cpu topology doesn't have the physical socket information. + +get_number_of_physical_sockets_from_dmi() parse the DMI table +and counts the number of SMBIOS Processor Information (Type04) +structure. + +Note, ARM SBBR v1.0 and newer requires SMBIOS Processor Information +(Type04). And ARM SBBR v1.2 requires ACPI PPTT which has physical socket +information. So the helper function is useful for the machine base on +SBBR v1.0 and v1.1. + +Signed-off-by: Masayoshi Mizuma +--- + sys-utils/lscpu-dmi.c | 30 ++++++++++++++++++++++++++++++ + sys-utils/lscpu.h | 1 + + 2 files changed, 31 insertions(+) + +diff --git a/sys-utils/lscpu-dmi.c b/sys-utils/lscpu-dmi.c +index 9b57fe9e6..31127f48a 100644 +--- a/sys-utils/lscpu-dmi.c ++++ b/sys-utils/lscpu-dmi.c +@@ -46,6 +46,7 @@ struct dmi_info { + char *vendor; + char *product; + char *manufacturer; ++ int sockets; + }; + + static int checksum(const uint8_t *buf, size_t len) +@@ -147,6 +148,9 @@ static int parse_dmi_table(uint16_t len, uint16_t num, + di->manufacturer = dmi_string(&h, data[0x04]); + di->product = dmi_string(&h, data[0x05]); + break; ++ case 4: ++ di->sockets++; ++ break; + default: + break; + } +@@ -323,3 +327,29 @@ done: + free(buf); + return rc < 0 ? HYPER_NONE : rc; + } ++ ++int get_number_of_physical_sockets_from_dmi(void) ++{ ++ static char const sys_fw_dmi_tables[] = _PATH_SYS_DMI; ++ struct dmi_info di; ++ struct stat st; ++ uint8_t *data; ++ int rc = -1; ++ ++ if (stat(sys_fw_dmi_tables, &st)) ++ return rc; ++ ++ data = get_mem_chunk(0, st.st_size, sys_fw_dmi_tables); ++ if (!data) ++ return rc; ++ ++ memset(&di, 0, sizeof(struct dmi_info)); ++ rc = parse_dmi_table(st.st_size, st.st_size/4, data, &di); ++ ++ free(data); ++ ++ if ((rc < 0) || !di.sockets) ++ return rc; ++ else ++ return di.sockets; ++} +diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h +index bffa9df60..b190afd21 100644 +--- a/sys-utils/lscpu.h ++++ b/sys-utils/lscpu.h +@@ -186,6 +186,7 @@ struct lscpu_modifier { + }; + + extern int read_hypervisor_dmi(void); ++extern int get_number_of_physical_sockets_from_dmi(void); + extern void arm_cpu_decode(struct lscpu_desc *desc); + + #endif /* LSCPU_H */ +-- +2.29.2 + diff --git a/SOURCES/0054-lscpu-show-physical-socket-on-aarch64-without-ACPI-P.patch b/SOURCES/0054-lscpu-show-physical-socket-on-aarch64-without-ACPI-P.patch new file mode 100644 index 0000000..03697cd --- /dev/null +++ b/SOURCES/0054-lscpu-show-physical-socket-on-aarch64-without-ACPI-P.patch @@ -0,0 +1,49 @@ +From 5b20e51f98798161138f0758af845c43931f59ba Mon Sep 17 00:00:00 2001 +From: Masayoshi Mizuma +Date: Fri, 11 Sep 2020 09:53:28 -0400 +Subject: [PATCH 54/55] lscpu: show physical socket on aarch64 without ACPI + PPTT + +Show the number of physical socket even if the sysfs doesn't have +the physical socket information. +Note, lscpu cannot show the number of socket info for unprivileged +users because it needs to access the DMI table. + +Signed-off-by: Masayoshi Mizuma +--- + sys-utils/lscpu.c | 6 ++++-- + sys-utils/lscpu.h | 1 - + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index a8b448fa0..45fcb08cf 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -1850,8 +1850,10 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod) + } + } else { + if (desc->is_cluster) { +- if (desc->nr_socket_on_cluster > 0) +- add_summary_n(tb, _("Socket(s):"), desc->nr_socket_on_cluster); ++ int sockets = get_number_of_physical_sockets_from_dmi(); ++ ++ if (sockets) ++ add_summary_n(tb, _("Socket(s):"), sockets); + else + add_summary_s(tb, _("Socket(s):"), "-"); + +diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h +index b190afd21..1aef8202d 100644 +--- a/sys-utils/lscpu.h ++++ b/sys-utils/lscpu.h +@@ -160,7 +160,6 @@ struct lscpu_desc { + int physcoresperchip; /* Physical cores per chip */ + + int is_cluster; +- int nr_socket_on_cluster; + }; + + enum { +-- +2.29.2 + diff --git a/SOURCES/0055-lscpu-arm-read-vendor-and-model-from-BIOS.patch b/SOURCES/0055-lscpu-arm-read-vendor-and-model-from-BIOS.patch new file mode 100644 index 0000000..72954ff --- /dev/null +++ b/SOURCES/0055-lscpu-arm-read-vendor-and-model-from-BIOS.patch @@ -0,0 +1,137 @@ +From 880958fe818c5bc9fb4a1a1cdcd241d90e7fb179 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 16 Dec 2020 13:08:51 +0100 +Subject: [PATCH 55/55] lscpu: (arm) read vendor and model from BIOS + +This patch backports the current upstream code to read CPU vendor and +model name from BIOS. + +Upstream: http://github.com/karelzak/util-linux/commit/8014104bea78f6f82cb82e16329b562e60ecdc87 +Upstream: http://github.com/karelzak/util-linux/commit/367c85c472869b75eaf770d4be0b360e30710b95 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1883056 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1882740 +Signed-off-by: Karel Zak +--- + sys-utils/lscpu-dmi.c | 44 +++++++++++++++++++++++++++++++++++++++++++ + sys-utils/lscpu.c | 7 +++++++ + sys-utils/lscpu.h | 3 +++ + 3 files changed, 54 insertions(+) + +diff --git a/sys-utils/lscpu-dmi.c b/sys-utils/lscpu-dmi.c +index 31127f48a..3bdd7dcb2 100644 +--- a/sys-utils/lscpu-dmi.c ++++ b/sys-utils/lscpu-dmi.c +@@ -28,6 +28,7 @@ + #include + + #include "lscpu.h" ++#include "all-io.h" + + #define _PATH_SYS_DMI "/sys/firmware/dmi/tables/DMI" + +@@ -353,3 +354,46 @@ int get_number_of_physical_sockets_from_dmi(void) + else + return di.sockets; + } ++ ++ ++#define _PATH_SYS_DMI_TYPE4 "/sys/firmware/dmi/entries/4-0/raw" ++#define PROC_MFR_OFFSET 0x07 ++#define PROC_VERSION_OFFSET 0x10 ++ ++/* ++ * Use firmware to get human readable names ++ */ ++int arm_smbios_decode(struct lscpu_desc *desc) ++{ ++ uint8_t data[8192]; ++ char buf[128], *str; ++ struct dmi_header h; ++ int fd; ++ ssize_t rs; ++ ++ fd = open(_PATH_SYS_DMI_TYPE4, O_RDONLY); ++ if (fd < 0) ++ return fd; ++ ++ rs = read_all(fd, (char *) data, 8192); ++ close(fd); ++ ++ if (rs == -1) ++ return -1; ++ ++ to_dmi_header(&h, data); ++ ++ str = dmi_string(&h, data[PROC_MFR_OFFSET]); ++ if (str) { ++ xstrncpy(buf, str, 127); ++ desc->bios_vendor = xstrdup(buf); ++ } ++ ++ str = dmi_string(&h, data[PROC_VERSION_OFFSET]); ++ if (str) { ++ xstrncpy(buf, str, 127); ++ desc->bios_modelname = xstrdup(buf); ++ } ++ ++ return 0; ++} +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index 45fcb08cf..0a4926e65 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -1868,6 +1868,8 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod) + add_summary_n(tb, _("NUMA node(s):"), desc->nnodes); + if (desc->vendor) + add_summary_s(tb, _("Vendor ID:"), desc->vendor); ++ if (desc->bios_vendor) ++ add_summary_s(tb, _("BIOS Vendor ID:"), desc->bios_vendor); + if (desc->machinetype) + add_summary_s(tb, _("Machine type:"), desc->machinetype); + if (desc->family) +@@ -1876,6 +1878,8 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod) + add_summary_s(tb, _("Model:"), desc->revision ? desc->revision : desc->model); + if (desc->modelname || desc->cpu) + add_summary_s(tb, _("Model name:"), desc->cpu ? desc->cpu : desc->modelname); ++ if (desc->bios_modelname) ++ add_summary_s(tb, _("BIOS Model name:"), desc->bios_modelname); + if (desc->stepping) + add_summary_s(tb, _("Stepping:"), desc->stepping); + if (desc->mhz) +@@ -2109,6 +2113,9 @@ int main(int argc, char *argv[]) + + read_nodes(desc); + read_hypervisor(desc, mod); ++ ++ if (mod->system == SYSTEM_LIVE) ++ arm_smbios_decode(desc); + arm_cpu_decode(desc); + + +diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h +index 1aef8202d..802719eeb 100644 +--- a/sys-utils/lscpu.h ++++ b/sys-utils/lscpu.h +@@ -79,10 +79,12 @@ struct polarization_modes { + struct lscpu_desc { + char *arch; + char *vendor; ++ char *bios_vendor; /* aarch64 */ + char *machinetype; /* s390 */ + char *family; + char *model; + char *modelname; ++ char *bios_modelname; /* aarch64 */ + char *revision; /* alternative for model (ppc) */ + char *cpu; /* alternative for modelname (ppc, sparc) */ + char *virtflag; /* virtualization flag (vmx, svm) */ +@@ -187,5 +189,6 @@ struct lscpu_modifier { + extern int read_hypervisor_dmi(void); + extern int get_number_of_physical_sockets_from_dmi(void); + extern void arm_cpu_decode(struct lscpu_desc *desc); ++extern int arm_smbios_decode(struct lscpu_desc *desc); + + #endif /* LSCPU_H */ +-- +2.29.2 + diff --git a/SOURCES/0056-tests-update-sfdisk-resize.patch b/SOURCES/0056-tests-update-sfdisk-resize.patch new file mode 100644 index 0000000..2897961 --- /dev/null +++ b/SOURCES/0056-tests-update-sfdisk-resize.patch @@ -0,0 +1,28 @@ +From feb4b6cd1422d6ea9063be5f02338357b039a058 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 17 Sep 2018 16:22:14 +0200 +Subject: [PATCH] tests: update sfdisk resize + +Upstream: http://github.com/karelzak/util-linux/commit/a1b463d94afdae65ab5bfb192a58f1ceeb13679a +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1900498 +Signed-off-by: Karel Zak +--- + tests/expected/sfdisk/dos-resize-logical | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/expected/sfdisk/dos-resize-logical b/tests/expected/sfdisk/dos-resize-logical +index 9ceb9a327..a427ff010 100644 +--- a/tests/expected/sfdisk/dos-resize-logical ++++ b/tests/expected/sfdisk/dos-resize-logical +@@ -26,7 +26,7 @@ Device Boot Start End Sectors Size Id Type + 3 6144 8191 2048 1M 83 Linux + 4 8192 28671 20480 10M 5 Extended + 5 10240 12287 2048 1M 83 Linux +-6 14336 26623 12288 6M 83 Linux ++6 14336 28671 14336 7M 83 Linux + + The partition table has been altered. + Calling ioctl() to re-read partition table. +-- +2.29.2 + diff --git a/SPECS/util-linux.spec b/SPECS/util-linux.spec index fddfee9..76385f0 100644 --- a/SPECS/util-linux.spec +++ b/SPECS/util-linux.spec @@ -2,7 +2,7 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.32.1 -Release: 24%{?dist} +Release: 26%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -180,6 +180,31 @@ Patch41: 0041-libmount-fix-mount-a-EBUSY-for-cifs.patch # 1848919 - Update losetup man page to fix "--direct-io" defaults Patch42: 0042-Manual-pages-losetup.8-Fix-direct-io-defaults.patch +### RHEL-8.4 +### +# 1884194 - RHEL-8: chrt command does not support the -R option +Patch43: 0043-chrt-use-SCHED_FLAG_RESET_ON_FORK-for-sched_setattr.patch +Patch44: 0044-chrt-don-t-restrict-reset-on-fork-add-more-info-to-m.patch +# 1855759 - mount.8: clarify (no)suid behavior on file capabilities +Patch45: 0045-mount.8-clarify-no-suid-behavior-on-file-capabilitie.patch +# 1861670 - lsblk can not show serial information for virtio disk +Patch46: 0046-lsblk-Fall-back-to-ID_SERIAL.patch +# 1883783 - lscpu: avoid segfault on PowerPC systems with valid hardware configurations +Patch47: 0047-lscpu-avoid-segfault-on-PowerPC-systems-with-valid-h.patch +# 1900498 - libfdisk/libmount: backport two patches for upstream systemd +Patch48: 0048-libfdisk-count-gaps-to-possible-size-when-resize.patch +Patch49: 0049-libmount-parser-fix-memory-leak-on-error-before-end-.patch +# 1883056 - lscpu support for Fujitsu A64FX +Patch50: 0050-lscpu-update-ARM-identifiers-tables.patch +Patch51: 0051-lscpu-use-cluster-on-aarch64-machine-which-doesn-t-h.patch +Patch52: 0052-lscpu-dmi-split-to-parse-dmi-table.patch +Patch53: 0053-lscpu-add-helper-to-get-physical-sockets.patch +Patch54: 0054-lscpu-show-physical-socket-on-aarch64-without-ACPI-P.patch +# 1882740 lscpu: use SMBIOS Type 4 strings for CPU vendor and model on ARM +Patch55: 0055-lscpu-arm-read-vendor-and-model-from-BIOS.patch +# 1900498 - libfdisk/libmount: backport two patches for upstream systemd +Patch56: 0056-tests-update-sfdisk-resize.patch + %description The util-linux package contains a large variety of low-level system @@ -1045,6 +1070,18 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog +* Wed Dec 16 2020 Karel Zak 2.32.1-26 +- update regression tests (related to #1900498) + +* Wed Dec 16 2020 Karel Zak 2.32.1-25 +- fix #1884194 - RHEL-8: chrt command does not support the -R option +- fix #1855759 - mount.8: clarify (no)suid behavior on file capabilities +- fix #1861670 - lsblk can not show serial information for virtio disk +- fix #1883783 - lscpu: avoid segfault on PowerPC systems with valid hardware configurations +- fix #1900498 - libfdisk/libmount: backport two patches for upstream systemd +- fix #1883056 - lscpu support for Fujitsu A64FX +- fix #1882740 - lscpu: use SMBIOS Type 4 strings for CPU vendor and model on ARM + * Fri Jun 26 2020 Karel Zak 2.32.1-24 - fix #1848919 - Update losetup man page to fix "--direct-io" defaults