From 28bf030d350a3e4f7f8de52a5ea9cebf697457d6 Mon Sep 17 00:00:00 2001 From: anolis-bot Date: Wed, 24 May 2023 11:31:07 +0800 Subject: [PATCH 1/4] update to util-linux-2.32.1-42.el8_8 Signed-off-by: anolis-bot --- ...t-continuous-clock-handling-for-time.patch | 2 +- ...-clock-value-from-LIBUUID_CLOCK_FILE.patch | 2 +- ...trim-backport-entries-de-duplication.patch | 190 ++++++++++++++ ...don-t-reply-on-scsi_debug-partitions.patch | 66 +++++ ...eric-error-message-for-EACCES-on-umo.patch | 27 ++ ...logins-man-explain-password-statuses.patch | 45 ++++ ...-utmp-strings-use-with-upstream-code.patch | 245 ++++++++++++++++++ 0092-last-use-full-size-of-the-username.patch | 55 ++++ ...-add-cmp_timespec-and-cmp_stat_mtime.patch | 47 ++++ ...d-hint-about-systemctl-daemon-reload.patch | 86 ++++++ 1001-hwclock-make-glibc-2.31-compatible.patch | 161 ------------ ...eoverse-N2-to-ARM-identifiers-tables.patch | 24 -- ...-cpu-frequency-from-cpuinfo-on-arm64.patch | 24 -- dist | 2 +- util-linux.spec | 49 ++-- 15 files changed, 798 insertions(+), 227 deletions(-) create mode 100644 0087-fstrim-backport-entries-de-duplication.patch create mode 100644 0088-tests-don-t-reply-on-scsi_debug-partitions.patch create mode 100644 0089-libmount-use-generic-error-message-for-EACCES-on-umo.patch create mode 100644 0090-lslogins-man-explain-password-statuses.patch create mode 100644 0091-last-sync-utmp-strings-use-with-upstream-code.patch create mode 100644 0092-last-use-full-size-of-the-username.patch create mode 100644 0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch create mode 100644 0094-mount-add-hint-about-systemctl-daemon-reload.patch delete mode 100644 1001-hwclock-make-glibc-2.31-compatible.patch delete mode 100644 1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch delete mode 100644 1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch diff --git a/0085-libuuid-Implement-continuous-clock-handling-for-time.patch b/0085-libuuid-Implement-continuous-clock-handling-for-time.patch index ef9798b..9495ff0 100644 --- a/0085-libuuid-Implement-continuous-clock-handling-for-time.patch +++ b/0085-libuuid-Implement-continuous-clock-handling-for-time.patch @@ -1,4 +1,4 @@ -From ce49a152fd8a830b1c9c0a8b745ea71feff71697 Mon Sep 17 00:00:00 2001 +From ccc5db8102728d37e2e28dd50da3370e8c8de33a Mon Sep 17 00:00:00 2001 From: Michael Trapp Date: Mon, 20 Jun 2022 17:10:36 +0200 Subject: libuuid: Implement continuous clock handling for time based UUIDs diff --git a/0086-libuuid-check-clock-value-from-LIBUUID_CLOCK_FILE.patch b/0086-libuuid-check-clock-value-from-LIBUUID_CLOCK_FILE.patch index 401c52a..4352651 100644 --- a/0086-libuuid-check-clock-value-from-LIBUUID_CLOCK_FILE.patch +++ b/0086-libuuid-check-clock-value-from-LIBUUID_CLOCK_FILE.patch @@ -1,4 +1,4 @@ -From fffaa2c0856de8c42b17c52a641cbc5d00ec012b Mon Sep 17 00:00:00 2001 +From 44cebf3e692053541f362b62f88f327c2c96e70e Mon Sep 17 00:00:00 2001 From: Michael Trapp Date: Tue, 2 Aug 2022 14:16:43 +0200 Subject: libuuid: check clock value from LIBUUID_CLOCK_FILE diff --git a/0087-fstrim-backport-entries-de-duplication.patch b/0087-fstrim-backport-entries-de-duplication.patch new file mode 100644 index 0000000..921ad25 --- /dev/null +++ b/0087-fstrim-backport-entries-de-duplication.patch @@ -0,0 +1,190 @@ +From 9272023b42febae7db1ec828016a980146095a83 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 2 Feb 2023 13:21:33 +0100 +Subject: fstrim: backport entries de-duplication + +Upstream: http://github.com/util-linux/util-linux/commit/9dbc073e4c58a56f68da8209df19789131446f5e +Upstream: http://github.com/util-linux/util-linux/commit/67f974d41d62c8b521fe81e1aac92562366f6a0a +Upstream: http://github.com/util-linux/util-linux/commit/20af6cee463cd6329b4f06db3282a09be942bd7a +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2121699 +Signed-off-by: Karel Zak +--- + sys-utils/fstrim.c | 88 ++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 74 insertions(+), 14 deletions(-) + +diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c +index 70870ef69..6aa523d72 100644 +--- a/sys-utils/fstrim.c ++++ b/sys-utils/fstrim.c +@@ -35,6 +35,7 @@ + + #include + #include ++#include + #include + + #include "nls.h" +@@ -43,6 +44,7 @@ + #include "closestream.h" + #include "pathnames.h" + #include "sysfs.h" ++#include "statfs_magic.h" + + #include + +@@ -84,6 +86,7 @@ static int fstrim_filesystem(const char *path, struct fstrim_range *rangetpl, + goto done; + } + errno = 0; ++ + if (ioctl(fd, FITRIM, &range)) { + rc = errno == EOPNOTSUPP || errno == ENOTTY ? 1 : -errno; + +@@ -114,7 +117,7 @@ static int has_discard(const char *devname, struct sysfs_cxt *wholedisk) + struct sysfs_cxt cxt, *parent = NULL; + uint64_t dg = 0; + dev_t disk = 0, dev; +- int rc; ++ int rc, rdonly = 0; + + dev = sysfs_devname_to_devno(devname, NULL); + if (!dev) +@@ -139,11 +142,46 @@ static int has_discard(const char *devname, struct sysfs_cxt *wholedisk) + rc = sysfs_init(&cxt, dev, parent); + if (!rc) + rc = sysfs_read_u64(&cxt, "queue/discard_granularity", &dg); ++ if (!rc) ++ sysfs_scanf(&cxt, "ro", "%d", &rdonly); + + sysfs_deinit(&cxt); +- return rc == 0 && dg > 0; ++ return rc == 0 && dg > 0 && rdonly == 0; + } + ++static int is_unwanted_fs(struct libmnt_fs *fs, const char *tgt) ++{ ++ struct statfs vfs; ++ int fd, rc; ++ ++ if (mnt_fs_is_pseudofs(fs)) ++ return 1; ++ if (mnt_fs_is_netfs(fs)) ++ return 1; ++ if (mnt_fs_is_swaparea(fs)) ++ return 1; ++ if (mnt_fs_match_fstype(fs, "autofs")) ++ return 1; ++ if (mnt_fs_match_options(fs, "ro")) ++ return 1; ++ ++ fd = open(tgt, O_PATH); ++ if (fd < 0) ++ return 1; ++ rc = fstatfs(fd, &vfs) != 0 || vfs.f_type == STATFS_AUTOFS_MAGIC; ++ close(fd); ++ if (rc) ++ return 1; ++ ++ /* FITRIM on read-only filesystem can fail, and it can fail */ ++ if (access(tgt, W_OK) != 0) { ++ if (errno == EROFS) ++ return 1; ++ if (errno == EACCES) ++ return 1; ++ } ++ return 0; ++} + + static int uniq_fs_target_cmp( + struct libmnt_table *tb __attribute__((__unused__)), +@@ -182,30 +220,38 @@ static int fstrim_all(struct fstrim_range *rangetpl, int verbose) + + mnt_init_debug(0); + +- itr = mnt_new_iter(MNT_ITER_BACKWARD); +- if (!itr) +- err(MNT_EX_FAIL, _("failed to initialize libmount iterator")); +- + tab = mnt_new_table_from_file(_PATH_PROC_MOUNTINFO); + if (!tab) + err(MNT_EX_FAIL, _("failed to parse %s"), _PATH_PROC_MOUNTINFO); + ++ if (mnt_table_is_empty(tab)) { ++ mnt_unref_table(tab); ++ return MNT_EX_SUCCESS; ++ } ++ + /* de-duplicate by mountpoints */ + mnt_table_uniq_fs(tab, 0, uniq_fs_target_cmp); + +- /* de-duplicate by source */ +- mnt_table_uniq_fs(tab, MNT_UNIQ_FORWARD, uniq_fs_source_cmp); ++ itr = mnt_new_iter(MNT_ITER_BACKWARD); ++ if (!itr) ++ err(MNT_EX_FAIL, _("failed to initialize libmount iterator")); + ++ /* Remove useless entries and canonicalize the table */ + while (mnt_table_next_fs(tab, itr, &fs) == 0) { + const char *src = mnt_fs_get_srcpath(fs), + *tgt = mnt_fs_get_target(fs); + char *path; + int rc = 1; + +- if (!src || !tgt || *src != '/' || +- mnt_fs_is_pseudofs(fs) || +- mnt_fs_is_netfs(fs)) ++ if (!tgt || is_unwanted_fs(fs, tgt)) { ++ mnt_table_remove_fs(tab, fs); + continue; ++ } ++ ++ if (!src || *src != '/') { ++ mnt_table_remove_fs(tab, fs); ++ continue; ++ } + + /* Is it really accessible mountpoint? Not all mountpoints are + * accessible (maybe over mounted by another filesystem) */ +@@ -213,11 +259,25 @@ static int fstrim_all(struct fstrim_range *rangetpl, int verbose) + if (path && strcmp(path, tgt) == 0) + rc = 0; + free(path); +- if (rc) ++ if (rc) { ++ mnt_table_remove_fs(tab, fs); + continue; /* overlaying mount */ ++ } + +- if (!has_discard(src, &wholedisk)) ++ if (!has_discard(src, &wholedisk)) { ++ mnt_table_remove_fs(tab, fs); + continue; ++ } ++ } ++ ++ /* de-duplicate by source */ ++ mnt_table_uniq_fs(tab, MNT_UNIQ_FORWARD, uniq_fs_source_cmp); ++ ++ mnt_reset_iter(itr, MNT_ITER_BACKWARD); ++ ++ /* Do FITRIM */ ++ while (mnt_table_next_fs(tab, itr, &fs) == 0) { ++ const char *tgt = mnt_fs_get_target(fs); + cnt++; + + /* +@@ -231,10 +291,10 @@ static int fstrim_all(struct fstrim_range *rangetpl, int verbose) + if (fstrim_filesystem(tgt, rangetpl, verbose) < 0) + cnt_err++; + } ++ mnt_free_iter(itr); + + sysfs_deinit(&wholedisk); + mnt_unref_table(tab); +- mnt_free_iter(itr); + + if (cnt && cnt == cnt_err) + return MNT_EX_FAIL; /* all failed */ +-- +2.39.1 + diff --git a/0088-tests-don-t-reply-on-scsi_debug-partitions.patch b/0088-tests-don-t-reply-on-scsi_debug-partitions.patch new file mode 100644 index 0000000..2ed72a4 --- /dev/null +++ b/0088-tests-don-t-reply-on-scsi_debug-partitions.patch @@ -0,0 +1,66 @@ +From a95ff5ed155c29734824f3a79350678901b22e43 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 11 Feb 2021 12:44:44 +0100 +Subject: tests: don't reply on scsi_debug partitions + +The disk layout as created by scsi_debug depends on kernel version. +Let's make the partition sizes hardcoded in our tests than rely on +kernel. + +Signed-off-by: Karel Zak +Upstream: http://github.com/util-linux/util-linux/commit/15a37d00e5e59f0f628d0a6b6cd2f9636702fd7c +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2142496 +--- + tests/expected/partx/partx-detect-parts | 6 +++--- + tests/ts/partx/partx | 14 +++++++++++--- + 2 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/tests/expected/partx/partx-detect-parts b/tests/expected/partx/partx-detect-parts +index 33d42a58c..0adc85577 100644 +--- a/tests/expected/partx/partx-detect-parts ++++ b/tests/expected/partx/partx-detect-parts +@@ -1,5 +1,5 @@ + NR START END SECTORS SIZE NAME UUID +- 1 32 33791 33760 16.5M +- 2 33792 67583 33792 16.5M +- 3 67584 102399 34816 17M ++ 1 32 33791 33760 16.5M 1ddc8a79-01 ++ 2 33792 67583 33792 16.5M 1ddc8a79-02 ++ 3 67584 102399 34816 17M 1ddc8a79-03 + OK +diff --git a/tests/ts/partx/partx b/tests/ts/partx/partx +index 84c286a94..6514ae62c 100755 +--- a/tests/ts/partx/partx ++++ b/tests/ts/partx/partx +@@ -26,6 +26,7 @@ ts_init "$*" + ts_check_test_command "$TS_CMD_PARTX" + ts_check_test_command "$TS_CMD_ADDPART" + ts_check_test_command "$TS_CMD_DELPART" ++ts_check_test_command "$TS_CMD_SFDISK" + + ts_skip_nonroot + +@@ -70,10 +71,17 @@ ts_init_subtest "delpart" + } >$TS_OUTPUT 2>&1 + ts_finalize_subtest + +-ts_scsi_debug_rmmod + +-# set global variable TS_DEVICE +-ts_scsi_debug_init dev_size_mb=50 num_parts=$PARTS ++udevadm settle ++$TS_CMD_SFDISK $TS_DEVICE &> /dev/null < +Date: Thu, 2 Feb 2023 14:47:04 +0100 +Subject: libmount: use generic error message for EACCES on umount + +Signed-off-by: Karel Zak +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2149394 +--- + libmount/src/context_umount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c +index 240ec3be6..23aaae395 100644 +--- a/libmount/src/context_umount.c ++++ b/libmount/src/context_umount.c +@@ -1123,7 +1123,7 @@ int mnt_context_get_umount_excode( + snprintf(buf, bufsz, _("must be superuser to unmount")); + break; + case EACCES: +- snprintf(buf, bufsz, _("block devices are not permitted on filesystem")); ++ snprintf(buf, bufsz, _("filesystem not accessible")); + break; + default: + return mnt_context_get_generic_excode(syserr, buf, bufsz,_("umount(2) system call failed: %m")); +-- +2.39.1 + diff --git a/0090-lslogins-man-explain-password-statuses.patch b/0090-lslogins-man-explain-password-statuses.patch new file mode 100644 index 0000000..7dbc434 --- /dev/null +++ b/0090-lslogins-man-explain-password-statuses.patch @@ -0,0 +1,45 @@ +From ea1ad5e7260c770b21e547702b1e0acef9e4854c Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 2 Feb 2023 14:52:35 +0100 +Subject: lslogins: (man) explain password statuses + +Upstream: http://github.com/util-linux/util-linux/commit/95ea3dd4128b625ab12691229020ebc50d578e71 +Upstream: http://github.com/util-linux/util-linux/commit/8001bffb03eda8d23d6a04a5dc1469cce932ae36 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2159544 +Signed-off-by: Karel Zak +--- + login-utils/lslogins.1 | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/login-utils/lslogins.1 b/login-utils/lslogins.1 +index c831739d9..5c327caf5 100644 +--- a/login-utils/lslogins.1 ++++ b/login-utils/lslogins.1 +@@ -116,6 +116,24 @@ Delimit user entries with a nul character, instead of a newline. + + .SH NOTES + The default UID thresholds are read from /etc/login.defs. ++.SS "Password status" ++.sp ++Multiple fields describe password status. ++.sp ++\fB"Login by password disabled"\fP ++.RS 4 ++\*(Aqyes\*(Aq means that there is no valid password. The password hash is missing, or the hash method is unknown or contains invalid chars. ++.RE ++.sp ++\fB"Password not required (empty)"\fP ++.RS 4 ++The password is not set (hash is missing); this is common for locked system accounts. Not requiring a password does not mean the user can log\-in without a password. It depends on the password "lock" status. ++.RE ++.sp ++\fB"Password is locked"\fP ++.RS 4 ++The password is prefixed by \*(Aq!!\*(Aq, and the user cannot login although the password is set or empty. This is common for new accounts without a set password. ++.RE + + .SH EXIT STATUS + .TP +-- +2.39.1 + diff --git a/0091-last-sync-utmp-strings-use-with-upstream-code.patch b/0091-last-sync-utmp-strings-use-with-upstream-code.patch new file mode 100644 index 0000000..6e0abc3 --- /dev/null +++ b/0091-last-sync-utmp-strings-use-with-upstream-code.patch @@ -0,0 +1,245 @@ +From 25f7136d326753cb0bb7612a98db6542c9fdc3bd Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 2 Feb 2023 15:22:52 +0100 +Subject: last: sync utmp strings use with upstream code + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2160321 +Signed-off-by: Karel Zak +--- + include/strutils.h | 30 +++++++++++++++++++ + include/timeutils.h | 1 + + login-utils/last.c | 73 +++++++++++++++++++++++---------------------- + 3 files changed, 69 insertions(+), 35 deletions(-) + +diff --git a/include/strutils.h b/include/strutils.h +index 5d07fcc7c..193f1acbc 100644 +--- a/include/strutils.h ++++ b/include/strutils.h +@@ -65,6 +65,36 @@ static inline void xstrncpy(char *dest, const char *src, size_t n) + dest[n-1] = 0; + } + ++/* This is like strncpy(), but based on memcpy(), so compilers and static ++ * analyzers do not complain when sizeof(destination) is the same as 'n' and ++ * result is not terminated by zero. ++ * ++ * Use this function to copy string to logs with fixed sizes (wtmp/utmp. ...) ++ * where string terminator is optional. ++ */ ++static inline void * __attribute__((nonnull (1))) ++str2memcpy(void *dest, const char *src, size_t n) ++{ ++ size_t bytes = strlen(src) + 1; ++ ++ if (bytes > n) ++ bytes = n; ++ ++ memcpy(dest, src, bytes); ++ return dest; ++} ++ ++static inline char * __attribute__((nonnull (1))) ++mem2strcpy(char *dest, const void *src, size_t n, size_t nmax) ++{ ++ if (n + 1 > nmax) ++ n = nmax - 1; ++ ++ memset(dest, '\0', nmax); ++ memcpy(dest, src, n); ++ return dest; ++} ++ + static inline int strdup_to_offset(void *stru, size_t offset, const char *str) + { + char *n = NULL; +diff --git a/include/timeutils.h b/include/timeutils.h +index 230e6db5f..f1540a183 100644 +--- a/include/timeutils.h ++++ b/include/timeutils.h +@@ -74,6 +74,7 @@ enum { + ISO_TIMESTAMP_COMMA_GT = ISO_TIMESTAMP_COMMA_G | ISO_T + }; + ++#define CTIME_BUFSIZ 26 + #define ISO_BUFSIZ 42 + + int strtimeval_iso(struct timeval *tv, int flags, char *buf, size_t bufsz); +diff --git a/login-utils/last.c b/login-utils/last.c +index 80d77d20b..8f7c36984 100644 +--- a/login-utils/last.c ++++ b/login-utils/last.c +@@ -339,15 +339,22 @@ static int time_formatter(int fmt, char *dst, size_t dlen, time_t *when) + break; + case LAST_TIMEFTM_HHMM: + { +- struct tm *tm = localtime(when); +- if (!snprintf(dst, dlen, "%02d:%02d", tm->tm_hour, tm->tm_min)) ++ struct tm tm; ++ ++ localtime_r(when, &tm); ++ if (!snprintf(dst, dlen, "%02d:%02d", tm.tm_hour, tm.tm_min)) + ret = -1; + break; + } + case LAST_TIMEFTM_CTIME: +- snprintf(dst, dlen, "%s", ctime(when)); ++ { ++ char buf[CTIME_BUFSIZ]; ++ ++ ctime_r(when, buf); ++ snprintf(dst, dlen, "%s", buf); + ret = rtrim_whitespace((unsigned char *) dst); + break; ++ } + case LAST_TIMEFTM_ISO8601: + ret = strtime_iso(when, ISO_TIMESTAMP_T, dst, dlen); + break; +@@ -394,8 +401,7 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t + /* + * uucp and ftp have special-type entries + */ +- utline[0] = 0; +- strncat(utline, p->ut_line, sizeof(p->ut_line)); ++ mem2strcpy(utline, p->ut_line, sizeof(p->ut_line), sizeof(utline)); + if (strncmp(utline, "ftp", 3) == 0 && isdigit(utline[3])) + utline[3] = 0; + if (strncmp(utline, "uucp", 4) == 0 && isdigit(utline[4])) +@@ -447,48 +453,48 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t + + if (logout_time == currentdate) { + if (ctl->time_fmt > LAST_TIMEFTM_SHORT) { +- sprintf(logouttime, " still running"); ++ snprintf(logouttime, sizeof(logouttime), " still running"); + length[0] = 0; + } else { +- sprintf(logouttime, " still"); +- sprintf(length, "running"); ++ snprintf(logouttime, sizeof(logouttime), " still"); ++ snprintf(length, sizeof(length), "running"); + } + } else if (days) { +- sprintf(length, "(%d+%02d:%02d)", days, abs(hours), abs(mins)); /* hours and mins always shown as positive (w/o minus sign!) even if secs < 0 */ ++ snprintf(length, sizeof(length), "(%d+%02d:%02d)", days, abs(hours), abs(mins)); /* hours and mins always shown as positive (w/o minus sign!) even if secs < 0 */ + } else if (hours) { +- sprintf(length, " (%02d:%02d)", hours, abs(mins)); /* mins always shown as positive (w/o minus sign!) even if secs < 0 */ ++ snprintf(length, sizeof(length), " (%02d:%02d)", hours, abs(mins)); /* mins always shown as positive (w/o minus sign!) even if secs < 0 */ + } else if (secs >= 0) { +- sprintf(length, " (%02d:%02d)", hours, mins); ++ snprintf(length, sizeof(length), " (%02d:%02d)", hours, mins); + } else { +- sprintf(length, " (-00:%02d)", abs(mins)); /* mins always shown as positive (w/o minus sign!) even if secs < 0 */ ++ snprintf(length, sizeof(length), " (-00:%02d)", abs(mins)); /* mins always shown as positive (w/o minus sign!) even if secs < 0 */ + } + + switch(what) { + case R_CRASH: +- sprintf(logouttime, "- crash"); ++ snprintf(logouttime, sizeof(logouttime), "- crash"); + break; + case R_DOWN: +- sprintf(logouttime, "- down "); ++ snprintf(logouttime, sizeof(logouttime), "- down "); + break; + case R_NOW: + if (ctl->time_fmt > LAST_TIMEFTM_SHORT) { +- sprintf(logouttime, " still logged in"); ++ snprintf(logouttime, sizeof(logouttime), " still logged in"); + length[0] = 0; + } else { +- sprintf(logouttime, " still"); +- sprintf(length, "logged in"); ++ snprintf(logouttime, sizeof(logouttime), " still"); ++ snprintf(length, sizeof(length), "logged in"); + } + break; + case R_PHANTOM: + if (ctl->time_fmt > LAST_TIMEFTM_SHORT) { +- sprintf(logouttime, " gone - no logout"); ++ snprintf(logouttime, sizeof(logouttime), " gone - no logout"); + length[0] = 0; + } else if (ctl->time_fmt == LAST_TIMEFTM_SHORT) { +- sprintf(logouttime, " gone"); +- sprintf(length, "- no logout"); ++ snprintf(logouttime, sizeof(logouttime), " gone"); ++ snprintf(length, sizeof(length), "- no logout"); + } else { + logouttime[0] = 0; +- sprintf(length, "no logout"); ++ snprintf(length, sizeof(length), "no logout"); + } + break; + case R_TIMECHANGE: +@@ -508,15 +514,8 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t + r = -1; + if (ctl->usedns || ctl->useip) + r = dns_lookup(domain, sizeof(domain), ctl->useip, (int32_t*)p->ut_addr_v6); +- if (r < 0) { +- size_t sz = sizeof(p->ut_host); +- +- if (sz > sizeof(domain)) +- sz = sizeof(domain); +- +- xstrncpy(domain, p->ut_host, sz); +- } +- ++ if (r < 0) ++ mem2strcpy(domain, p->ut_host, sizeof(p->ut_host), sizeof(domain)); + + if (ctl->showhost) { + if (!ctl->altlist) { +@@ -607,10 +606,11 @@ static int is_phantom(const struct last_control *ctl, struct utmpx *ut) + + if (ut->ut_tv.tv_sec < ctl->boot_time.tv_sec) + return 1; ++ ut->ut_user[sizeof(ut->ut_user) - 1] = '\0'; + pw = getpwnam(ut->ut_user); + if (!pw) + return 1; +- sprintf(path, "/proc/%u/loginuid", ut->ut_pid); ++ snprintf(path, sizeof(path), "/proc/%u/loginuid", ut->ut_pid); + if (access(path, R_OK) == 0) { + unsigned int loginuid; + FILE *f = NULL; +@@ -624,8 +624,11 @@ static int is_phantom(const struct last_control *ctl, struct utmpx *ut) + return 1; + } else { + struct stat st; ++ char utline[sizeof(ut->ut_line) + 1]; ++ ++ mem2strcpy(utline, ut->ut_line, sizeof(ut->ut_line), sizeof(utline)); + +- sprintf(path, "/dev/%s", ut->ut_line); ++ snprintf(path, sizeof(path), "/dev/%s", utline); + if (stat(path, &st)) + return 1; + if (pw->pw_uid != st.st_uid) +@@ -736,7 +739,7 @@ static void process_wtmp_file(const struct last_control *ctl, + else { + if (ut.ut_type != DEAD_PROCESS && + ut.ut_user[0] && ut.ut_line[0] && +- strcmp(ut.ut_user, "LOGIN") != 0) ++ strncmp(ut.ut_user, "LOGIN", 5) != 0) + ut.ut_type = USER_PROCESS; + /* + * Even worse, applications that write ghost +@@ -749,7 +752,7 @@ static void process_wtmp_file(const struct last_control *ctl, + /* + * Clock changes. + */ +- if (strcmp(ut.ut_user, "date") == 0) { ++ if (strncmp(ut.ut_user, "date", 4) == 0) { + if (ut.ut_line[0] == '|') + ut.ut_type = OLD_TIME; + if (ut.ut_line[0] == '{') +@@ -784,7 +787,7 @@ static void process_wtmp_file(const struct last_control *ctl, + case RUN_LVL: + x = ut.ut_pid & 255; + if (ctl->extended) { +- sprintf(ut.ut_line, "(to lvl %c)", x); ++ snprintf(ut.ut_line, sizeof(ut.ut_line), "(to lvl %c)", x); + quit = list(ctl, &ut, lastrch, R_NORMAL); + } + if (x == '0' || x == '6') { +-- +2.39.1 + diff --git a/0092-last-use-full-size-of-the-username.patch b/0092-last-use-full-size-of-the-username.patch new file mode 100644 index 0000000..a676580 --- /dev/null +++ b/0092-last-use-full-size-of-the-username.patch @@ -0,0 +1,55 @@ +From f435f80b9ae88caf9fe8af2e9b705dc8296ad6f3 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 13 Feb 2023 16:22:23 +0100 +Subject: last: use full size of the username + +utmp uses 32 bytes for username, last(1) truncates it to 31 when calls getpwnam(). + +Reported-by: Radka Skvarilova +Signed-off-by: Karel Zak +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2160321 +Upstream: http://github.com/util-linux/util-linux/commit/4b646f01600a5efcf16e8e8991010b49b250bdfe +--- + login-utils/last.1 | 4 ++++ + login-utils/last.c | 6 ++++-- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/login-utils/last.1 b/login-utils/last.1 +index 94b4ed012..9169abd35 100644 +--- a/login-utils/last.1 ++++ b/login-utils/last.1 +@@ -178,6 +178,10 @@ files to be used, they can be created with a simple + .BR touch (1) + command (for example, + .IR "touch /var/log/wtmp" ). ++ ++The utmp file format uses fixed sizes of strings, which means that very long strings are ++impossible to store in the file and impossible to display by last. The usual limits are 32 ++bytes for a user and line name and 256 bytes for a hostname. + .SH FILES + /var/log/wtmp + .br +diff --git a/login-utils/last.c b/login-utils/last.c +index 8f7c36984..41ce03894 100644 +--- a/login-utils/last.c ++++ b/login-utils/last.c +@@ -602,12 +602,14 @@ static int is_phantom(const struct last_control *ctl, struct utmpx *ut) + { + struct passwd *pw; + char path[sizeof(ut->ut_line) + 16]; ++ char user[sizeof(ut->ut_user) + 1]; + int ret = 0; + + if (ut->ut_tv.tv_sec < ctl->boot_time.tv_sec) + return 1; +- ut->ut_user[sizeof(ut->ut_user) - 1] = '\0'; +- pw = getpwnam(ut->ut_user); ++ ++ mem2strcpy(user, ut->ut_user, sizeof(ut->ut_user), sizeof(user)); ++ pw = getpwnam(user); + if (!pw) + return 1; + snprintf(path, sizeof(path), "/proc/%u/loginuid", ut->ut_pid); +-- +2.39.1 + diff --git a/0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch b/0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch new file mode 100644 index 0000000..3e90da0 --- /dev/null +++ b/0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch @@ -0,0 +1,47 @@ +From 428791718a166ee5ce275b0bcf4a904a97e6af9d Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 13 Dec 2021 13:19:18 +0100 +Subject: include/c: add cmp_timespec() and cmp_stat_mtime() + +It's like timercmp() in libc, but for timespec and for stat.st_mtim +(or stat.st_mtime for old struct stat versions). + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2180413 +Upstream: http://github.com/util-linux/util-linux/commit/0cfb8c5c3205a92ae81def278cdded63ea47094f +Signed-off-by: Karel Zak +--- + include/c.h | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/include/c.h b/include/c.h +index c8bcb375b..e48ac6d7d 100644 +--- a/include/c.h ++++ b/include/c.h +@@ -125,6 +125,24 @@ + _a == _b ? 0 : _a > _b ? 1 : -1; }) + #endif + ++ ++#ifndef cmp_timespec ++# define cmp_timespec(a, b, CMP) \ ++ (((a)->tv_sec == (b)->tv_sec) \ ++ ? ((a)->tv_nsec CMP (b)->tv_nsec) \ ++ : ((a)->tv_sec CMP (b)->tv_sec)) ++#endif ++ ++ ++#ifndef cmp_stat_mtime ++# ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC ++# define cmp_stat_mtime(_a, _b, CMP) cmp_timespec(&(_a)->st_mtim, &(_b)->st_mtim, CMP) ++# else ++# define cmp_stat_mtime(_a, _b, CMP) ((_a)->st_mtime CMP (_b)->st_mtime) ++# endif ++#endif ++ ++ + #ifndef offsetof + #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + #endif +-- +2.39.2 + diff --git a/0094-mount-add-hint-about-systemctl-daemon-reload.patch b/0094-mount-add-hint-about-systemctl-daemon-reload.patch new file mode 100644 index 0000000..f745f14 --- /dev/null +++ b/0094-mount-add-hint-about-systemctl-daemon-reload.patch @@ -0,0 +1,86 @@ +From 7cc9fe69d3f35038b7b3329fef0cccdbe38ffef6 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 13 Dec 2021 13:22:56 +0100 +Subject: mount: add hint about systemctl daemon-reload + +This commit implements an extra hint for systemd based distros to +inform users that units currently used by systemd are older than +fstab. This situation is usually unwanted, and 'systemctl +daemon-reload' is recommended. + +The message is printed only on terminal to avoid extra messages in +logs, etc. + +Addresses: https://github.com/systemd/systemd/pull/20476 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2180413 +Upstream: http://github.com/util-linux/util-linux/commit/1db0715169954a8f3898f7ca9d3902cd6c27084d +Signed-off-by: Karel Zak +--- + include/pathnames.h | 2 ++ + sys-utils/mount.c | 23 +++++++++++++++++++++++ + 2 files changed, 25 insertions(+) + +diff --git a/include/pathnames.h b/include/pathnames.h +index 77f8b6e85..19b117cb9 100644 +--- a/include/pathnames.h ++++ b/include/pathnames.h +@@ -76,6 +76,8 @@ + #define _PATH_NUMLOCK_ON _PATH_RUNSTATEDIR "/numlock-on" + #define _PATH_LOGINDEFS "/etc/login.defs" + ++#define _PATH_SD_UNITSLOAD _PATH_RUNSTATEDIR "/systemd/systemd-units-load" ++ + /* misc paths */ + #define _PATH_WORDS "/usr/share/dict/words" + #define _PATH_WORDS_ALT "/usr/share/dict/web2" +diff --git a/sys-utils/mount.c b/sys-utils/mount.c +index 83cccf63e..108b55001 100644 +--- a/sys-utils/mount.c ++++ b/sys-utils/mount.c +@@ -38,6 +38,7 @@ + #include "strutils.h" + #include "closestream.h" + #include "canonicalize.h" ++#include "pathnames.h" + + #define XALLOC_EXIT_CODE MNT_EX_SYSERR + #include "xalloc.h" +@@ -287,6 +288,25 @@ static void selinux_warning(struct libmnt_context *cxt, const char *tgt) + # define selinux_warning(_x, _y) + #endif + ++static void systemd_hint(void) ++{ ++ static int fstab_check_done = 0; ++ ++ if (fstab_check_done == 0) { ++ struct stat a, b; ++ ++ if (isatty(STDERR_FILENO) && ++ stat(_PATH_SD_UNITSLOAD, &a) == 0 && ++ stat(_PATH_MNTTAB, &b) == 0 && ++ cmp_stat_mtime(&a, &b, <)) ++ printf(_( ++ "mount: (hint) your fstab has been modified, but systemd still uses\n" ++ " the old version; use 'systemctl daemon-reload' to reload.\n")); ++ ++ fstab_check_done = 1; ++ } ++} ++ + /* + * Returns exit status (MNT_EX_*) and/or prints error message. + */ +@@ -310,6 +330,9 @@ static int mk_exit_code(struct libmnt_context *cxt, int rc) + if (rc == MNT_EX_SUCCESS && mnt_context_get_status(cxt) == 1) { + selinux_warning(cxt, tgt); + } ++ ++ systemd_hint(); ++ + return rc; + } + +-- +2.39.2 + diff --git a/1001-hwclock-make-glibc-2.31-compatible.patch b/1001-hwclock-make-glibc-2.31-compatible.patch deleted file mode 100644 index d4908a6..0000000 --- a/1001-hwclock-make-glibc-2.31-compatible.patch +++ /dev/null @@ -1,161 +0,0 @@ -From e42f9f05a96c9e0129722b15fc638d4133ac1ecb Mon Sep 17 00:00:00 2001 -From: J William Piggott -Date: Tue, 19 Apr 2022 23:22:11 -0400 -Subject: [PATCH] hwclock: make glibc 2.31 compatible -______________________________________________________ -GNU C Library NEWS -- history of user-visible changes. -Version 2.31 -Deprecated and removed features, and other changes affecting compatibility: - -* The settimeofday function can still be used to set a system-wide time - zone when the operating system supports it. This is because the Linux - kernel reused the API, on some architectures, to describe a system-wide - time-zone-like offset between the software clock maintained by the kernel, - and the "RTC" clock that keeps time when the system is shut down. - - However, to reduce the odds of this offset being set by accident, - settimeofday can no longer be used to set the time and the offset - simultaneously. If both of its two arguments are non-null, the call - will fail (setting errno to EINVAL). - - Callers attempting to set this offset should also be prepared for the call - to fail and set errno to ENOSYS; this already happens on the Hurd and on - some Linux architectures. The Linux kernel maintainers are discussing a - more principled replacement for the reused API. After a replacement - becomes available, we will change settimeofday to fail with ENOSYS on all - platforms when its 'tzp' argument is not a null pointer. - - settimeofday itself is obsolescent according to POSIX. Programs that set - the system time should use clock_settime and/or the adjtime family of - functions instead. We may cease to make settimeofday available to newly - linked binaries after there is a replacement for Linux's time-zone-like - offset API. -______________________________________________________ - -hwclock(8) had one settimeofday(2) call where both args were set for ---hctosys when the RTC was ticking UTC. This allowed setting the system -time, timezone, and locking the warp_clock function with a single call. -That operation now takes 3 calls of settimeofday(2). - -Although this common operation now takes three calls, the overall logic -for the set_system_clock() function was simplified. - -Co-Author: Karel Zak -Signed-off-by: J William Piggott ---- - sys-utils/hwclock.c | 70 ++++++++++++++++++++++----------------------- - 1 file changed, 35 insertions(+), 35 deletions(-) - -diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c -index b83e710..19e7410 100644 ---- a/sys-utils/hwclock.c -+++ b/sys-utils/hwclock.c -@@ -583,28 +583,28 @@ display_time(struct timeval hwctime) - * tz.tz_minuteswest argument and sets PCIL (see below). At boot settimeofday(2) - * has one-shot access to this function as shown in the table below. - * -- * +-------------------------------------------------------------------+ -- * | settimeofday(tv, tz) | -- * |-------------------------------------------------------------------| -- * | Arguments | System Time | PCIL | | warp_clock | -- * | tv | tz | set | warped | set | firsttime | locked | -- * |---------|---------|---------------|------|-----------|------------| -- * | pointer | NULL | yes | no | no | 1 | no | -- * | pointer | pointer | yes | no | no | 0 | yes | -- * | NULL | ptr2utc | no | no | no | 0 | yes | -- * | NULL | pointer | no | yes | yes | 0 | yes | -- * +-------------------------------------------------------------------+ -+ * +-------------------------------------------------------------------------+ -+ * | settimeofday(tv, tz) | -+ * |-------------------------------------------------------------------------| -+ * | Arguments | System Time | TZ | PCIL | | warp_clock | -+ * | tv | tz | set | warped | set | set | firsttime | locked | -+ * |---------|---------|---------------|-----|------|-----------|------------| -+ * | pointer | NULL | yes | no | no | no | 1 | no | -+ * | NULL | ptr2utc | no | no | yes | no | 0 | yes | -+ * | NULL | pointer | no | yes | yes | yes | 0 | yes | -+ * +-------------------------------------------------------------------------+ - * ptr2utc: tz.tz_minuteswest is zero (UTC). - * PCIL: persistent_clock_is_local, sets the "11 minute mode" timescale. - * firsttime: locks the warp_clock function (initialized to 1 at boot). -+ * Since glibc v2.31 settimeofday() will fail if both args are non NULL - * - * +---------------------------------------------------------------------------+ - * | op | RTC scale | settimeofday calls | - * |---------|-----------|-----------------------------------------------------| - * | systz | Local | 1) warps system time*, sets PCIL* and kernel tz | - * | systz | UTC | 1st) locks warp_clock* 2nd) sets kernel tz | -- * | hctosys | Local | 1st) sets PCIL* 2nd) sets system time and kernel tz | -- * | hctosys | UTC | 1) sets system time and kernel tz | -+ * | hctosys | Local | 1st) sets PCIL* & kernel tz 2nd) sets system time | -+ * | hctosys | UTC | 1st) locks warp* 2nd) sets tz 3rd) sets system time | - * +---------------------------------------------------------------------------+ - * * only on first call after boot - */ -@@ -615,41 +615,41 @@ set_system_clock(const struct hwclock_control *ctl, - struct tm broken; - int minuteswest; - int rc = 0; -- const struct timezone tz_utc = { 0 }; - - localtime_r(&newtime.tv_sec, &broken); - minuteswest = -get_gmtoff(&broken) / 60; - - if (ctl->verbose) { -- if (ctl->hctosys && !ctl->universal) -- printf(_("Calling settimeofday(NULL, %d) to set " -- "persistent_clock_is_local.\n"), minuteswest); -- if (ctl->systz && ctl->universal) -+ if (ctl->universal) { - puts(_("Calling settimeofday(NULL, 0) " -- "to lock the warp function.")); -+ "to lock the warp_clock function.")); -+ if (!( ctl->universal && !minuteswest )) -+ printf(_("Calling settimeofday(NULL, %d) " -+ "to set the kernel timezone.\n"), -+ minuteswest); -+ } else -+ printf(_("Calling settimeofday(NULL, %d) to warp " -+ "System time, set PCIL and the kernel tz.\n"), -+ minuteswest); -+ - if (ctl->hctosys) -- printf(_("Calling settimeofday(%ld.%06ld, %d)\n"), -- newtime.tv_sec, newtime.tv_usec, minuteswest); -- else { -- printf(_("Calling settimeofday(NULL, %d) "), minuteswest); -- if (ctl->universal) -- puts(_("to set the kernel timezone.")); -- else -- puts(_("to warp System time.")); -- } -+ printf(_("Calling settimeofday(%ld.%06ld, NULL) " -+ "to set the System time.\n"), -+ newtime.tv_sec, newtime.tv_usec); - } - - if (!ctl->testing) { -+ const struct timezone tz_utc = { 0 }; - const struct timezone tz = { minuteswest }; -- -- if (ctl->hctosys && !ctl->universal) /* set PCIL */ -- rc = settimeofday(NULL, &tz); -- if (ctl->systz && ctl->universal) /* lock warp_clock */ -+ /* If UTC RTC: lock warp_clock and PCIL */ -+ if (ctl->universal) - rc = settimeofday(NULL, &tz_utc); -- if (!rc && ctl->hctosys) -- rc = settimeofday(&newtime, &tz); -- else if (!rc) -+ /* Set kernel tz; if localtime RTC: warp_clock and set PCIL */ -+ if (!rc && !( ctl->universal && !minuteswest )) - rc = settimeofday(NULL, &tz); -+ /* Set the System Clock */ -+ if ((!rc || errno == ENOSYS) && ctl->hctosys) -+ rc = settimeofday(&newtime, NULL); - - if (rc) { - warn(_("settimeofday() failed")); --- -2.27.0 - diff --git a/1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch b/1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch deleted file mode 100644 index 9b6afb1..0000000 --- a/1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch +++ /dev/null @@ -1,24 +0,0 @@ -From dc11290085e49ec47be148447104f50ce3e7244b Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 27 Sep 2022 11:21:16 +0800 -Subject: [PATCH] add Neoverse-N2 to ARM identifiers tables - ---- - sys-utils/lscpu-arm.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c -index 2b178a7..697a4b2 100644 ---- a/sys-utils/lscpu-arm.c -+++ b/sys-utils/lscpu-arm.c -@@ -80,6 +80,7 @@ static const struct id_part arm_part[] = { - { 0xd21, "Cortex-M33" }, - { 0xd41, "Cortex-A78" }, - { 0xd42, "Cortex-A78AE" }, -+ { 0xd49, "Neoverse-N2" }, - { 0xd4a, "Neoverse-E1" }, - { 0xd4b, "Cortex-A78C" }, - { -1, "unknown" }, --- -2.31.1 - diff --git a/1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch b/1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch deleted file mode 100644 index 1893c87..0000000 --- a/1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 117b51eb538673be49bf0e619d2307a65963d1dd Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 27 Sep 2022 15:31:51 +0800 -Subject: [PATCH] fix lscpu to get cpu frequency from cpuinfo on arm64 - ---- - sys-utils/lscpu.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c -index 70a797d..a7014a0 100644 ---- a/sys-utils/lscpu.c -+++ b/sys-utils/lscpu.c -@@ -433,6 +433,7 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod) - else if (lookup(buf, "stepping", &desc->stepping)) ; - else if (lookup(buf, "CPU variant", &desc->stepping)) ; /* aarch64 */ - else if (lookup(buf, "cpu MHz", &desc->mhz)) ; -+ else if (lookup(buf, "CPU MHz", &desc->mhz)) ; /* aarch64 */ - else if (lookup(buf, "cpu MHz dynamic", &desc->dynamic_mhz)) ; /* s390 */ - else if (lookup(buf, "cpu MHz static", &desc->static_mhz)) ; /* s390 */ - else if (lookup(buf, "flags", &desc->flags)) ; /* x86 */ --- -2.31.1 - diff --git a/dist b/dist index 535c690..5aa45c5 100644 --- a/dist +++ b/dist @@ -1 +1 @@ -an8_7 +an8_8 diff --git a/util-linux.spec b/util-linux.spec index 4d8be66..4a1296d 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -1,9 +1,8 @@ -%define anolis_release .0.1 ### Header Summary: A collection of basic system utilities Name: util-linux Version: 2.32.1 -Release: 39%{anolis_release}%{?dist} +Release: 42%{?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 @@ -262,17 +261,29 @@ Patch82: 0082-lslogins-improve-prefixes-interpretation.patch Patch83: 0083-tests-update-atari-blkid-tests.patch Patch84: 0084-tests-update-atari-partx-tests.patch -### RHEL-8.7.Z +### RHEL-8.8 ### -# 2141969 - Add --cont-clock feature for libuuid and uuidd +# 2141969 - Add --cont-clock feature for libuuid and uuidd [rhel-8] Patch85: 0085-libuuid-Implement-continuous-clock-handling-for-time.patch Patch86: 0086-libuuid-check-clock-value-from-LIBUUID_CLOCK_FILE.patch -# Begin: Anolis customized patches -# hwclock: make glibc 2.31 compatible -Patch1001: 1001-hwclock-make-glibc-2.31-compatible.patch -Patch1002: 1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch -Patch1003: 1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch -# End: Anolis customized patches +# 2121699 - fstrim -av fails to trim root filesystem on Red Hat Coreos +Patch87: 0087-fstrim-backport-entries-de-duplication.patch +# 2142496 - update upstream tests +Patch88: 0088-tests-don-t-reply-on-scsi_debug-partitions.patch +# 2149394 - umount outputs inaccurate error message when umount() fails with EACCES +Patch89: 0089-libmount-use-generic-error-message-for-EACCES-on-umo.patch +# 2159544 - lslogins "Password is locked" status changed in util-linux-2.32.1-38 +Patch90: 0090-lslogins-man-explain-password-statuses.patch +# 2160321 - [last] ut->ut_user is not null terminated +Patch91: 0091-last-sync-utmp-strings-use-with-upstream-code.patch +Patch92: 0092-last-use-full-size-of-the-username.patch + +### RHEL-8.9 +### +# 2180413 - Backport hint about systemd daemon-reload +Patch93: 0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch +Patch94: 0094-mount-add-hint-about-systemctl-daemon-reload.patch + %description The util-linux package contains a large variety of low-level system @@ -1121,12 +1132,20 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog -* Mon Jan 30 2023 Weitao Zhou 2.32.1-39.0.1 -- [Patch] hwclock: better compatibility for both glibc2.28 and glibc2.31 -- [Patch] lscpu: add Neoverse-N2 to ARM identifiers tables (flin@linux.alibaba.com) -- [Patch] lscpu: fix lscpu to get cpu frequency from cpuinfo on arm64 (flin@linux.alibaba.com) +* Thu Mar 30 2023 Karel Zak 2.32.1-42 +- fix #2180413 - Backport hint about systemd daemon-reload + +* Mon Feb 13 2023 Karel Zak 2.32.1-41 +- improve #2160321 - [last] ut->ut_user is not null terminated + +* Mon Feb 06 2023 Karel Zak 2.32.1-40 +- fix #2121699 - fstrim -av fails to trim root filesystem on Red Hat Coreos +- fix #2142496 - update upstream tests +- fix #2149394 - umount outputs inaccurate error message when umount() fails with EACCES +- fix #2159544 - lslogins "Password is locked" status changed in util-linux-2.32.1-38 +- fix #2160321 - [last] ut->ut_user is not null terminated -* Wed Nov 16 2022 Karel Zak 2.32.1-39 +* Fri Nov 11 2022 Karel Zak 2.32.1-39 - fix #2141969 - Add --cont-clock feature for libuuid and uuidd * Mon Aug 22 2022 Karel Zak 2.32.1-38 -- Gitee From 7dfb7e3155f679a7500f809f2acaea0d51052bb6 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Tue, 17 May 2022 22:36:54 +0800 Subject: [PATCH 2/4] hwclock: better compatibility for both glibc2.28 and glibc2.32 --- 1001-hwclock-make-glibc-2.31-compatible.patch | 161 ++++++++++++++++++ util-linux.spec | 10 +- 2 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 1001-hwclock-make-glibc-2.31-compatible.patch diff --git a/1001-hwclock-make-glibc-2.31-compatible.patch b/1001-hwclock-make-glibc-2.31-compatible.patch new file mode 100644 index 0000000..d4908a6 --- /dev/null +++ b/1001-hwclock-make-glibc-2.31-compatible.patch @@ -0,0 +1,161 @@ +From e42f9f05a96c9e0129722b15fc638d4133ac1ecb Mon Sep 17 00:00:00 2001 +From: J William Piggott +Date: Tue, 19 Apr 2022 23:22:11 -0400 +Subject: [PATCH] hwclock: make glibc 2.31 compatible +______________________________________________________ +GNU C Library NEWS -- history of user-visible changes. +Version 2.31 +Deprecated and removed features, and other changes affecting compatibility: + +* The settimeofday function can still be used to set a system-wide time + zone when the operating system supports it. This is because the Linux + kernel reused the API, on some architectures, to describe a system-wide + time-zone-like offset between the software clock maintained by the kernel, + and the "RTC" clock that keeps time when the system is shut down. + + However, to reduce the odds of this offset being set by accident, + settimeofday can no longer be used to set the time and the offset + simultaneously. If both of its two arguments are non-null, the call + will fail (setting errno to EINVAL). + + Callers attempting to set this offset should also be prepared for the call + to fail and set errno to ENOSYS; this already happens on the Hurd and on + some Linux architectures. The Linux kernel maintainers are discussing a + more principled replacement for the reused API. After a replacement + becomes available, we will change settimeofday to fail with ENOSYS on all + platforms when its 'tzp' argument is not a null pointer. + + settimeofday itself is obsolescent according to POSIX. Programs that set + the system time should use clock_settime and/or the adjtime family of + functions instead. We may cease to make settimeofday available to newly + linked binaries after there is a replacement for Linux's time-zone-like + offset API. +______________________________________________________ + +hwclock(8) had one settimeofday(2) call where both args were set for +--hctosys when the RTC was ticking UTC. This allowed setting the system +time, timezone, and locking the warp_clock function with a single call. +That operation now takes 3 calls of settimeofday(2). + +Although this common operation now takes three calls, the overall logic +for the set_system_clock() function was simplified. + +Co-Author: Karel Zak +Signed-off-by: J William Piggott +--- + sys-utils/hwclock.c | 70 ++++++++++++++++++++++----------------------- + 1 file changed, 35 insertions(+), 35 deletions(-) + +diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c +index b83e710..19e7410 100644 +--- a/sys-utils/hwclock.c ++++ b/sys-utils/hwclock.c +@@ -583,28 +583,28 @@ display_time(struct timeval hwctime) + * tz.tz_minuteswest argument and sets PCIL (see below). At boot settimeofday(2) + * has one-shot access to this function as shown in the table below. + * +- * +-------------------------------------------------------------------+ +- * | settimeofday(tv, tz) | +- * |-------------------------------------------------------------------| +- * | Arguments | System Time | PCIL | | warp_clock | +- * | tv | tz | set | warped | set | firsttime | locked | +- * |---------|---------|---------------|------|-----------|------------| +- * | pointer | NULL | yes | no | no | 1 | no | +- * | pointer | pointer | yes | no | no | 0 | yes | +- * | NULL | ptr2utc | no | no | no | 0 | yes | +- * | NULL | pointer | no | yes | yes | 0 | yes | +- * +-------------------------------------------------------------------+ ++ * +-------------------------------------------------------------------------+ ++ * | settimeofday(tv, tz) | ++ * |-------------------------------------------------------------------------| ++ * | Arguments | System Time | TZ | PCIL | | warp_clock | ++ * | tv | tz | set | warped | set | set | firsttime | locked | ++ * |---------|---------|---------------|-----|------|-----------|------------| ++ * | pointer | NULL | yes | no | no | no | 1 | no | ++ * | NULL | ptr2utc | no | no | yes | no | 0 | yes | ++ * | NULL | pointer | no | yes | yes | yes | 0 | yes | ++ * +-------------------------------------------------------------------------+ + * ptr2utc: tz.tz_minuteswest is zero (UTC). + * PCIL: persistent_clock_is_local, sets the "11 minute mode" timescale. + * firsttime: locks the warp_clock function (initialized to 1 at boot). ++ * Since glibc v2.31 settimeofday() will fail if both args are non NULL + * + * +---------------------------------------------------------------------------+ + * | op | RTC scale | settimeofday calls | + * |---------|-----------|-----------------------------------------------------| + * | systz | Local | 1) warps system time*, sets PCIL* and kernel tz | + * | systz | UTC | 1st) locks warp_clock* 2nd) sets kernel tz | +- * | hctosys | Local | 1st) sets PCIL* 2nd) sets system time and kernel tz | +- * | hctosys | UTC | 1) sets system time and kernel tz | ++ * | hctosys | Local | 1st) sets PCIL* & kernel tz 2nd) sets system time | ++ * | hctosys | UTC | 1st) locks warp* 2nd) sets tz 3rd) sets system time | + * +---------------------------------------------------------------------------+ + * * only on first call after boot + */ +@@ -615,41 +615,41 @@ set_system_clock(const struct hwclock_control *ctl, + struct tm broken; + int minuteswest; + int rc = 0; +- const struct timezone tz_utc = { 0 }; + + localtime_r(&newtime.tv_sec, &broken); + minuteswest = -get_gmtoff(&broken) / 60; + + if (ctl->verbose) { +- if (ctl->hctosys && !ctl->universal) +- printf(_("Calling settimeofday(NULL, %d) to set " +- "persistent_clock_is_local.\n"), minuteswest); +- if (ctl->systz && ctl->universal) ++ if (ctl->universal) { + puts(_("Calling settimeofday(NULL, 0) " +- "to lock the warp function.")); ++ "to lock the warp_clock function.")); ++ if (!( ctl->universal && !minuteswest )) ++ printf(_("Calling settimeofday(NULL, %d) " ++ "to set the kernel timezone.\n"), ++ minuteswest); ++ } else ++ printf(_("Calling settimeofday(NULL, %d) to warp " ++ "System time, set PCIL and the kernel tz.\n"), ++ minuteswest); ++ + if (ctl->hctosys) +- printf(_("Calling settimeofday(%ld.%06ld, %d)\n"), +- newtime.tv_sec, newtime.tv_usec, minuteswest); +- else { +- printf(_("Calling settimeofday(NULL, %d) "), minuteswest); +- if (ctl->universal) +- puts(_("to set the kernel timezone.")); +- else +- puts(_("to warp System time.")); +- } ++ printf(_("Calling settimeofday(%ld.%06ld, NULL) " ++ "to set the System time.\n"), ++ newtime.tv_sec, newtime.tv_usec); + } + + if (!ctl->testing) { ++ const struct timezone tz_utc = { 0 }; + const struct timezone tz = { minuteswest }; +- +- if (ctl->hctosys && !ctl->universal) /* set PCIL */ +- rc = settimeofday(NULL, &tz); +- if (ctl->systz && ctl->universal) /* lock warp_clock */ ++ /* If UTC RTC: lock warp_clock and PCIL */ ++ if (ctl->universal) + rc = settimeofday(NULL, &tz_utc); +- if (!rc && ctl->hctosys) +- rc = settimeofday(&newtime, &tz); +- else if (!rc) ++ /* Set kernel tz; if localtime RTC: warp_clock and set PCIL */ ++ if (!rc && !( ctl->universal && !minuteswest )) + rc = settimeofday(NULL, &tz); ++ /* Set the System Clock */ ++ if ((!rc || errno == ENOSYS) && ctl->hctosys) ++ rc = settimeofday(&newtime, NULL); + + if (rc) { + warn(_("settimeofday() failed")); +-- +2.27.0 + diff --git a/util-linux.spec b/util-linux.spec index 4a1296d..2244929 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -1,8 +1,9 @@ +%define anolis_release .0.1 ### Header Summary: A collection of basic system utilities Name: util-linux Version: 2.32.1 -Release: 42%{?dist} +Release: 42%{anolis_release}%{?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 @@ -284,6 +285,10 @@ Patch92: 0092-last-use-full-size-of-the-username.patch Patch93: 0093-include-c-add-cmp_timespec-and-cmp_stat_mtime.patch Patch94: 0094-mount-add-hint-about-systemctl-daemon-reload.patch +# Begin: Anolis customized patches +# hwclock: make glibc 2.31 compatible +Patch1001: 1001-hwclock-make-glibc-2.31-compatible.patch +# End: Anolis customized patches %description The util-linux package contains a large variety of low-level system @@ -1132,6 +1137,9 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog +* Wed May 24 2023 Weitao Zhou 2.32.1-42.0.1 +- [Patch] hwclock: better compatibility for both glibc2.28 and glibc2.31 + * Thu Mar 30 2023 Karel Zak 2.32.1-42 - fix #2180413 - Backport hint about systemd daemon-reload -- Gitee From 0f36248de1bf716bd4ef7adeb7fc799475168e2b Mon Sep 17 00:00:00 2001 From: forrest_ly Date: Tue, 27 Sep 2022 11:41:34 +0800 Subject: [PATCH 3/4] add Neoverse-N2 to ARM identifiers tables that lscpu can identify armv9 cpu --- ...eoverse-N2-to-ARM-identifiers-tables.patch | 24 +++++++++++++++++++ util-linux.spec | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch diff --git a/1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch b/1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch new file mode 100644 index 0000000..9b6afb1 --- /dev/null +++ b/1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch @@ -0,0 +1,24 @@ +From dc11290085e49ec47be148447104f50ce3e7244b Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 27 Sep 2022 11:21:16 +0800 +Subject: [PATCH] add Neoverse-N2 to ARM identifiers tables + +--- + sys-utils/lscpu-arm.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c +index 2b178a7..697a4b2 100644 +--- a/sys-utils/lscpu-arm.c ++++ b/sys-utils/lscpu-arm.c +@@ -80,6 +80,7 @@ static const struct id_part arm_part[] = { + { 0xd21, "Cortex-M33" }, + { 0xd41, "Cortex-A78" }, + { 0xd42, "Cortex-A78AE" }, ++ { 0xd49, "Neoverse-N2" }, + { 0xd4a, "Neoverse-E1" }, + { 0xd4b, "Cortex-A78C" }, + { -1, "unknown" }, +-- +2.31.1 + diff --git a/util-linux.spec b/util-linux.spec index 2244929..7fe21c7 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -288,6 +288,7 @@ Patch94: 0094-mount-add-hint-about-systemctl-daemon-reload.patch # Begin: Anolis customized patches # hwclock: make glibc 2.31 compatible Patch1001: 1001-hwclock-make-glibc-2.31-compatible.patch +patch1002: 1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch # End: Anolis customized patches %description @@ -1139,6 +1140,7 @@ fi %changelog * Wed May 24 2023 Weitao Zhou 2.32.1-42.0.1 - [Patch] hwclock: better compatibility for both glibc2.28 and glibc2.31 +- [Patch] lscpu: add Neoverse-N2 to ARM identifiers tables (flin@linux.alibaba.com) * Thu Mar 30 2023 Karel Zak 2.32.1-42 - fix #2180413 - Backport hint about systemd daemon-reload -- Gitee From e48c515a7ffeca29fbf0c0013836bb4a88ed2ca6 Mon Sep 17 00:00:00 2001 From: forrest_ly Date: Tue, 27 Sep 2022 15:36:50 +0800 Subject: [PATCH 4/4] 1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch --- ...-cpu-frequency-from-cpuinfo-on-arm64.patch | 24 +++++++++++++++++++ util-linux.spec | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch diff --git a/1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch b/1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch new file mode 100644 index 0000000..1893c87 --- /dev/null +++ b/1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch @@ -0,0 +1,24 @@ +From 117b51eb538673be49bf0e619d2307a65963d1dd Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 27 Sep 2022 15:31:51 +0800 +Subject: [PATCH] fix lscpu to get cpu frequency from cpuinfo on arm64 + +--- + sys-utils/lscpu.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index 70a797d..a7014a0 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -433,6 +433,7 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod) + else if (lookup(buf, "stepping", &desc->stepping)) ; + else if (lookup(buf, "CPU variant", &desc->stepping)) ; /* aarch64 */ + else if (lookup(buf, "cpu MHz", &desc->mhz)) ; ++ else if (lookup(buf, "CPU MHz", &desc->mhz)) ; /* aarch64 */ + else if (lookup(buf, "cpu MHz dynamic", &desc->dynamic_mhz)) ; /* s390 */ + else if (lookup(buf, "cpu MHz static", &desc->static_mhz)) ; /* s390 */ + else if (lookup(buf, "flags", &desc->flags)) ; /* x86 */ +-- +2.31.1 + diff --git a/util-linux.spec b/util-linux.spec index 7fe21c7..38b5b44 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -288,7 +288,8 @@ Patch94: 0094-mount-add-hint-about-systemctl-daemon-reload.patch # Begin: Anolis customized patches # hwclock: make glibc 2.31 compatible Patch1001: 1001-hwclock-make-glibc-2.31-compatible.patch -patch1002: 1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch +Patch1002: 1002-add-Neoverse-N2-to-ARM-identifiers-tables.patch +Patch1003: 1003-fix-lscpu-to-get-cpu-frequency-from-cpuinfo-on-arm64.patch # End: Anolis customized patches %description @@ -1141,6 +1142,7 @@ fi * Wed May 24 2023 Weitao Zhou 2.32.1-42.0.1 - [Patch] hwclock: better compatibility for both glibc2.28 and glibc2.31 - [Patch] lscpu: add Neoverse-N2 to ARM identifiers tables (flin@linux.alibaba.com) +- [Patch] lscpu: fix lscpu to get cpu frequency from cpuinfo on arm64 (flin@linux.alibaba.com) * Thu Mar 30 2023 Karel Zak 2.32.1-42 - fix #2180413 - Backport hint about systemd daemon-reload -- Gitee