From f6ae65c1f890d68a02428faa4076b5d9ed3b35f7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 29 Sep 2025 10:55:25 +0200 Subject: [PATCH] lscpu: Add NVIDIA Olympus arm64 core - libfdisk: improve collision reporting - libfdisk: (dos) ignore incomplete EBR for non-wholedisk - wall: always use utmp as fallback Resolves: RHEL-84815 RHEL-59867 RHEL-82162 RHEL-113639 --- ...-lscpu-Add-NVIDIA-Olympus-arm64-core.patch | 29 +++ ...libfdisk-improve-collision-reporting.patch | 241 ++++++++++++++++++ ...ore-incomplete-EBR-for-non-wholedisk.patch | 58 +++++ 0015-wall-always-use-utmp-as-fallback.patch | 137 ++++++++++ util-linux.spec | 15 +- 5 files changed, 478 insertions(+), 2 deletions(-) create mode 100644 0012-lscpu-Add-NVIDIA-Olympus-arm64-core.patch create mode 100644 0013-libfdisk-improve-collision-reporting.patch create mode 100644 0014-libfdisk-dos-ignore-incomplete-EBR-for-non-wholedisk.patch create mode 100644 0015-wall-always-use-utmp-as-fallback.patch diff --git a/0012-lscpu-Add-NVIDIA-Olympus-arm64-core.patch b/0012-lscpu-Add-NVIDIA-Olympus-arm64-core.patch new file mode 100644 index 0000000..c0e6c1e --- /dev/null +++ b/0012-lscpu-Add-NVIDIA-Olympus-arm64-core.patch @@ -0,0 +1,29 @@ +From 8645e1ce6b64a57b8159b9509f882112eaf97425 Mon Sep 17 00:00:00 2001 +From: "Matthew R. Ochs" +Date: Tue, 2 Sep 2025 13:28:36 -0700 +Subject: lscpu: Add NVIDIA Olympus arm64 core + +Add an entry for NVIDIA Olympus arm64 core. + +Signed-off-by: Matthew R. Ochs +Upstream: http://github.com/util-linux/util-linux/commit/908777470d403ec30c525472ba0d3701c9c5a223 +Addresses: https://issues.redhat.com/browse/RHEL-113639 +--- + 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 682868550..3397e9d4d 100644 +--- a/sys-utils/lscpu-arm.c ++++ b/sys-utils/lscpu-arm.c +@@ -170,6 +170,7 @@ static const struct id_part nvidia_part[] = { + { 0x000, "Denver" }, + { 0x003, "Denver 2" }, + { 0x004, "Carmel" }, ++ { 0x010, "Olympus" }, + { -1, "unknown" }, + }; + +-- +2.50.1 + diff --git a/0013-libfdisk-improve-collision-reporting.patch b/0013-libfdisk-improve-collision-reporting.patch new file mode 100644 index 0000000..7e7508d --- /dev/null +++ b/0013-libfdisk-improve-collision-reporting.patch @@ -0,0 +1,241 @@ +From af9954b8da649684241c55fa617fdf629b33a454 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 8 Sep 2025 11:44:16 +0200 +Subject: libfdisk: improve collision reporting + +In some cases, a collision occurs in the first sector. Creating a new +partition table overwrites this sector, but updating an existing table +does not. In the latter case, promising to wipe the collision is a +bug. + +Because we cannot know whether the collision is expected (e.g., hybrid +or boot disks) or unintended, we inform the user and let them decide. +libfdisk can wipe the unwanted signature only when creating a new +partition table; otherwise, the user can use wipefs. + +This commit introduces fdisk_is_collision_area(), an API to detect +where the collision occurs. The function is generic and not limited to +the first sector. + +Fixes: https://github.com/util-linux/util-linux/issues/3659 +Signed-off-by: Karel Zak +Upstream: http://github.com/util-linux/util-linux/commit/e873aa0322f42167a402e95dd398fcc4eb256119 +Addresses: https://issues.redhat.com/browse/RHEL-82162 +--- + disk-utils/fdisk.c | 21 +++++++++++++++------ + disk-utils/sfdisk.c | 28 +++++++++++++++++++--------- + libfdisk/docs/libfdisk-sections.txt | 1 + + libfdisk/src/context.c | 21 +++++++++++++++++++++ + libfdisk/src/fdiskP.h | 1 + + libfdisk/src/libfdisk.h.in | 1 + + libfdisk/src/libfdisk.sym | 4 ++++ + libfdisk/src/wipe.c | 23 ++++++++++++++++------- + 8 files changed, 78 insertions(+), 22 deletions(-) + +diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c +index c75a7a63c..490e7b670 100644 +--- a/disk-utils/fdisk.c ++++ b/disk-utils/fdisk.c +@@ -924,12 +924,21 @@ void follow_wipe_mode(struct fdisk_context *cxt) + dowipe = 1; /* always remove old PT */ + + fdisk_enable_wipe(cxt, dowipe); +- if (dowipe) +- fdisk_warnx(cxt, _( +- "The device contains '%s' signature and it will be removed by a write command. " +- "See fdisk(8) man page and --wipe option for more details."), +- fdisk_get_collision(cxt)); +- else ++ ++ if (dowipe) { ++ /* check if collision in first sector */ ++ if (fdisk_has_label(cxt) && fdisk_is_collision_area(cxt, 0, ++ fdisk_get_sector_size(cxt))) ++ fdisk_warnx(cxt, _( ++ "The device contains a '%s' signature in the first sector; it will not be wiped " ++ "unless you create a new partition table. Alternatively, use wipefs(8)."), ++ fdisk_get_collision(cxt)); ++ else ++ fdisk_warnx(cxt, _( ++ "The device contains '%s' signature and it will be removed by a write command. " ++ "See fdisk(8) man page and --wipe option for more details."), ++ fdisk_get_collision(cxt)); ++ } else + fdisk_warnx(cxt, _( + "The device contains '%s' signature and it may remain on the device. " + "It is recommended to wipe the device with wipefs(8) or " +diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c +index d8dd8d296..b25cc7955 100644 +--- a/disk-utils/sfdisk.c ++++ b/disk-utils/sfdisk.c +@@ -1661,22 +1661,32 @@ static void follow_wipe_mode(struct sfdisk *sf) + if (sf->quiet) + return; + +- if (dowipe) { +- if (!fdisk_is_ptcollision(sf->cxt)) { +- fdisk_warnx(sf->cxt, _( +- "The device contains '%s' signature and it may be removed by a write command. " +- "See sfdisk(8) man page and --wipe option for more details."), +- fdisk_get_collision(sf->cxt)); +- fputc('\n', stdout); +- } +- } else { ++ if (!dowipe) { + fdisk_warnx(sf->cxt, _( + "The device contains '%s' signature and it may remain on the device. " + "It is recommended to wipe the device with wipefs(8) or " + "sfdisk --wipe, in order to avoid possible collisions."), + fdisk_get_collision(sf->cxt)); + fputc('\n', stderr); ++ return; + } ++ ++ if (fdisk_is_ptcollision(sf->cxt)) ++ return; /* PT will be replaced */ ++ ++ if (sf->append && fdisk_has_label(sf->cxt) ++ && fdisk_is_collision_area(sf->cxt, 0, fdisk_get_sector_size(sf->cxt))) ++ fdisk_warnx(sf->cxt, _( ++ "The device contains a '%s' signature in the first sector; it will not be wiped " ++ "unless you create a new partition table. Alternatively, use wipefs(8)."), ++ fdisk_get_collision(sf->cxt)); ++ else ++ fdisk_warnx(sf->cxt, _( ++ "The device contains '%s' signature and it may be removed by a write command. " ++ "See sfdisk(8) man page and --wipe option for more details."), ++ fdisk_get_collision(sf->cxt)); ++ ++ fputc('\n', stdout); + } + + static int wipe_partition(struct sfdisk *sf, size_t partno) +diff --git a/libfdisk/docs/libfdisk-sections.txt b/libfdisk/docs/libfdisk-sections.txt +index efc138571..1e4b82e2d 100644 +--- a/libfdisk/docs/libfdisk-sections.txt ++++ b/libfdisk/docs/libfdisk-sections.txt +@@ -335,6 +335,7 @@ fdisk_has_dialogs + fdisk_has_label + fdisk_has_protected_bootbits + fdisk_has_wipe ++fdisk_is_collision_area + fdisk_is_details + fdisk_is_labeltype + fdisk_is_listonly +diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c +index 463a60f86..a9e6027ea 100644 +--- a/libfdisk/src/context.c ++++ b/libfdisk/src/context.c +@@ -449,6 +449,27 @@ int fdisk_is_ptcollision(struct fdisk_context *cxt) + return cxt->pt_collision; + } + ++/** ++ * fdisk_is_collision_area: ++ * @cxt: fdisk context ++ * ++ * If there is a collision with the filesystem or another partition table, ++ * verify that the detected magic string is within the specified area. ++ * ++ * Returns: 0 or 1 ++ * ++ * Since: v2.42 ++ */ ++int fdisk_is_collision_area(struct fdisk_context *cxt, ++ uint64_t start, uint64_t size) ++{ ++ if (cxt->collision && ++ start <= cxt->collision_offset && cxt->collision_offset <= start + size) ++ return 1; ++ ++ return 0; ++} ++ + /** + * fdisk_get_npartitions: + * @cxt: context +diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h +index 49e057f11..84203976a 100644 +--- a/libfdisk/src/fdiskP.h ++++ b/libfdisk/src/fdiskP.h +@@ -409,6 +409,7 @@ struct fdisk_context { + listonly : 1; /* list partition, nothing else */ + + char *collision; /* name of already existing FS/PT */ ++ uint64_t collision_offset; + struct list_head wipes; /* list of areas to wipe before write */ + + int sizeunit; /* SIZE fields, FDISK_SIZEUNIT_* */ +diff --git a/libfdisk/src/libfdisk.h.in b/libfdisk/src/libfdisk.h.in +index 9c20f44be..ccf8582ed 100644 +--- a/libfdisk/src/libfdisk.h.in ++++ b/libfdisk/src/libfdisk.h.in +@@ -217,6 +217,7 @@ int fdisk_enable_wipe(struct fdisk_context *cxt, int enable); + int fdisk_has_wipe(struct fdisk_context *cxt); + const char *fdisk_get_collision(struct fdisk_context *cxt); + int fdisk_is_ptcollision(struct fdisk_context *cxt); ++int fdisk_is_collision_area(struct fdisk_context *cxt, uint64_t start, uint64_t size); + + int fdisk_set_unit(struct fdisk_context *cxt, const char *str); + const char *fdisk_get_unit(struct fdisk_context *cxt, int n); +diff --git a/libfdisk/src/libfdisk.sym b/libfdisk/src/libfdisk.sym +index bb69e93c4..81049133a 100644 +--- a/libfdisk/src/libfdisk.sym ++++ b/libfdisk/src/libfdisk.sym +@@ -324,3 +324,7 @@ FDISK_2.38 { + FDISK_2.40 { + fdisk_partition_get_max_size; + } FDISK_2.38; ++ ++FDISK_2_42 { ++ fdisk_is_collision_area; ++} FDISK_2.40; +diff --git a/libfdisk/src/wipe.c b/libfdisk/src/wipe.c +index bb5f1bb38..48e0036bf 100644 +--- a/libfdisk/src/wipe.c ++++ b/libfdisk/src/wipe.c +@@ -178,25 +178,34 @@ int fdisk_check_collisions(struct fdisk_context *cxt) + + blkid_probe_enable_superblocks(pr, 1); + blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_TYPE | ++ BLKID_SUBLKS_MAGIC | + BLKID_SUBLKS_BADCSUM); + blkid_probe_enable_partitions(pr, 1); +- blkid_probe_set_partitions_flags(pr, BLKID_PARTS_FORCE_GPT); ++ blkid_probe_set_partitions_flags(pr, BLKID_PARTS_FORCE_GPT | ++ BLKID_PARTS_MAGIC); + + /* we care about the first found FS/raid, so don't call blkid_do_probe() + * in loop or don't use blkid_do_fullprobe() ... */ + rc = blkid_do_probe(pr); + if (rc == 0) { + const char *name = NULL; ++ const char *off = NULL; + +- if (blkid_probe_lookup_value(pr, "TYPE", &name, 0) == 0) +- cxt->collision = strdup(name); +- else if (blkid_probe_lookup_value(pr, "PTTYPE", &name, 0) == 0) { +- cxt->collision = strdup(name); ++ if (blkid_probe_lookup_value(pr, "TYPE", &name, 0) == 0) { ++ blkid_probe_lookup_value(pr, "SBMAGIC_OFFSET", &off, NULL); ++ ++ } else if (blkid_probe_lookup_value(pr, "PTTYPE", &name, 0) == 0) { ++ blkid_probe_lookup_value(pr, "PTMAGIC_OFFSET", &off, NULL); + cxt->pt_collision = 1; + } + +- if (name && !cxt->collision) +- rc = -ENOMEM; ++ if (name) { ++ cxt->collision = strdup(name); ++ if (!cxt->collision) ++ rc = -ENOMEM; ++ } ++ if (!rc && off) ++ cxt->collision_offset = strtoumax(off, NULL, 10); + } + + blkid_free_probe(pr); +-- +2.50.1 + diff --git a/0014-libfdisk-dos-ignore-incomplete-EBR-for-non-wholedisk.patch b/0014-libfdisk-dos-ignore-incomplete-EBR-for-non-wholedisk.patch new file mode 100644 index 0000000..a50f647 --- /dev/null +++ b/0014-libfdisk-dos-ignore-incomplete-EBR-for-non-wholedisk.patch @@ -0,0 +1,58 @@ +From 6d73d34d70db580c877dd77788a430f4730a62d8 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 24 Sep 2024 13:37:13 +0200 +Subject: libfdisk: (dos) ignore incomplete EBR for non-wholedisk + +The logical partitions are defined by a chain of extended partitions, +with the beginning of the chain located on the whole disk device. + +If a user runs "fdisk --list /dev/sda4", libfdisk cannot calculate proper +offsets for the items in the chain, resulting in the following error +message: + + Failed to read extended partition table (offset=22528): Invalid argument + +This error message may confuse users and is unnecessary when fdisk is +used in list-only mode (--list option). It would be sufficient to only +print the content of the partition without the error message and not +continue to the next item in the chain. + +However, in write mode (without --list), the error message will still +be displayed as it is potentially dangerous to edit the EBR table. + +Addresses: https://issues.redhat.com/browse/RHEL-59867 +Signed-off-by: Karel Zak +(cherry picked from commit 9f0e6584696de7533e5571107d03f3426a359138) +--- + libfdisk/src/dos.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c +index 5c00164ce..db7e25716 100644 +--- a/libfdisk/src/dos.c ++++ b/libfdisk/src/dos.c +@@ -11,6 +11,7 @@ + #include "randutils.h" + #include "pt-mbr.h" + #include "strutils.h" ++#include "sysfs.h" + + #include "fdiskP.h" + +@@ -527,6 +528,13 @@ static void read_extended(struct fdisk_context *cxt, size_t ext) + struct dos_partition *p, *q; + struct fdisk_dos_label *l = self_label(cxt); + ++ if (fdisk_is_listonly(cxt) && ++ !sysfs_devno_is_wholedisk(fdisk_get_devno(cxt))) { ++ DBG(LABEL, ul_debug("DOS: unable to gather logical partition chain " ++ "when running on a non-whole disk device.")); ++ return; ++ } ++ + l->ext_index = ext; + pex = self_pte(cxt, ext); + if (!pex) { +-- +2.50.1 + diff --git a/0015-wall-always-use-utmp-as-fallback.patch b/0015-wall-always-use-utmp-as-fallback.patch new file mode 100644 index 0000000..da9b810 --- /dev/null +++ b/0015-wall-always-use-utmp-as-fallback.patch @@ -0,0 +1,137 @@ +From 4184803d9a04643ed9235bafb29e926b11714f52 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 3 Jun 2024 14:32:18 +0200 +Subject: wall: always use utmp as fallback + +Wall(1) can be compiled with systemd support to read the names of ttys +from the systemd session list. However, this may not work on all systems. +In case of failure, the best option is to use the traditional +utmp method as a fallback. + +This commit uses strv (string vector) to collect tty names from both +sources (systemd and utmp) and then sends a message to all ttys. + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2283049 +Signed-off-by: Karel Zak +(cherry picked from commit 0af497c6688b53a3a176176bfbcdca821bd856ec) +--- + term-utils/wall.c | 57 ++++++++++++++++++++++++++++++++--------------- + 1 file changed, 39 insertions(+), 18 deletions(-) + +diff --git a/term-utils/wall.c b/term-utils/wall.c +index 125fde438..22c3918bb 100644 +--- a/term-utils/wall.c ++++ b/term-utils/wall.c +@@ -78,6 +78,7 @@ + #include "closestream.h" + #include "timeutils.h" + #include "pwdutils.h" ++#include "strv.h" + + #define TERM_WIDTH 79 + #define WRITE_TIME_OUT 300 /* in seconds */ +@@ -190,19 +191,30 @@ static int is_gr_member(const char *login, const struct group_workspace *buf) + return 0; + } + ++static int has_tty(char **ttys, char *name) ++{ ++ char **str; ++ ++ STRV_FOREACH(str, ttys) { ++ if (strcmp(*str, name) == 0) ++ return 1; ++ } ++ ++ return 0; ++} ++ + int main(int argc, char **argv) + { + int ch; + struct iovec iov; + struct utmpx *utmpptr; +- char *p; + char line[sizeof(utmpptr->ut_line) + 1]; + int print_banner = TRUE; + struct group_workspace *group_buf = NULL; + char *mbuf, *fname = NULL; + size_t mbufsize; + unsigned timeout = WRITE_TIME_OUT; +- char **mvec = NULL; ++ char **mvec = NULL, **ttys = NULL, **str; + int mvecsz = 0; + + static const struct option longopts[] = { +@@ -265,30 +277,30 @@ int main(int argc, char **argv) + int sessions; + + sessions = sd_get_sessions(&sessions_list); +- if (sessions < 0) +- errx(EXIT_FAILURE, _("error getting sessions: %s"), +- strerror(-sessions)); ++ if (sessions < 0) { ++ warnx(_("error getting sessions: %s"), strerror(-sessions)); ++ goto utmp; ++ } + + for (int i = 0; i < sessions; i++) { + char *name, *tty; + int r; + +- if ((r = sd_session_get_username(sessions_list[i], &name)) < 0) +- errx(EXIT_FAILURE, _("get user name failed: %s"), strerror (-r)); +- +- if (!(group_buf && !is_gr_member(name, group_buf))) { +- if (sd_session_get_tty(sessions_list[i], &tty) >= 0) { +- if ((p = ttymsg(&iov, 1, tty, timeout)) != NULL) +- warnx("%s", p); +- +- free(tty); +- } ++ if ((r = sd_session_get_username(sessions_list[i], &name)) < 0) { ++ warnx(_("get user name failed: %s"), strerror (-r)); ++ goto utmp; + } ++ if (!(group_buf && !is_gr_member(name, group_buf)) ++ && sd_session_get_tty(sessions_list[i], &tty) >= 0 ++ && strv_consume(&ttys, tty) < 0) ++ err(EXIT_FAILURE, _("failed to allocate lines list")); ++ + free(name); + free(sessions_list[i]); + } + free(sessions_list); +- } else ++ } ++utmp: + #endif + { + while ((utmpptr = getutxent())) { +@@ -310,12 +322,21 @@ int main(int argc, char **argv) + continue; + + mem2strcpy(line, utmpptr->ut_line, sizeof(utmpptr->ut_line), sizeof(line)); +- if ((p = ttymsg(&iov, 1, line, timeout)) != NULL) +- warnx("%s", p); ++ if (has_tty(ttys, line)) ++ continue; ++ if (strv_extend(&ttys, line) < 0) ++ err(EXIT_FAILURE, _("failed to allocate lines list")); + } + endutxent(); + } + ++ STRV_FOREACH(str, ttys) { ++ char *er = ttymsg(&iov, 1, *str, timeout); ++ if (er) ++ warnx("%s", er); ++ } ++ ++ strv_free(ttys); + free(mbuf); + free_group_workspace(group_buf); + exit(EXIT_SUCCESS); +-- +2.50.1 + diff --git a/util-linux.spec b/util-linux.spec index 360e6e1..d6686f2 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -93,13 +93,11 @@ Requires: util-linux-core = %{version}-%{release} ### RHEL-10.0 ### - # 151635 - makeing /var/log/lastlog Patch0: 0000-login-lastlog-create.patch # Add `/run/motd.d` to the hardcoded MOTD_FILE # https://github.com/coreos/console-login-helper-messages/issues/60 Patch1: 0001-login-default-motd-file.patch - # Upstream Patch2: 0002-uuidd-fix-var-lib-libuuid-mode-uuidd-tmpfiles.conf.patch Patch3: 0003-uuidd-fix-typo-in-tmpfiles.conf.patch @@ -107,6 +105,9 @@ Patch3: 0003-uuidd-fix-typo-in-tmpfiles.conf.patch Patch4: 0004-more-make-sure-we-have-data-on-stderr.patch # RHEL-76070 - blkid: allow up to 64k erofs block sizes Patch5: 0005-blkid-allow-up-to-64k-erofs-block-sizes.patch + +### RHEL-10.1 +### # RHEL-79770 - agetty: fix stdin conversion to tty name Patch6: 0006-agetty-fix-stdin-conversion-to-tty-name.patch # RHEL-34021 - coresched: Manage core scheduling cookies for tasks @@ -117,6 +118,16 @@ Patch9: 0009-docs-add-European-Public-License-v1.2.patch Patch10: 0010-lscpu-Add-FUJITSU-aarch64-MONAKA-cpupart.patch Patch11: 0011-lscpu-New-Arm-part-numbers.patch +### RHEL-10.2 +### +# RHEL-113639 - lscpu: Add NVIDIA Olympus arm64 core +Patch12: 0012-lscpu-Add-NVIDIA-Olympus-arm64-core.patch +# RHEL-82162 - libfdisk: improve collision reporting +Patch13: 0013-libfdisk-improve-collision-reporting.patch +# RHEL-59867 - libfdisk: (dos) ignore incomplete EBR for non-wholedisk +Patch14: 0014-libfdisk-dos-ignore-incomplete-EBR-for-non-wholedisk.patch +# RHEL- - wall: always use utmp as fallback +Patch15: 0015-wall-always-use-utmp-as-fallback.patch %description The util-linux package contains a large variety of low-level system