From 71c28db45d4ec2602289c721ad3b6e9694158d8e Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 27 Sep 2022 16:40:15 -0400 Subject: [PATCH] import util-linux-2.32.1-38.el8 --- ...y-LOOP_SET_STATUS64-and-LOOP_SET_BLO.patch | 109 +++++++++++++ ...0076-libblkid-fix-Atari-prober-logic.patch | 47 ++++++ ...0077-libblkid-make-Atari-more-robust.patch | 129 +++++++++++++++ ...bblkid-allow-a-lot-of-mac-partitions.patch | 53 +++++++ ...id-limit-amount-of-parsed-partitions.patch | 85 ++++++++++ ...e-sure-block-size-is-large-enough-fu.patch | 29 ++++ ...t-read-from-HW-when-use-sys-snapshot.patch | 40 +++++ ...gins-improve-prefixes-interpretation.patch | 84 ++++++++++ .../0083-tests-update-atari-blkid-tests.patch | 149 ++++++++++++++++++ .../0084-tests-update-atari-partx-tests.patch | 55 +++++++ SOURCES/uuidd-tmpfiles.conf | 1 + SPECS/util-linux.spec | 60 ++++--- 12 files changed, 820 insertions(+), 21 deletions(-) create mode 100644 SOURCES/0075-lib-loopdev-retry-LOOP_SET_STATUS64-and-LOOP_SET_BLO.patch create mode 100644 SOURCES/0076-libblkid-fix-Atari-prober-logic.patch create mode 100644 SOURCES/0077-libblkid-make-Atari-more-robust.patch create mode 100644 SOURCES/0078-libblkid-allow-a-lot-of-mac-partitions.patch create mode 100644 SOURCES/0079-libblkid-limit-amount-of-parsed-partitions.patch create mode 100644 SOURCES/0080-libblkid-mac-make-sure-block-size-is-large-enough-fu.patch create mode 100644 SOURCES/0081-lscpu-don-t-read-from-HW-when-use-sys-snapshot.patch create mode 100644 SOURCES/0082-lslogins-improve-prefixes-interpretation.patch create mode 100644 SOURCES/0083-tests-update-atari-blkid-tests.patch create mode 100644 SOURCES/0084-tests-update-atari-partx-tests.patch create mode 100644 SOURCES/uuidd-tmpfiles.conf diff --git a/SOURCES/0075-lib-loopdev-retry-LOOP_SET_STATUS64-and-LOOP_SET_BLO.patch b/SOURCES/0075-lib-loopdev-retry-LOOP_SET_STATUS64-and-LOOP_SET_BLO.patch new file mode 100644 index 0000000..a6e1ea1 --- /dev/null +++ b/SOURCES/0075-lib-loopdev-retry-LOOP_SET_STATUS64-and-LOOP_SET_BLO.patch @@ -0,0 +1,109 @@ +From 97a5abd36eeab4e07a31b27f6a2c2078d42e2e33 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 8 Mar 2022 11:40:58 +0100 +Subject: lib/loopdev: retry LOOP_SET_STATUS64 and LOOP_SET_BLOCK_SIZE on + EAGAIN + +Upstream: http://github.com/util-linux/util-linux/commit/0ae7bb11c29aa11c8ef25b1ef2f82ee4701b856d +Upstream: http://github.com/util-linux/util-linux/commit/eab90ef8d4f66394285e0cff1dfc0a27242c05aa +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=2058176 +Signed-off-by: Karel Zak +--- + lib/loopdev.c | 42 +++++++++++++++++++++++++++++++++++++----- + 1 file changed, 37 insertions(+), 5 deletions(-) + +diff --git a/lib/loopdev.c b/lib/loopdev.c +index 54d337ea3..48af82aef 100644 +--- a/lib/loopdev.c ++++ b/lib/loopdev.c +@@ -42,6 +42,8 @@ + #include "blkdev.h" + #include "debug.h" + ++#define LOOPDEV_MAX_TRIES 10 ++ + /* + * Debug stuff (based on include/debug.h) + */ +@@ -1260,6 +1262,7 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) + { + int file_fd, dev_fd, mode = O_RDWR, rc = -1, cnt = 0; + int errsv = 0; ++ int err, again; + + if (!lc || !*lc->device || !lc->filename) + return -EINVAL; +@@ -1331,7 +1334,17 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) + + DBG(SETUP, ul_debugobj(lc, "LOOP_SET_FD: OK")); + +- if (ioctl(dev_fd, LOOP_SET_STATUS64, &lc->info)) { ++ cnt = 0; ++ do { ++ err = ioctl(dev_fd, LOOP_SET_STATUS64, &lc->info); ++ again = err && errno == EAGAIN; ++ if (again) { ++ xusleep(250000); ++ cnt++; ++ } ++ } while (again && cnt <= LOOPDEV_MAX_TRIES); ++ ++ if (err) { + rc = -errno; + errsv = errno; + DBG(SETUP, ul_debugobj(lc, "LOOP_SET_STATUS64 failed: %m")); +@@ -1376,7 +1389,7 @@ err: + */ + int loopcxt_set_status(struct loopdev_cxt *lc) + { +- int dev_fd, rc = -1; ++ int dev_fd, rc = -1, err, again, tries = 0; + + errno = 0; + dev_fd = loopcxt_get_fd(lc); +@@ -1387,7 +1400,16 @@ int loopcxt_set_status(struct loopdev_cxt *lc) + } + DBG(SETUP, ul_debugobj(lc, "device open: OK")); + +- if (ioctl(dev_fd, LOOP_SET_STATUS64, &lc->info)) { ++ do { ++ err = ioctl(dev_fd, LOOP_SET_STATUS64, &lc->info); ++ again = err && errno == EAGAIN; ++ if (again) { ++ xusleep(250000); ++ tries++; ++ } ++ } while (again && tries <= LOOPDEV_MAX_TRIES); ++ ++ if (err) { + rc = -errno; + DBG(SETUP, ul_debugobj(lc, "LOOP_SET_STATUS64 failed: %m")); + return rc; +@@ -1440,12 +1462,22 @@ int loopcxt_set_dio(struct loopdev_cxt *lc, unsigned long use_dio) + int loopcxt_set_blocksize(struct loopdev_cxt *lc, uint64_t blocksize) + { + int fd = loopcxt_get_fd(lc); ++ int err, again, tries = 0; + + if (fd < 0) + return -EINVAL; + +- /* Kernels prior to v4.14 don't support this ioctl */ +- if (ioctl(fd, LOOP_SET_BLOCK_SIZE, (unsigned long) blocksize) < 0) { ++ do { ++ /* Kernels prior to v4.14 don't support this ioctl */ ++ err = ioctl(fd, LOOP_SET_BLOCK_SIZE, (unsigned long) blocksize); ++ again = err && errno == EAGAIN; ++ if (again) { ++ xusleep(250000); ++ tries++; ++ } ++ } while (again && tries <= LOOPDEV_MAX_TRIES); ++ ++ if (err) { + int rc = -errno; + DBG(CXT, ul_debugobj(lc, "LOOP_SET_BLOCK_SIZE failed: %m")); + return rc; +-- +2.34.1 + diff --git a/SOURCES/0076-libblkid-fix-Atari-prober-logic.patch b/SOURCES/0076-libblkid-fix-Atari-prober-logic.patch new file mode 100644 index 0000000..98a492c --- /dev/null +++ b/SOURCES/0076-libblkid-fix-Atari-prober-logic.patch @@ -0,0 +1,47 @@ +From 214eaa70d8431161de03ea7903f814c102e87919 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 9 Oct 2020 13:06:08 +0200 +Subject: libblkid: fix Atari prober logic + +Addresses: https://github.com/karelzak/util-linux/issues/1159 +Addresses: https://github.com/karelzak/util-linux/issues/1116 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030 +Upstream: http://github.com/util-linux/util-linux/commit/282ceadc3a72fc07dd0388b8880fd751490bb87f +Signed-off-by: Karel Zak +--- + libblkid/src/partitions/atari.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/libblkid/src/partitions/atari.c b/libblkid/src/partitions/atari.c +index 1224a577c..b469ef5a1 100644 +--- a/libblkid/src/partitions/atari.c ++++ b/libblkid/src/partitions/atari.c +@@ -199,11 +199,10 @@ static int probe_atari_pt(blkid_probe pr, + + hdsize = blkid_probe_get_size(pr) / 512; + +- /* Look for validly looking primary partition */ +- for (i = 0; ; i++) { +- if (i >= ARRAY_SIZE(rs->part)) +- goto nothing; +- ++ /* ++ * At least one valid partition required ++ */ ++ for (i = 0; i < 4; i++) { + if (IS_PARTDEF_VALID(rs->part[i], hdsize)) { + blkid_probe_set_magic(pr, + offsetof(struct atari_rootsector, part[i]), +@@ -213,6 +212,9 @@ static int probe_atari_pt(blkid_probe pr, + } + } + ++ if (i == 4) ++ goto nothing; ++ + if (blkid_partitions_need_typeonly(pr)) + /* caller does not ask for details about partitions */ + return BLKID_PROBE_OK; +-- +2.36.1 + diff --git a/SOURCES/0077-libblkid-make-Atari-more-robust.patch b/SOURCES/0077-libblkid-make-Atari-more-robust.patch new file mode 100644 index 0000000..9f19c48 --- /dev/null +++ b/SOURCES/0077-libblkid-make-Atari-more-robust.patch @@ -0,0 +1,129 @@ +From e7f0f5d3a80324e1430e979b0a170ded77b380e2 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 13 Oct 2020 16:19:20 +0200 +Subject: libblkid: make Atari more robust + +* ignore large disks +* check in-table stored device size +* check bad sectors list +* check partition dimensions against in-table device size + +Addresses: https://github.com/karelzak/util-linux/issues/1159 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030 +Upstream: http://github.com/util-linux/util-linux/commit/282ceadc3a72fc07dd0388b8880fd751490bb87f +Signed-off-by: Karel Zak +--- + libblkid/src/partitions/atari.c | 66 ++++++++++++++++++++++++--------- + 1 file changed, 48 insertions(+), 18 deletions(-) + +diff --git a/libblkid/src/partitions/atari.c b/libblkid/src/partitions/atari.c +index b469ef5a1..c3f77117a 100644 +--- a/libblkid/src/partitions/atari.c ++++ b/libblkid/src/partitions/atari.c +@@ -74,16 +74,27 @@ static int linux_isalnum(unsigned char c) { + + #define IS_ACTIVE(partdef) ((partdef).flags & 1) + +-#define IS_PARTDEF_VALID(partdef, hdsize) \ +- ( \ +- (partdef).flags & 1 && \ +- isalnum((partdef).id[0]) && \ +- isalnum((partdef).id[1]) && \ +- isalnum((partdef).id[2]) && \ +- be32_to_cpu((partdef).start) <= (hdsize) && \ +- be32_to_cpu((partdef).start) + \ +- be32_to_cpu((partdef).size) <= (hdsize) \ +- ) ++static int is_valid_dimension(uint32_t start, uint32_t size, uint32_t maxoff) ++{ ++ uint64_t end = start + size; ++ ++ return end >= start ++ && 0 < start && start <= maxoff ++ && 0 < size && size <= maxoff ++ && 0 < end && end <= maxoff; ++} ++ ++static int is_valid_partition(struct atari_part_def *part, uint32_t maxoff) ++{ ++ uint32_t start = be32_to_cpu(part->start), ++ size = be32_to_cpu(part->size); ++ ++ return (part->flags & 1) ++ && isalnum(part->id[0]) ++ && isalnum(part->id[1]) ++ && isalnum(part->id[2]) ++ && is_valid_dimension(start, size, maxoff); ++} + + static int is_id_common(char *id) + { +@@ -184,12 +195,20 @@ static int probe_atari_pt(blkid_probe pr, + unsigned i; + int has_xgm = 0; + int rc = 0; +- off_t hdsize; ++ uint32_t rssize; /* size in sectors from root sector */ ++ uint64_t size; /* size in sectors from system */ + + /* Atari partition is not defined for other sector sizes */ + if (blkid_probe_get_sectorsize(pr) != 512) + goto nothing; + ++ size = blkid_probe_get_size(pr) / 512; ++ ++ /* Atari is not well defined to support large disks */ ++ if (size > INT32_MAX) ++ goto nothing; ++ ++ /* read root sector */ + rs = (struct atari_rootsector *) blkid_probe_get_sector(pr, 0); + if (!rs) { + if (errno) +@@ -197,17 +216,29 @@ static int probe_atari_pt(blkid_probe pr, + goto nothing; + } + +- hdsize = blkid_probe_get_size(pr) / 512; ++ rssize = be32_to_cpu(rs->hd_size); ++ ++ /* check number of sectors stored in the root sector */ ++ if (rssize < 2 || rssize > size) ++ goto nothing; ++ ++ /* check list of bad blocks */ ++ if ((rs->bsl_start || rs->bsl_len) ++ && !is_valid_dimension(be32_to_cpu(rs->bsl_start), ++ be32_to_cpu(rs->bsl_len), ++ rssize)) ++ goto nothing; + + /* + * At least one valid partition required + */ + for (i = 0; i < 4; i++) { +- if (IS_PARTDEF_VALID(rs->part[i], hdsize)) { +- blkid_probe_set_magic(pr, +- offsetof(struct atari_rootsector, part[i]), +- sizeof(rs->part[i].flags) + sizeof(rs->part[i].id), +- (unsigned char *) &rs->part[i]); ++ if (is_valid_partition(&rs->part[i], rssize)) { ++ if (blkid_probe_set_magic(pr, ++ offsetof(struct atari_rootsector, part[i]), ++ sizeof(rs->part[i].flags) + sizeof(rs->part[i].id), ++ (unsigned char *) &rs->part[i])) ++ goto err; + break; + } + } +@@ -234,7 +265,6 @@ static int probe_atari_pt(blkid_probe pr, + blkid_partlist_increment_partno(ls); + continue; + } +- + if (!memcmp(p->id, "XGM", 3)) { + has_xgm = 1; + rc = parse_extended(pr, ls, tab, p); +-- +2.36.1 + diff --git a/SOURCES/0078-libblkid-allow-a-lot-of-mac-partitions.patch b/SOURCES/0078-libblkid-allow-a-lot-of-mac-partitions.patch new file mode 100644 index 0000000..9cf4dc9 --- /dev/null +++ b/SOURCES/0078-libblkid-allow-a-lot-of-mac-partitions.patch @@ -0,0 +1,53 @@ +From 2348779e225dd581c32c00108e017f5c1924e706 Mon Sep 17 00:00:00 2001 +From: Samanta Navarro +Date: Sun, 8 Nov 2020 11:45:18 +0000 +Subject: libblkid: allow a lot of mac partitions + +If the map count is set to INT_MAX then the for loop does not stop +because its check is never false. + +I have not found a correct upper limit. The other partition logics have +a maximum amount (exception is atari.c). + +The loop itself wouldn't be endless. If the iteration reaches block 0 +then the signature will be wrong. This means that map count = INT_MAX +case would fail even if such a setup would be correct on disk. + +Upstream: http://github.com/util-linux/util-linux/commit/8f22adaaf30e9fd3bf83da0213b4a6525c9305cd +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030 +Signed-off-by: Samanta Navarro +--- + libblkid/src/partitions/mac.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libblkid/src/partitions/mac.c b/libblkid/src/partitions/mac.c +index 4713d6042..2be91a620 100644 +--- a/libblkid/src/partitions/mac.c ++++ b/libblkid/src/partitions/mac.c +@@ -123,12 +123,12 @@ static int probe_mac_pt(blkid_probe pr, + ssf = block_size / 512; + nblks = be32_to_cpu(p->map_count); + +- for (i = 1; i <= nblks; ++i) { ++ for (i = 0; i < nblks; ++i) { + blkid_partition par; + uint32_t start; + uint32_t size; + +- p = (struct mac_partition *) get_mac_block(pr, block_size, i); ++ p = (struct mac_partition *) get_mac_block(pr, block_size, i + 1); + if (!p) { + if (errno) + return -errno; +@@ -141,7 +141,7 @@ static int probe_mac_pt(blkid_probe pr, + DBG(LOWPROBE, ul_debug( + "mac: inconsistent map_count in partition map, " + "entry[0]: %d, entry[%d]: %d", +- nblks, i - 1, ++ nblks, i, + be32_to_cpu(p->map_count))); + } + +-- +2.36.1 + diff --git a/SOURCES/0079-libblkid-limit-amount-of-parsed-partitions.patch b/SOURCES/0079-libblkid-limit-amount-of-parsed-partitions.patch new file mode 100644 index 0000000..e202558 --- /dev/null +++ b/SOURCES/0079-libblkid-limit-amount-of-parsed-partitions.patch @@ -0,0 +1,85 @@ +From 24f5385f4a54b90f4b7674e23f30567591962bcb Mon Sep 17 00:00:00 2001 +From: Samanta Navarro +Date: Tue, 10 Nov 2020 11:48:04 +0100 +Subject: libblkid: limit amount of parsed partitions + +The linux kernel does not support more than 256 partitions +(DISK_MAX_PARTS). The atari and mac block devices have no such limits. + +Use dos logical partition limit for atari as well (100). +Use the kernel limit for mac (256). + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030 +Upstream: http://github.com/util-linux/util-linux/commit/c70b4f2a5b99876d230b8f4f413c3bb3ee6647f1 +Signed-off-by: Karel Zak +Signed-off-by: Samanta Navarro +--- + libblkid/src/partitions/atari.c | 6 +++++- + libblkid/src/partitions/mac.c | 15 +++++++++++---- + 2 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/libblkid/src/partitions/atari.c b/libblkid/src/partitions/atari.c +index c3f77117a..fdd5498b5 100644 +--- a/libblkid/src/partitions/atari.c ++++ b/libblkid/src/partitions/atari.c +@@ -141,12 +141,16 @@ static int parse_extended(blkid_probe pr, blkid_partlist ls, + blkid_parttable tab, struct atari_part_def *part) + { + uint32_t x0start, xstart; +- unsigned i = 0; ++ unsigned ct = 0, i = 0; + int rc; + + x0start = xstart = be32_to_cpu(part->start); + while (1) { + struct atari_rootsector *xrs; ++ ++ if (++ct > 100) ++ break; ++ + xrs = (struct atari_rootsector *) blkid_probe_get_sector(pr, xstart); + if (!xrs) { + if (errno) +diff --git a/libblkid/src/partitions/mac.c b/libblkid/src/partitions/mac.c +index 2be91a620..092d31d32 100644 +--- a/libblkid/src/partitions/mac.c ++++ b/libblkid/src/partitions/mac.c +@@ -79,7 +79,7 @@ static int probe_mac_pt(blkid_probe pr, + blkid_partlist ls; + uint16_t block_size; + uint16_t ssf; /* sector size fragment */ +- uint32_t nblks, i; ++ uint32_t nblks, nprts, i; + + + /* The driver descriptor record is always located at physical block 0, +@@ -122,8 +122,15 @@ static int probe_mac_pt(blkid_probe pr, + + ssf = block_size / 512; + nblks = be32_to_cpu(p->map_count); +- +- for (i = 0; i < nblks; ++i) { ++ if (nblks > 256) { ++ nprts = 256; ++ DBG(LOWPROBE, ul_debug( ++ "mac: map_count too large, entry[0]: %u, " ++ "enforcing limit of %u", nblks, nprts)); ++ } else ++ nprts = nblks; ++ ++ for (i = 0; i < nprts; ++i) { + blkid_partition par; + uint32_t start; + uint32_t size; +@@ -140,7 +147,7 @@ static int probe_mac_pt(blkid_probe pr, + if (be32_to_cpu(p->map_count) != nblks) { + DBG(LOWPROBE, ul_debug( + "mac: inconsistent map_count in partition map, " +- "entry[0]: %d, entry[%d]: %d", ++ "entry[0]: %u, entry[%u]: %u", + nblks, i, + be32_to_cpu(p->map_count))); + } +-- +2.36.1 + diff --git a/SOURCES/0080-libblkid-mac-make-sure-block-size-is-large-enough-fu.patch b/SOURCES/0080-libblkid-mac-make-sure-block-size-is-large-enough-fu.patch new file mode 100644 index 0000000..2eafd83 --- /dev/null +++ b/SOURCES/0080-libblkid-mac-make-sure-block-size-is-large-enough-fu.patch @@ -0,0 +1,29 @@ +From 7180c1ad36a1f419e20e90ddfad0b2f77d8c018f Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 2 Jun 2022 16:02:54 +0200 +Subject: libblkid: (mac) make sure block size is large enough [fuzzing] + +Upstream: http://github.com/util-linux/util-linux/commit/4e12fbca62be10b09503cecc7507757874043474 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030 +Reported-by: Thibault Guittet +Signed-off-by: Karel Zak +--- + libblkid/src/partitions/mac.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libblkid/src/partitions/mac.c b/libblkid/src/partitions/mac.c +index 092d31d32..75a558b0a 100644 +--- a/libblkid/src/partitions/mac.c ++++ b/libblkid/src/partitions/mac.c +@@ -93,6 +93,8 @@ static int probe_mac_pt(blkid_probe pr, + } + + block_size = be16_to_cpu(md->block_size); ++ if (block_size < sizeof(struct mac_partition)) ++ goto nothing; + + /* The partition map always begins at physical block 1, + * the second block on the disk. +-- +2.36.1 + diff --git a/SOURCES/0081-lscpu-don-t-read-from-HW-when-use-sys-snapshot.patch b/SOURCES/0081-lscpu-don-t-read-from-HW-when-use-sys-snapshot.patch new file mode 100644 index 0000000..0f12cee --- /dev/null +++ b/SOURCES/0081-lscpu-don-t-read-from-HW-when-use-sys-snapshot.patch @@ -0,0 +1,40 @@ +From c223ad8f05d2d20a80e21dbb4b6240f11909f92c Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 14 Jul 2022 13:10:16 +0200 +Subject: lscpu: don;t read from HW when use /sys snapshot + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2069187 +Signed-off-by: Karel Zak +--- + sys-utils/lscpu.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index 70a797dd6..01f8fba35 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -1850,7 +1850,10 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod) + } + } else { + if (desc->is_cluster) { +- int sockets = get_number_of_physical_sockets_from_dmi(); ++ int sockets = 0; ++ ++ if (mod->system == SYSTEM_LIVE) ++ sockets = get_number_of_physical_sockets_from_dmi(); + + if (sockets > 0) + add_summary_n(tb, _("Socket(s):"), sockets); +@@ -2109,7 +2112,8 @@ int main(int argc, char *argv[]) + qsort(desc->ecaches, desc->necaches, + sizeof(struct cpu_cache), cachecmp); + +- desc->is_cluster = is_fallback_to_cluster(desc); ++ if (mod->system == SYSTEM_LIVE) ++ desc->is_cluster = is_fallback_to_cluster(desc); + + read_nodes(desc); + read_hypervisor(desc, mod); +-- +2.36.1 + diff --git a/SOURCES/0082-lslogins-improve-prefixes-interpretation.patch b/SOURCES/0082-lslogins-improve-prefixes-interpretation.patch new file mode 100644 index 0000000..e41d75c --- /dev/null +++ b/SOURCES/0082-lslogins-improve-prefixes-interpretation.patch @@ -0,0 +1,84 @@ +From 818cd2018ca66e804ea30066c44572ca128a24a7 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 7 Jun 2022 09:11:56 +0200 +Subject: lslogins: improve prefixes interpretation + +It seems that for example 'passwd --lock' uses two exclamation marks +in password field. It seems better to assume arbitrary number of '!' +and '*' prefixes. + +The patch also makes description of the PWD-EMPTY output field more +explicit. + +Upstream: http://github.com/util-linux/util-linux/commit/c51cba1e838ae7e36a843ec785543492bb8737cd +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2093166 +Signed-off-by: Karel Zak +--- + login-utils/lslogins.c | 31 +++++++++++++++++++++++++------ + 1 file changed, 25 insertions(+), 6 deletions(-) + +diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c +index 6f804aa35..b81afc6c7 100644 +--- a/login-utils/lslogins.c ++++ b/login-utils/lslogins.c +@@ -216,7 +216,7 @@ static const struct lslogins_coldesc coldescs[] = + { + [COL_USER] = { "USER", N_("user name"), N_("Username"), 0.1, SCOLS_FL_NOEXTREMES }, + [COL_UID] = { "UID", N_("user ID"), "UID", 1, SCOLS_FL_RIGHT}, +- [COL_PWDEMPTY] = { "PWD-EMPTY", N_("password not required"), N_("Password not required"), 1, SCOLS_FL_RIGHT }, ++ [COL_PWDEMPTY] = { "PWD-EMPTY", N_("password not defined"), N_("Password not required (empty)"), 1, SCOLS_FL_RIGHT }, + [COL_PWDDENY] = { "PWD-DENY", N_("login by password disabled"), N_("Login by password disabled"), 1, SCOLS_FL_RIGHT }, + [COL_PWDLOCK] = { "PWD-LOCK", N_("password defined, but locked"), N_("Password is locked"), 1, SCOLS_FL_RIGHT }, + [COL_NOLOGIN] = { "NOLOGIN", N_("log in disabled by nologin(8) or pam_nologin(8)"), N_("No login"), 1, SCOLS_FL_RIGHT }, +@@ -755,16 +755,24 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c + break; + case COL_PWDEMPTY: + if (shadow) { +- if (!*shadow->sp_pwdp) /* '\0' */ ++ const char *p = shadow->sp_pwdp; ++ ++ while (p && (*p == '!' || *p == '*')) ++ p++; ++ ++ if (!p || !*p) + user->pwd_empty = STATUS_TRUE; + } else + user->pwd_empty = STATUS_UNKNOWN; + break; + case COL_PWDDENY: + if (shadow) { +- if ((*shadow->sp_pwdp == '!' || +- *shadow->sp_pwdp == '*') && +- !valid_pwd(shadow->sp_pwdp + 1)) ++ const char *p = shadow->sp_pwdp; ++ ++ while (p && (*p == '!' || *p == '*')) ++ p++; ++ ++ if (p && *p && p != shadow->sp_pwdp && !valid_pwd(p)) + user->pwd_deny = STATUS_TRUE; + } else + user->pwd_deny = STATUS_UNKNOWN; +@@ -772,7 +780,18 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c + + case COL_PWDLOCK: + if (shadow) { +- if (*shadow->sp_pwdp == '!' && valid_pwd(shadow->sp_pwdp + 1)) ++ const char *p = shadow->sp_pwdp; ++ int i = 0; ++ ++ /* 'passwd --lock' uses two exclamation marks, ++ * shadow(5) describes the lock as "field which ++ * starts with an exclamation mark". Let's ++ * support more '!' ... ++ */ ++ while (p && *p == '!') ++ p++, i++; ++ ++ if (i != 0 && (!*p || valid_pwd(p))) + user->pwd_lock = STATUS_TRUE; + } else + user->pwd_lock = STATUS_UNKNOWN; +-- +2.36.1 + diff --git a/SOURCES/0083-tests-update-atari-blkid-tests.patch b/SOURCES/0083-tests-update-atari-blkid-tests.patch new file mode 100644 index 0000000..6bd93f0 --- /dev/null +++ b/SOURCES/0083-tests-update-atari-blkid-tests.patch @@ -0,0 +1,149 @@ +From 78be9c320883e77c2b5fdc676277a51efc98c723 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 13 Oct 2020 16:29:19 +0200 +Subject: tests: update atari blkid tests + +The old images of the atari label are truncated and in-table stored +sizes do not match with real images sizes -- libblkid checks it now. + +I have no idea how to generate ICD format, let's ignore it in tests +for now. + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030 +Upstream: http://github.com/util-linux/util-linux/commit/0d061b6e68bc74ce7d61524097b5d0f3becee437 +Signed-off-by: Karel Zak +--- + tests/expected/blkid/lowprobe-pt-atari-icd | 8 -------- + tests/expected/blkid/lowprobe-pt-atari-primary | 3 +++ + tests/expected/blkid/lowprobe-pt-atari-xgm | 10 +++------- + tests/ts/blkid/images-pt/atari-icd.img.xz | Bin 1920 -> 0 bytes + tests/ts/blkid/images-pt/atari-primary.img.xz | Bin 0 -> 932 bytes + tests/ts/blkid/images-pt/atari-xgm.img.xz | Bin 1920 -> 956 bytes + 6 files changed, 6 insertions(+), 15 deletions(-) + delete mode 100644 tests/expected/blkid/lowprobe-pt-atari-icd + create mode 100644 tests/expected/blkid/lowprobe-pt-atari-primary + delete mode 100644 tests/ts/blkid/images-pt/atari-icd.img.xz + create mode 100644 tests/ts/blkid/images-pt/atari-primary.img.xz + +diff --git a/tests/expected/blkid/lowprobe-pt-atari-icd b/tests/expected/blkid/lowprobe-pt-atari-icd +deleted file mode 100644 +index 29942b123..000000000 +--- a/tests/expected/blkid/lowprobe-pt-atari-icd ++++ /dev/null +@@ -1,8 +0,0 @@ +-size: 8388608, sector size: 512, PT: atari, offset: 0, id=(null) +---- +-#1: 65 4032 0x0 type='FAT' +-#2: 4097 904 0x0 type='FOO' +-#4: 12289 4096 0x0 type='BAR' +-#5: 5002 1999 0x0 type='GEM' +-#6: 7003 3238 0x0 type='RAW' +-#7: 10241 2048 0x0 type='RAW' +diff --git a/tests/expected/blkid/lowprobe-pt-atari-primary b/tests/expected/blkid/lowprobe-pt-atari-primary +new file mode 100644 +index 000000000..472821e47 +--- /dev/null ++++ b/tests/expected/blkid/lowprobe-pt-atari-primary +@@ -0,0 +1,3 @@ ++size: 5242880, sector size: 512, PT: atari, offset: 0, id=(null) ++--- ++#1: 2 10238 0x0 type='RAW' +diff --git a/tests/expected/blkid/lowprobe-pt-atari-xgm b/tests/expected/blkid/lowprobe-pt-atari-xgm +index 4b7756655..a7dae6995 100644 +--- a/tests/expected/blkid/lowprobe-pt-atari-xgm ++++ b/tests/expected/blkid/lowprobe-pt-atari-xgm +@@ -1,8 +1,4 @@ +-size: 8388608, sector size: 512, PT: atari, offset: 0, id=(null) ++size: 5242880, sector size: 512, PT: atari, offset: 0, id=(null) + --- +-#1: 65 4032 0x0 type='FAT' +-#2: 4097 904 0x0 type='FOO' +-#3: 5002 1999 0x0 type='GEM' +-#4: 7003 3238 0x0 type='RAW' +-#5: 10241 2048 0x0 type='RAW' +-#6: 12289 4096 0x0 type='BAR' ++#1: 2 9 0x0 type='RAW' ++#2: 14 10226 0x0 type='RAW' +diff --git a/tests/ts/blkid/images-pt/atari-icd.img.xz b/tests/ts/blkid/images-pt/atari-icd.img.xz +deleted file mode 100644 +index 00a2aba49a8f940c35b788fd693f966a31cd1aaf..0000000000000000000000000000000000000000 +GIT binary patch +literal 0 +HcmV?d00001 + +literal 1920 +zcmexsUKJ6=z`*kC+7>q^21Q0O1_p)_{ilon|NqLI8OvZIducK^Ecg5@jkusTr=nRy9*!Bn(bM`eR*oT<-}u76EuU~ +zr&{jenxVc;S-qm~ZIsPAhf|HgcYYYo_5QBSWhxk^uDJZlk@ka|=4h`oy~sXG;MryA +zIO|(4yiWFOUJ0<66IC1R`kF;$O2rLg_J2GWu-_F>bn|D|)EpJ!*v${KQj{VzR>(-u`|K~x`ZzH*T0p2&o +zI-4YzQ@78Q>MqMUn_j_J&?R}Ab%JX4g_GgC#kn_Er2N@;{G{oT!>g3%?{7LTl&~r1 +z*sPkJ_H4EL-ks8A5cG>Zb+_(`db`H=OHtd`KiM;({>U6}*_GC3*O{IFD%<~0_S{B} +zIAt^L!kb^-#2H7;7G8c(H`jXWaenqoR^eP0x0jjMz0;S=ntyt=$t<^43C^Wa`_>-0 +zn)7LCqnV7@rul}KIZjS|we9MTwfEKjD!a`sVqAVcbjH02iV_QaLoQ$Lm6>2)J5?)m +z+4ZM<_KLr<4xZ|{k^g93P-0R3!R;b!3l;9v+iG1rUa|31OFLJYVQ4>WuO;!puhEVbK`;3BdWnazD_hVWL>)9 +zUH-uWUw59169reTO_1GnZlk(HOk~^3w4jK6F9(a&E)Q>o&j0_BF`3~_aq#lL`_|PM +zO3mNiYnWFsZ@F^(8;#Sg7pKnXs?(bINxk&DxBzBB&bSbuc_Kc+u-9hd96{dU62 +zdy9&v9!&J;nWpuKafAQ2KRiy8H+G)6azfr>>9!ZUEsJ{hn{EH;vMu55vVwblapfAb +zxMqapUGF~CVIOb!`-J}sVcYGG8+IwL_`%kF^K1PzUTOPUszzJx7yZuII0hq?niBJy +ztHOi*X|1ZF(LqR~lKc93~ +zM{UwbNSDCeSh)377bwKEDG0HlkOiq$@C5SPZ)#xt%D~Ft{N&Fs28N&OuDBU3?>)l6 +bc!#f{p@D_bU0QSFk@Vk8zq^21Q0O1_p)_{ilon|NG21IhKJT|L>o5D`zuK%~gJC<+=Ii +zjxFDrre11~o8UX~^*sr`-ND)CA`-a`g{vlPsQ4ms_SS~eoI5Q;loOk08+!D2evoWh +za^cV`_b30BuKD=6`BwT2=4;0@BCk29bN`)lS>&4=``*}-hYFe|Np9+Tq~OEO|Ip}x +zJ4;5zolM)LTaTWs>#-B)sg`FET(veqcGtO$>Jl-LZ7YVQ4>WuO;!puhEVbK`;3BdWnazD_hVWL>)9UH-uWUw59169<{qE8fUY +zo&R5eQJdjSaq#lL`_|PMO3mNiYnWFsZ@F^(8;#Sg7pKnXs?(bINxk&DxBzBB&b +zSbuc_{}AvSO=2{V-+t2s#$OCG2V;Pp`LJObFuO6V(c5G(m3T!1071TaDPc176 +z%r3#|+u3QZtfaEW{3%z$%QU-cGO>PfMsWxu0c{gkG*2F%lPd=M1Y0KMdb1z~F#!dT +z0hR!nlZ*pGlY9kID9q|Q?7#p305pfRGwmY1>Hq(WLc?9R2t|ec6RBZT@27Sz` +zOOUBo_werj4>Y!M_jnW_X5LT!U5BJX(|7z_`gvmiFY#+&QGZnQ(jc275rI8N1mYN% +z7v%B{<<#dXY{%}<@y#~8tP9hXhdGhPLXas^?`1i>3YaIhBPV!{?OHspK+1tr-1sq_ +zOZO`ZH4#=PA*a;DhrzO(E3P%s2bvJ((;Hqp+UQEjk15npIGkF2Q$_0pB(dp;yn_5C +zKjIcSPFeWwJAX-pwI>0p^9vxJ5{vOrh0paF?UCzL@0Je2X%OGwl&9sLSXEoYL7KSi +z7kK;C!)?P%&jT1dJAlLZ%9j=5dAv$#2>cZVkYtBX;b +zKkd4%t<0bN;Bxyi9^Oz(*%pa{7z1UunHr0BY|UqQ4u5cp8OsHbC2P>hSGyMrvv_3u +zzQ@Tm#KWp1pTB~~5@51y#+rP&KL&li?#e9y5l&so-G1aJhbZ^bTDPy{ypVsyoJ$?4 +zJI$^(&-ERT{vFP-2wo#L3vt=>>|Qfkn-izOEp0os#}5b6I#&uf+o6-(AknAKCP^m+ +zEB^#2tYI)UL`(v`beQMaSJV*sS*EXE2$I<^GcOj!0Hii26j3aN*&gGTU5Zv+1i&@u +zjId2o5C}?3I%5GFBrU@lP*l(vtk2>ZTe5f +z$zE{PRc+w5GMeW^E4f@oa+%ryKCLFeKmd=m8Cq32;k}|hR%L!j^w4xxgPa6z%)Qy@ +zimjI||1RsAlMMk+M(8o4AFk??@Qc3})r~lth`4dR`1> +z^;L1tHfbGi`%8!rY(mS3KU@Hh&`z%=D3oy@J&z>elMn+h2}%2(tDpZ60W6XOI|uL2 +zV$Ccjl9Rv!HWZKL5CJQa1C*2A0vVHh0)H=n0rda{07K;b`Tzg` +l001+77wRp|PznG6*$#k!fCRGE)_JkSXZr#G00004Sz1dOv2XwY + +-- +2.36.1 + diff --git a/SOURCES/0084-tests-update-atari-partx-tests.patch b/SOURCES/0084-tests-update-atari-partx-tests.patch new file mode 100644 index 0000000..2d004cd --- /dev/null +++ b/SOURCES/0084-tests-update-atari-partx-tests.patch @@ -0,0 +1,55 @@ +From cf74ece6486dabfd4b84c90435348c04ff72ef54 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 13 Oct 2020 18:34:39 +0200 +Subject: tests: update atari partx tests + +Upstream: http://github.com/util-linux/util-linux/commit/017c0308c7d3b0d84bfc11e5863220bc32d640ba +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030 +Signed-off-by: Karel Zak +--- + tests/expected/partx/partx-image-atari-icd | 7 ------- + tests/expected/partx/partx-image-atari-primary | 2 ++ + tests/expected/partx/partx-image-atari-xgm | 10 +++------- + 3 files changed, 5 insertions(+), 14 deletions(-) + delete mode 100644 tests/expected/partx/partx-image-atari-icd + create mode 100644 tests/expected/partx/partx-image-atari-primary + +diff --git a/tests/expected/partx/partx-image-atari-icd b/tests/expected/partx/partx-image-atari-icd +deleted file mode 100644 +index 8677dff03..000000000 +--- a/tests/expected/partx/partx-image-atari-icd ++++ /dev/null +@@ -1,7 +0,0 @@ +-NR START END SECTORS SIZE NAME UUID +- 1 65 4096 4032 2M +- 2 4097 5000 904 452K +- 4 12289 16384 4096 2M +- 5 5002 7000 1999 999.5K +- 6 7003 10240 3238 1.6M +- 7 10241 12288 2048 1M +diff --git a/tests/expected/partx/partx-image-atari-primary b/tests/expected/partx/partx-image-atari-primary +new file mode 100644 +index 000000000..044d319be +--- /dev/null ++++ b/tests/expected/partx/partx-image-atari-primary +@@ -0,0 +1,2 @@ ++NR START END SECTORS SIZE NAME UUID ++ 1 2 10239 10238 5M +diff --git a/tests/expected/partx/partx-image-atari-xgm b/tests/expected/partx/partx-image-atari-xgm +index 248d6a56a..557327c04 100644 +--- a/tests/expected/partx/partx-image-atari-xgm ++++ b/tests/expected/partx/partx-image-atari-xgm +@@ -1,7 +1,3 @@ +-NR START END SECTORS SIZE NAME UUID +- 1 65 4096 4032 2M +- 2 4097 5000 904 452K +- 3 5002 7000 1999 999.5K +- 4 7003 10240 3238 1.6M +- 5 10241 12288 2048 1M +- 6 12289 16384 4096 2M ++NR START END SECTORS SIZE NAME UUID ++ 1 2 10 9 4.5K ++ 2 14 10239 10226 5M +-- +2.36.1 + 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 6680ff3..09a9cf1 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: 34%{?dist} +Release: 38%{?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 @@ -53,6 +53,7 @@ Source2: util-linux-remote.pamd Source3: util-linux-chsh-chfn.pamd Source4: util-linux-60-raw.rules Source5: adjtime +Source6: uuidd-tmpfiles.conf Source12: util-linux-su.pamd Source13: util-linux-su-l.pamd Source14: util-linux-runuser.pamd @@ -241,6 +242,24 @@ Patch72: 0072-blkid-check-device-type-and-name-before-probe.patch Patch73: 0073-blkid-don-t-print-all-devices-if-only-garbage-specif.patch # 1950187 - Ambient capabilities failed to applied to non-root user even when correct rules are in /etc/security/capability.conf Patch74: 0074-Complete-Linux-PAM-compliance-for-forked-child-in-su.patch +# 2058176 - losetup Retry LOOP_SET_STATUS64 on EAGAIN +Patch75: 0075-lib-loopdev-retry-LOOP_SET_STATUS64-and-LOOP_SET_BLO.patch + +### RHEL-8.7 +### +# 2060030 - Please backport patches for atari partition detection to RHEL 8 +Patch76: 0076-libblkid-fix-Atari-prober-logic.patch +Patch77: 0077-libblkid-make-Atari-more-robust.patch +Patch78: 0078-libblkid-allow-a-lot-of-mac-partitions.patch +Patch79: 0079-libblkid-limit-amount-of-parsed-partitions.patch +Patch80: 0080-libblkid-mac-make-sure-block-size-is-large-enough-fu.patch +# 2069187 - Internal testsuite for lscpu failed on aarch64 +Patch81: 0081-lscpu-don-t-read-from-HW-when-use-sys-snapshot.patch +# 2093166 - lslogins reports incorrect "Password is locked" status +Patch82: 0082-lslogins-improve-prefixes-interpretation.patch +# 2060030 - Please backport patches for atari partition detection to RHEL 8 +Patch83: 0083-tests-update-atari-blkid-tests.patch +Patch84: 0084-tests-update-atari-partx-tests.patch %description @@ -477,9 +496,7 @@ 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 0664 ${RPM_BUILD_ROOT}/var/log/lastlog +mkdir -p ${RPM_BUILD_ROOT}%{_tmpfilesdir} # install util-linux make install DESTDIR=${RPM_BUILD_ROOT} @@ -498,6 +515,7 @@ echo '.so man8/raw.8' > $RPM_BUILD_ROOT%{_mandir}/man8/rawdevices.8 mv ${RPM_BUILD_ROOT}%{_sbindir}/raw ${RPM_BUILD_ROOT}%{_bindir}/raw # And a dirs uuidd needs that the makefiles don't create +install -m 644 %{SOURCE6} ${RPM_BUILD_ROOT}%{_tmpfilesdir}/uuidd.conf install -d ${RPM_BUILD_ROOT}/run/uuidd install -d ${RPM_BUILD_ROOT}/var/lib/libuuid @@ -585,22 +603,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:utmp /var/log/lastlog -chmod 0664 /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 if [ ! -L /etc/mtab ]; then ln -sf ../proc/self/mounts /etc/mtab || : fi @@ -678,7 +680,6 @@ fi %attr(755,root,root) %{_bindir}/login %attr(2755,root,tty) %{_bindir}/write -%ghost %attr(0664,root,utmp) %verify(not md5 size mtime) /var/log/lastlog %ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/mtab %{_unitdir}/fstrim.* @@ -1021,6 +1022,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 @@ -1107,6 +1109,22 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog +* Mon Aug 22 2022 Karel Zak 2.32.1-38 +- improve tmpfiles.d use in spec file (related to #2059241) + +* Fri Jul 15 2022 Karel Zak 2.32.1-37 +- update atari partition tests (related to #2060030) + +* Thu Jul 14 2022 Karel Zak 2.32.1-36 +- fix #2060030 - Please backport patches for atari partition detection to RHEL 8 +- fix #2069187 - Internal testsuite for lscpu failed on aarch64 +- fix #2093166 - lslogins reports incorrect "Password is locked" status +- fix #2059241 - rpm -V / --verify reports bad user/group/mtime for /run/uuidd +- fix #2044592 - Move /var/log/lastlog ownership to systemd + +* Tue Mar 08 2022 Karel Zak 2.32.1-35 +- fix #2058176 - losetup Retry LOOP_SET_STATUS64 on EAGAIN + * Mon Jan 17 2022 Karel Zak 2.32.1-34 - rebuild after revert