From 93c1847e52ad9916bccd8abcef361cf0f2df46c4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 5 Apr 2022 07:03:52 -0400 Subject: [PATCH] import util-linux-2.37.4-3.el9 --- .gitignore | 2 +- .util-linux.metadata | 2 +- .../0000-login-create-var-log-lastlog.patch | 26 ++++++ ...tch => 0001-login-default-motd-file.patch} | 17 +++- ...0002-tests-make-.-run.sh-more-robust.patch | 30 +++++++ ...sts-make-mount-fstab-all-more-robust.patch | 66 ++++++++++++++ ...-make-eject-umount-tests-more-robust.patch | 42 +++++++++ ...AM-compliance-for-forked-child-in-su.patch | 52 +++++++++++ ...0006-uuidd-fix-open-lock-state-issue.patch | 70 +++++++++++++++ ...or-partitions-not-including-parent-n.patch | 51 +++++++++++ .../0008-logger-fix-size-use-for-stdin.patch | 61 +++++++++++++ ...-reported-boot-status-bits-not-being.patch | 54 +++++++++++ SOURCES/login-lastlog-create.patch | 12 --- SOURCES/util-linux-su.pamd | 1 + SOURCES/uuidd-tmpfiles.conf | 1 + SPECS/util-linux.spec | 89 ++++++++++++------- 16 files changed, 530 insertions(+), 46 deletions(-) create mode 100644 SOURCES/0000-login-create-var-log-lastlog.patch rename SOURCES/{login-default-motd-file.patch => 0001-login-default-motd-file.patch} (50%) create mode 100644 SOURCES/0002-tests-make-.-run.sh-more-robust.patch create mode 100644 SOURCES/0003-tests-make-mount-fstab-all-more-robust.patch create mode 100644 SOURCES/0004-tests-make-eject-umount-tests-more-robust.patch create mode 100644 SOURCES/0005-Complete-Linux-PAM-compliance-for-forked-child-in-su.patch create mode 100644 SOURCES/0006-uuidd-fix-open-lock-state-issue.patch create mode 100644 SOURCES/0007-sysfs-fallback-for-partitions-not-including-parent-n.patch create mode 100644 SOURCES/0008-logger-fix-size-use-for-stdin.patch create mode 100644 SOURCES/0009-wdctl-Workaround-reported-boot-status-bits-not-being.patch delete mode 100644 SOURCES/login-lastlog-create.patch create mode 100644 SOURCES/uuidd-tmpfiles.conf diff --git a/.gitignore b/.gitignore index daa336d..4b43959 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/util-linux-2.37.2.tar.xz +SOURCES/util-linux-2.37.4.tar.xz diff --git a/.util-linux.metadata b/.util-linux.metadata index af2e71f..c0efd0c 100644 --- a/.util-linux.metadata +++ b/.util-linux.metadata @@ -1 +1 @@ -4e85e2f533ef0fe79a4505695453a91f25e87605 SOURCES/util-linux-2.37.2.tar.xz +6e6c49c1dbb288b90b933e4328bde4786172f021 SOURCES/util-linux-2.37.4.tar.xz diff --git a/SOURCES/0000-login-create-var-log-lastlog.patch b/SOURCES/0000-login-create-var-log-lastlog.patch new file mode 100644 index 0000000..c2ea938 --- /dev/null +++ b/SOURCES/0000-login-create-var-log-lastlog.patch @@ -0,0 +1,26 @@ +From ef8c8e117234f135a22ba7180114f0153b2444d8 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 20 Jun 2016 11:09:02 +0200 +Subject: login: create /var/log/lastlog + +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=151635 +--- + login-utils/login.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/login-utils/login.c b/login-utils/login.c +index c6cd340b6..3657f04cd 100644 +--- a/login-utils/login.c ++++ b/login-utils/login.c +@@ -662,7 +662,7 @@ static void log_lastlog(struct login_context *cxt) + sa.sa_handler = SIG_IGN; + sigaction(SIGXFSZ, &sa, &oldsa_xfsz); + +- fd = open(_PATH_LASTLOG, O_RDWR, 0); ++ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0); + if (fd < 0) + goto done; + offset = cxt->pwd->pw_uid * sizeof(ll); +-- +2.34.1 + diff --git a/SOURCES/login-default-motd-file.patch b/SOURCES/0001-login-default-motd-file.patch similarity index 50% rename from SOURCES/login-default-motd-file.patch rename to SOURCES/0001-login-default-motd-file.patch index 3670848..c869c31 100644 --- a/SOURCES/login-default-motd-file.patch +++ b/SOURCES/0001-login-default-motd-file.patch @@ -1,5 +1,17 @@ +From c8574869e60a0351551cb281872e08b4d8fc68d8 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 24 Aug 2021 13:50:57 +0200 +Subject: login: default motd file + +Add `/run/motd.d` to the hardcoded MOTD_FILE + +Addresses: https://github.com/coreos/console-login-helper-messages/issues/60 +--- + include/pathnames.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + diff --git a/include/pathnames.h b/include/pathnames.h -index 3845d4c33..fac3a0783 100644 +index 9be2baa83..7e7d9053f 100644 --- a/include/pathnames.h +++ b/include/pathnames.h @@ -41,7 +41,7 @@ @@ -11,3 +23,6 @@ index 3845d4c33..fac3a0783 100644 #ifndef _PATH_NOLOGIN # define _PATH_NOLOGIN "/etc/nologin" #endif +-- +2.34.1 + diff --git a/SOURCES/0002-tests-make-.-run.sh-more-robust.patch b/SOURCES/0002-tests-make-.-run.sh-more-robust.patch new file mode 100644 index 0000000..61cd973 --- /dev/null +++ b/SOURCES/0002-tests-make-.-run.sh-more-robust.patch @@ -0,0 +1,30 @@ +From 38b2b2e49e72638639c997e532a846ee935ce148 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 23 Aug 2021 15:15:38 +0200 +Subject: tests: make ./run.sh more robust + +Let's make upstream tests more stable to be usable in RHEL +environment where we do not use ASAN and meson. + +Upstream: http://github.com/karelzak/util-linux/commit/331c5e0c54d9cb6f67dc3e825eec2d78c67d8ce6 +Signed-off-by: Karel Zak +--- + tests/run.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/run.sh b/tests/run.sh +index 9d26406c4..d020bfe88 100755 +--- a/tests/run.sh ++++ b/tests/run.sh +@@ -165,7 +165,7 @@ OPTS="$OPTS --srcdir=$top_srcdir --builddir=$top_builddir" + if [ -z "$has_asan_opt" ]; then + if [ -e "$top_builddir/Makefile" ]; then + asan=$(awk '/^ASAN_LDFLAGS/ { print $3 }' $top_builddir/Makefile) +- else ++ elif [ -f "$top_builddir/meson.conf" ]; then + . "$top_builddir/meson.conf" + fi + if [ -n "$asan" ]; then +-- +2.34.1 + diff --git a/SOURCES/0003-tests-make-mount-fstab-all-more-robust.patch b/SOURCES/0003-tests-make-mount-fstab-all-more-robust.patch new file mode 100644 index 0000000..73e5589 --- /dev/null +++ b/SOURCES/0003-tests-make-mount-fstab-all-more-robust.patch @@ -0,0 +1,66 @@ +From a4d1feed2803a5c0596877b64487734bcdb781ef Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 23 Aug 2021 16:28:52 +0200 +Subject: tests: make mount/fstab-all more robust + +Upstream: http://github.com/karelzak/util-linux/commit/85ae61dd6d956e7c9fe2b22b8c46bb1d0bfd13da +Signed-off-by: Karel Zak +--- + tests/ts/mount/fstab-all | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/tests/ts/mount/fstab-all b/tests/ts/mount/fstab-all +index acc64e462..6b7018823 100755 +--- a/tests/ts/mount/fstab-all ++++ b/tests/ts/mount/fstab-all +@@ -79,6 +79,7 @@ echo "${TS_DEVICE}4 ${MOUNTPOINT}D ext4 rw,defaults 0 0" >> $MY_FSTAB + ts_init_subtest "basic" + $TS_CMD_MOUNT --all --fstab $MY_FSTAB >> $TS_OUTPUT 2>> $TS_ERRLOG + [ $? == 0 ] || ts_log "mount failed" ++udevadm settle + $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} + [ $? == 0 ] || ts_log "umount failed" + ts_finalize_subtest +@@ -87,6 +88,7 @@ ts_finalize_subtest + ts_init_subtest "filter-type" + $TS_CMD_MOUNT --all --fstab $MY_FSTAB -t ext4 >> $TS_OUTPUT 2>> $TS_ERRLOG + [ $? == 0 ] || ts_log "mount failed" ++udevadm settle + $TS_CMD_UMOUNT ${MOUNTPOINT}D + [ $? == 0 ] || ts_log "umount failed" + ts_finalize_subtest +@@ -95,6 +97,7 @@ ts_finalize_subtest + ts_init_subtest "filter-notype" + $TS_CMD_MOUNT --all --fstab $MY_FSTAB -t noext4 >> $TS_OUTPUT 2>> $TS_ERRLOG + [ $? == 0 ] || ts_log "mount failed" ++udevadm settle + $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C} + [ $? == 0 ] || ts_log "umount failed" + ts_finalize_subtest +@@ -103,6 +106,7 @@ ts_finalize_subtest + ts_init_subtest "filter-option" + $TS_CMD_MOUNT --all --fstab $MY_FSTAB -O ro >> $TS_OUTPUT 2>> $TS_ERRLOG + [ $? == 0 ] || ts_log "mount failed" ++udevadm settle + $TS_CMD_UMOUNT ${MOUNTPOINT}C + [ $? == 0 ] || ts_log "umount failed" + ts_finalize_subtest +@@ -111,6 +115,7 @@ ts_finalize_subtest + ts_init_subtest "override-option" + $TS_CMD_MOUNT --all --fstab $MY_FSTAB -o ro >> $TS_OUTPUT 2>> $TS_ERRLOG + [ $? == 0 ] || ts_log "mount failed" ++udevadm settle + $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} + [ $? == 0 ] || ts_log "umount failed" + ts_finalize_subtest +@@ -132,6 +137,7 @@ $TS_CMD_MOUNT --all \ + --target-prefix $MY_ROOT \ + -o X-mount.mkdir >> $TS_OUTPUT 2>> $TS_ERRLOG + [ $? == 0 ] || ts_log "mount failed" ++udevadm settle + $TS_CMD_UMOUNT $MY_ROOT/foo/{A,B,C,D} + [ $? == 0 ] || ts_log "umount failed" + ts_finalize_subtest +-- +2.34.1 + diff --git a/SOURCES/0004-tests-make-eject-umount-tests-more-robust.patch b/SOURCES/0004-tests-make-eject-umount-tests-more-robust.patch new file mode 100644 index 0000000..871146a --- /dev/null +++ b/SOURCES/0004-tests-make-eject-umount-tests-more-robust.patch @@ -0,0 +1,42 @@ +From 54c1c6895ec53929d44153073a862521f6ed869d Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 24 Aug 2021 10:49:32 +0200 +Subject: tests: make eject umount tests more robust + +Upstream: http://github.com/karelzak/util-linux/commit/abe16d0d34413555fbd621f90a0b93c2105116a2 +Signed-off-by: Karel Zak +--- + tests/ts/eject/umount | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount +index 2be281ee3..04f53ed99 100755 +--- a/tests/ts/eject/umount ++++ b/tests/ts/eject/umount +@@ -83,6 +83,7 @@ mkfs.ext2 -q -F $TS_DEVICE + udevadm settle + mkdir -p $TS_MOUNTPOINT + $TS_CMD_MOUNT $TS_DEVICE $TS_MOUNTPOINT ++udevadm settle + $TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success" + deinit_device + ts_finalize_subtest +@@ -95,6 +96,7 @@ mkdir -p ${TS_MOUNTPOINT}1 + mkdir -p ${TS_MOUNTPOINT}2 + $TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 + $TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 ++udevadm settle + $TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success" + deinit_device + ts_finalize_subtest +@@ -115,6 +117,7 @@ mkdir -p ${TS_MOUNTPOINT}1 + mkdir -p ${TS_MOUNTPOINT}2 + $TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 + $TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 ++udevadm settle + $TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success" + deinit_device + ts_finalize_subtest +-- +2.34.1 + diff --git a/SOURCES/0005-Complete-Linux-PAM-compliance-for-forked-child-in-su.patch b/SOURCES/0005-Complete-Linux-PAM-compliance-for-forked-child-in-su.patch new file mode 100644 index 0000000..f3949cc --- /dev/null +++ b/SOURCES/0005-Complete-Linux-PAM-compliance-for-forked-child-in-su.patch @@ -0,0 +1,52 @@ +From 41ae35c39241575c63db204c786cb1423c202815 Mon Sep 17 00:00:00 2001 +From: "Andrew G. Morgan" +Date: Sat, 27 Nov 2021 21:00:22 -0800 +Subject: Complete Linux-PAM compliance for forked child in su and login. + +As documented here: + +http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end + +The child that is about to exec*() the user shell is supposed to pam_end() +with PAM_DATA_SILENT. This gives the modules a last chance to do a minor +cleanup of the module state before the user's shell is launched. + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2037212 +Upstream: http://github.com/util-linux/util-linux/commit/4660286e9cdff6d95b49295674b96f83af10ea36 +Signed-off-by: Andrew G. Morgan +--- + login-utils/login.c | 3 +++ + login-utils/su-common.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/login-utils/login.c b/login-utils/login.c +index 3657f04cd..c62e91e94 100644 +--- a/login-utils/login.c ++++ b/login-utils/login.c +@@ -1521,6 +1521,9 @@ int main(int argc, char **argv) + + child_argv[child_argc++] = NULL; + ++ /* http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end */ ++ (void) pam_end(cxt.pamh, PAM_SUCCESS|PAM_DATA_SILENT); ++ + execvp(child_argv[0], child_argv + 1); + + if (!strcmp(child_argv[0], "/bin/sh")) +diff --git a/login-utils/su-common.c b/login-utils/su-common.c +index afd0ea8ad..7d4826bbc 100644 +--- a/login-utils/su-common.c ++++ b/login-utils/su-common.c +@@ -1231,6 +1231,9 @@ int su_main(int argc, char **argv, int mode) + if (su->simulate_login && chdir(su->pwd->pw_dir) != 0) + warn(_("warning: cannot change directory to %s"), su->pwd->pw_dir); + ++ /* http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end */ ++ (void) pam_end(su->pamh, PAM_SUCCESS|PAM_DATA_SILENT); ++ + if (shell) + run_shell(su, shell, command, argv + optind, max(0, argc - optind)); + +-- +2.34.1 + diff --git a/SOURCES/0006-uuidd-fix-open-lock-state-issue.patch b/SOURCES/0006-uuidd-fix-open-lock-state-issue.patch new file mode 100644 index 0000000..e051404 --- /dev/null +++ b/SOURCES/0006-uuidd-fix-open-lock-state-issue.patch @@ -0,0 +1,70 @@ +From a80ba745cc54d5ba726e48065aebe6dac50dedd2 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 24 Jan 2022 14:08:08 +0100 +Subject: uuidd: fix open/lock state issue + +* warn on open/lock state issue + +* enable access to /var/lib/libuuid/, because ProtectSystem=strict make it read-only + + openat(AT_FDCWD, "/var/lib/libuuid/clock.txt", + O_RDWR|O_CREAT|O_CLOEXEC, 0660) = -1 EROFS (Read-only file system) + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2040366 +Upstream: http://github.com/util-linux/util-linux/commit/f27876f9c1056bf41fd940d5c4990b4277e0024f +Upstream: http://github.com/util-linux/util-linux/commit/417982d0236a12756923d88e627f5e4facf8951c +Signed-off-by: Karel Zak +--- + misc-utils/uuidd.c | 9 ++++++--- + misc-utils/uuidd.service.in | 1 + + 2 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c +index fa8db173b..78a37d2e8 100644 +--- a/misc-utils/uuidd.c ++++ b/misc-utils/uuidd.c +@@ -494,7 +494,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path, + break; + case UUIDD_OP_TIME_UUID: + num = 1; +- __uuid_generate_time(uu, &num); ++ if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet) ++ warnx(_("failed to open/lock clock counter")); + if (uuidd_cxt->debug) { + uuid_unparse(uu, str); + fprintf(stderr, _("Generated time UUID: %s\n"), str); +@@ -504,7 +505,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path, + break; + case UUIDD_OP_RANDOM_UUID: + num = 1; +- __uuid_generate_random(uu, &num); ++ if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet) ++ warnx(_("failed to open/lock clock counter")); + if (uuidd_cxt->debug) { + uuid_unparse(uu, str); + fprintf(stderr, _("Generated random UUID: %s\n"), str); +@@ -513,7 +515,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path, + reply_len = sizeof(uu); + break; + case UUIDD_OP_BULK_TIME_UUID: +- __uuid_generate_time(uu, &num); ++ if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet) ++ warnx(_("failed to open/lock clock counter")); + if (uuidd_cxt->debug) { + uuid_unparse(uu, str); + fprintf(stderr, P_("Generated time UUID %s " +diff --git a/misc-utils/uuidd.service.in b/misc-utils/uuidd.service.in +index b4c9c4635..e64ca59b5 100644 +--- a/misc-utils/uuidd.service.in ++++ b/misc-utils/uuidd.service.in +@@ -18,6 +18,7 @@ ProtectKernelModules=yes + ProtectControlGroups=yes + RestrictAddressFamilies=AF_UNIX + MemoryDenyWriteExecute=yes ++ReadWritePaths=/var/lib/libuuid/ + SystemCallFilter=@default @file-system @basic-io @system-service @signal @io-event @network-io + + [Install] +-- +2.34.1 + diff --git a/SOURCES/0007-sysfs-fallback-for-partitions-not-including-parent-n.patch b/SOURCES/0007-sysfs-fallback-for-partitions-not-including-parent-n.patch new file mode 100644 index 0000000..ab84293 --- /dev/null +++ b/SOURCES/0007-sysfs-fallback-for-partitions-not-including-parent-n.patch @@ -0,0 +1,51 @@ +From 9c45c4bf1a1a02ebaf9e24fd7d81d62c676eda7c Mon Sep 17 00:00:00 2001 +From: Portisch +Date: Mon, 8 Nov 2021 12:31:39 +0100 +Subject: sysfs: fallback for partitions not including parent name + +Upstream: http://github.com/util-linux/util-linux/commit/9b59641bcec3df9c451eea4c7057751a153a3fcb +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2021462 +Signed-off-by: Karel Zak +--- + lib/sysfs.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/lib/sysfs.c b/lib/sysfs.c +index bb7183319..191d870f6 100644 +--- a/lib/sysfs.c ++++ b/lib/sysfs.c +@@ -210,9 +210,10 @@ int sysfs_blkdev_is_partition_dirent(DIR *dir, struct dirent *d, const char *par + d->d_type != DT_UNKNOWN) + return 0; + #endif ++ size_t len = 0; ++ + if (parent_name) { + const char *p = parent_name; +- size_t len; + + /* /dev/sda --> "sda" */ + if (*parent_name == '/') { +@@ -223,14 +224,15 @@ int sysfs_blkdev_is_partition_dirent(DIR *dir, struct dirent *d, const char *par + } + + len = strlen(p); +- if (strlen(d->d_name) <= len) +- return 0; ++ if ((strlen(d->d_name) <= len) || (strncmp(p, d->d_name, len) != 0)) ++ len = 0; ++ } + ++ if (len > 0) { + /* partitions subdir name is + * "[:digit:]" or "p[:digit:]" + */ +- return strncmp(p, d->d_name, len) == 0 && +- ((*(d->d_name + len) == 'p' && isdigit(*(d->d_name + len + 1))) ++ return ((*(d->d_name + len) == 'p' && isdigit(*(d->d_name + len + 1))) + || isdigit(*(d->d_name + len))); + } + +-- +2.34.1 + diff --git a/SOURCES/0008-logger-fix-size-use-for-stdin.patch b/SOURCES/0008-logger-fix-size-use-for-stdin.patch new file mode 100644 index 0000000..1b3ac0a --- /dev/null +++ b/SOURCES/0008-logger-fix-size-use-for-stdin.patch @@ -0,0 +1,61 @@ +From 199c328686aac174b0535619e5cea8450016e827 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 21 Oct 2021 18:47:40 +0200 +Subject: logger: fix --size use for stdin +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The stdin version counts log header into the message size, but +for example when it reads message from argv[] it counts only message +itself. + + $ logger --stderr --size 3 "abcd" + <13>Oct 21 18:48:29 kzak: abc + + $ echo "abcd" | logger --stderr --size 3 + logger: cannot allocate 18446744073709551597 bytes: Cannot allocate memory + +Upstream: http://github.com/util-linux/util-linux/commit/58e4ee082bca100034791a4a74481f263bb30a25 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2033622 +Signed-off-by: Karel Zak +--- + misc-utils/logger.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/misc-utils/logger.c b/misc-utils/logger.c +index 5b122de79..43284caeb 100644 +--- a/misc-utils/logger.c ++++ b/misc-utils/logger.c +@@ -976,8 +976,7 @@ static void logger_stdin(struct logger_ctl *ctl) + int has_header = 1; + int default_priority = ctl->pri; + int last_pri = default_priority; +- size_t max_usrmsg_size = ctl->max_message_size - strlen(ctl->hdr); +- char *const buf = xmalloc(max_usrmsg_size + 2 + 2); ++ char *buf = xmalloc(ctl->max_message_size + 2 + 2); + int pri; + int c; + size_t i; +@@ -1004,16 +1003,14 @@ static void logger_stdin(struct logger_ctl *ctl) + ctl->pri = default_priority; + + if (ctl->pri != last_pri) { +- has_header = 0; +- max_usrmsg_size = +- ctl->max_message_size - strlen(ctl->hdr); ++ generate_syslog_header(ctl); + last_pri = ctl->pri; + } + if (c != EOF && c != '\n') + c = getchar(); + } + +- while (c != EOF && c != '\n' && i < max_usrmsg_size) { ++ while (c != EOF && c != '\n' && i < ctl->max_message_size) { + buf[i++] = c; + c = getchar(); + } +-- +2.34.1 + diff --git a/SOURCES/0009-wdctl-Workaround-reported-boot-status-bits-not-being.patch b/SOURCES/0009-wdctl-Workaround-reported-boot-status-bits-not-being.patch new file mode 100644 index 0000000..6f38e93 --- /dev/null +++ b/SOURCES/0009-wdctl-Workaround-reported-boot-status-bits-not-being.patch @@ -0,0 +1,54 @@ +From 006aca565d4c8565baf05296b8e65ca4d5f203d3 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 30 Jul 2021 13:22:54 +0200 +Subject: wdctl: Workaround reported boot-status bits not being present in + wd->ident.options + +Some watchdog drivers are capable of reporting WDIOF_CARDRESET in their +bootstatus, but they do not advertise this in the options field +returned by the WDIOC_GETSUPPORT ioctl. + +This causes wdctl to not print the CARDRESET flag on these devices, +even when the reset was caused by the watchdog and this is being +reported in the WDIOC_GETBOOTSTATUS return. + +Add a workaround by or-ing any bits which are set in the status and +bstatus returns into wd->ident.options so that reported flags will +get printend independent of them being advertised as supported in +wd->ident.options. + +This will make wdctl print a CARDRESET line when the system was +actually reset by the watchdog while omitting it when it was not +reset by the watchdog. At least on drivers which have the +CARDRESET is missing from info.options problem. On other drivers +the CARDRESET line will always be printend, but the actual reported +value will change. + +Upstream: http://github.com/util-linux/util-linux/commit/b1b0259fe42aad1bf0997ce1c03a020ce59e38ab +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2057046 +Signed-off-by: Hans de Goede +--- + sys-utils/wdctl.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c +index 8de5d5a2d..6b9affa0a 100644 +--- a/sys-utils/wdctl.c ++++ b/sys-utils/wdctl.c +@@ -419,6 +419,13 @@ static int read_watchdog_from_device(struct wd_device *wd) + ioctl(fd, WDIOC_GETSTATUS, &wd->status); + ioctl(fd, WDIOC_GETBOOTSTATUS, &wd->bstatus); + ++ /* ++ * Sometimes supported options like WDIOF_CARDRESET are missing from ++ * ident.options, add anything set in status/bstatus to ident.options. ++ */ ++ wd->ident.options |= wd->status; ++ wd->ident.options |= wd->bstatus; ++ + if (ioctl(fd, WDIOC_GETTIMEOUT, &wd->timeout) >= 0) + wd->has_timeout = 1; + if (ioctl(fd, WDIOC_GETPRETIMEOUT, &wd->pretimeout) >= 0) +-- +2.34.1 + diff --git a/SOURCES/login-lastlog-create.patch b/SOURCES/login-lastlog-create.patch deleted file mode 100644 index e2523d3..0000000 --- a/SOURCES/login-lastlog-create.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up util-linux-2.36/login-utils/login.c.kzak util-linux-2.36/login-utils/login.c ---- util-linux-2.36/login-utils/login.c.kzak 2020-07-23 14:13:26.777030764 +0200 -+++ util-linux-2.36/login-utils/login.c 2020-07-23 14:11:22.793686983 +0200 -@@ -585,7 +585,7 @@ static void log_lastlog(struct login_con - sa.sa_handler = SIG_IGN; - sigaction(SIGXFSZ, &sa, &oldsa_xfsz); - -- fd = open(_PATH_LASTLOG, O_RDWR, 0); -+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0); - if (fd < 0) - goto done; - offset = cxt->pwd->pw_uid * sizeof(ll); diff --git a/SOURCES/util-linux-su.pamd b/SOURCES/util-linux-su.pamd index 030657f..5733201 100644 --- a/SOURCES/util-linux-su.pamd +++ b/SOURCES/util-linux-su.pamd @@ -1,4 +1,5 @@ #%PAM-1.0 +auth required pam_env.so auth sufficient pam_rootok.so # Uncomment the following line to implicitly trust users in the "wheel" group. #auth sufficient pam_wheel.so trust use_uid diff --git a/SOURCES/uuidd-tmpfiles.conf b/SOURCES/uuidd-tmpfiles.conf new file mode 100644 index 0000000..4158c7d --- /dev/null +++ b/SOURCES/uuidd-tmpfiles.conf @@ -0,0 +1 @@ +d /run/uuidd 2775 uuidd uuidd diff --git a/SPECS/util-linux.spec b/SPECS/util-linux.spec index 5daf5e4..894db82 100644 --- a/SPECS/util-linux.spec +++ b/SPECS/util-linux.spec @@ -1,8 +1,8 @@ ### Header Summary: A collection of basic system utilities Name: util-linux -Version: 2.37.2 -Release: 1%{?dist} +Version: 2.37.4 +Release: 3%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: http://en.wikipedia.org/wiki/Util-linux @@ -51,6 +51,7 @@ Source0: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v%{upstream_major}/util Source1: util-linux-login.pamd Source2: util-linux-remote.pamd Source3: util-linux-chsh-chfn.pamd +Source4: uuidd-tmpfiles.conf Source5: adjtime Source12: util-linux-su.pamd Source13: util-linux-su-l.pamd @@ -88,13 +89,29 @@ Requires: libsmartcols = %{version}-%{release} Requires: libfdisk = %{version}-%{release} Requires: util-linux-core = %{version}-%{release} -### Ready for upstream? -### + +### RHEL-9.0.0 +# # 151635 - makeing /var/log/lastlog -Patch0: login-lastlog-create.patch +Patch0: 0000-login-create-var-log-lastlog.patch # Add `/run/motd.d` to the hardcoded MOTD_FILE # https://github.com/coreos/console-login-helper-messages/issues/60 -Patch1: login-default-motd-file.patch +Patch1: 0001-login-default-motd-file.patch +# Integrate upstream tests +Patch2: 0002-tests-make-.-run.sh-more-robust.patch +Patch3: 0003-tests-make-mount-fstab-all-more-robust.patch +Patch4: 0004-tests-make-eject-umount-tests-more-robust.patch +# 2037212 - Complete Linux-PAM compliance for forked child in su and login +Patch5: 0005-Complete-Linux-PAM-compliance-for-forked-child-in-su.patch +# 2040366 - uuidd can't access lock/status file +Patch6: 0006-uuidd-fix-open-lock-state-issue.patch +# 2021462 - partitons detection broken on systems not including the parent name in partition name +Patch7: 0007-sysfs-fallback-for-partitions-not-including-parent-n.patch +# 2033622 - logger from util-linux incorrectly handles long messages +Patch8: 0008-logger-fix-size-use-for-stdin.patch +# 2057046 - wdctl not picking up reboot reason flag +Patch9: 0009-wdctl-Workaround-reported-boot-status-bits-not-being.patch + %description The util-linux package contains a large variety of low-level system @@ -132,6 +149,8 @@ minimal installations. %package -n libfdisk Summary: Partitioning library for fdisk-like programs. License: LGPLv2+ +Requires: libblkid = %{version}-%{release} +Requires: libuuid = %{version}-%{release} %description -n libfdisk This is library for fdisk-like programs, part of util-linux. @@ -266,6 +285,7 @@ SMP systems. %package -n %{pypkg}-libmount Summary: Python bindings for the libmount library Requires: libmount = %{version}-%{release} +Requires: libblkid = %{version}-%{release} License: LGPLv2+ %description -n %{pypkg}-libmount @@ -335,14 +355,13 @@ mkdir -p ${RPM_BUILD_ROOT}%{_bindir} mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,6,8,5} mkdir -p ${RPM_BUILD_ROOT}%{_sbindir} mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/{pam.d,security/console.apps} -mkdir -p ${RPM_BUILD_ROOT}/var/log -touch ${RPM_BUILD_ROOT}/var/log/lastlog -chmod 0644 ${RPM_BUILD_ROOT}/var/log/lastlog +mkdir -p ${RPM_BUILD_ROOT}/usr/lib/tmpfiles.d # install util-linux %make_install # And a dirs uuidd needs that the makefiles don't create +install -m 644 %{SOURCE4} ${RPM_BUILD_ROOT}/usr/lib/tmpfiles.d/uuidd.conf install -d ${RPM_BUILD_ROOT}/run/uuidd install -d ${RPM_BUILD_ROOT}/var/lib/libuuid @@ -425,24 +444,6 @@ find $RPM_BUILD_ROOT%{_mandir}/man8 -regextype posix-egrep \ -printf "%{_mandir}/man8/%f*\n" >> %{name}.files -%post -# only for minimal buildroots without /var/log -[ -d /var/log ] || mkdir -p /var/log -touch /var/log/lastlog -chown root:root /var/log/lastlog -chmod 0644 /var/log/lastlog -# Fix the file context, do not use restorecon -if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then - SECXT=$( /usr/sbin/matchpathcon -n /var/log/lastlog 2> /dev/null ) - if [ -n "$SECXT" ]; then - # Selinux enabled, but without policy? It's true for buildroots - # without selinux stuff on host machine with enabled selinux. - # We don't want to use any RPM dependence on selinux policy for - # matchpathcon(2). SELinux policy should be optional. - /usr/bin/chcon "$SECXT" /var/log/lastlog >/dev/null 2>&1 || : - fi -fi - %post -n util-linux-core if [ ! -L /etc/mtab ]; then ln -sf ../proc/self/mounts /etc/mtab || : @@ -509,8 +510,6 @@ fi %attr(755,root,root) %{_bindir}/login %attr(2755,root,tty) %{_bindir}/write -%ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog - %{_unitdir}/fstrim.* %{_bindir}/cal @@ -869,6 +868,7 @@ fi %dir %attr(2775, uuidd, uuidd) /var/lib/libuuid %dir %attr(2775, uuidd, uuidd) /run/uuidd %{compldir}/uuidd +%{_tmpfilesdir}/uuidd.conf %files -n libfdisk @@ -944,8 +944,35 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog +* Thu Feb 24 2022 Karel Zak 2.37.4-3 +- fix #2057046 - wdctl not picking up reboot reason flag + +* Thu Feb 17 2022 Karel Zak 2.37.4-2 +- improve bugfix for #2047952, fix warnings from rpminspect + +* Wed Feb 16 2022 Karel Zak 2.37.4-1 +- upgrade to v2.37.4 (fix CVE-2022-0563) + +* Mon Feb 07 2022 Karel Zak 2.37.3-2 +- fix #2021462 - partitons detection broken on systems not including the parent name in partition name +- fix #2033622 - logger from util-linux incorrectly handles long messages +- fix #2000137 - pam_env bypassed for root user when using su +- fix #2000477 - rpm -V setup fail on /var/log/lastlog +- fix #2047952 - rpm -V / --verify reports bad user/group/mtime for /run/uuidd + +* Tue Jan 25 2022 Karel Zak 2.37.3-1 +- upgrade to v2.37.3 (fix CVE-2021-3996, CVE-2021-3995) +- fix #2040366 - uuidd can't access lock/status file + +* Thu Jan 06 2022 Karel Zak 2.37.2-3 +- fix #2037212 - Complete Linux-PAM compliance for forked child in su and login + +* Mon Aug 23 2021 Karel Zak - 2.37.2-2 +- cleanup previous rebase (fix #1969348) +- integrate upstream tests to CI + * Fri Aug 20 2021 Karel Zak - 2.37.2-1 -- upgrade to v2.37.1 (fix #1969348) +- upgrade to v2.37.2 (fix #1969348) * Tue Aug 10 2021 Mohan Boddu - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags @@ -980,7 +1007,7 @@ fi * Mon Nov 16 2020 Karel Zak - 2.36.1-1 - upgrade to stable upstream 2.36.1 -* Tue Jul 14 2020 Tom Stellard - 2.36-4 +* Thu Nov 12 2020 Tom Stellard - 2.36-4 - Use make macros - https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro