lscpu: Skip aarch64 decode path for rest of the architectures
lscpu behaves differently when run sudo vs non-sudo on AMD architectures.
On sudo runs, it adds a BIOS model name and BIOS CPU family which it
does not add for the latter. However since this parsing from the DMI is
primarily catered to aarch64, for AMD platform the BIOS model name is
printed out as follows "AMD XXX Processor *Unknown* CPU @ X.XGHz" due
to the part number is not populated on the platform.
The issue boils down to an unconditional call to arm_decode() which
attempts to read the DMI path and populate the processor information
such as processor version and part number which is set to Unknown on AMD
CPUs.
81d6de9 (lscpu: remove the old code) changed the DMI path from
/sys/firmware/dmi/entries/4-0/raw (non-existent) to
/sys/firmware/dmi/tables/dmi (existent) which has brought this latent
issue to light as DMI was starting to be parsed incorrectly.
Therefore, do not perform aarch64 parsing for other architectures.
Before
------
$ lscpu
Vendor ID: AuthenticAMD
Model name: AMD EPYC XXXX X-Core Processor
CPU family: 26
$ sudo lscpu
Vendor ID: AuthenticAMD
BIOS Vendor ID: Advanced Micro Devices, Inc.
Model name: AMD EPYC XXXX X-Core Processor
BIOS Model name: AMD EPYC XXXX X-Core Processor Unknown CPU @ X.XGHz
BIOS CPU family: 107
CPU family: 26
After
-----
$ lscpu
Vendor ID: AuthenticAMD
Model name: AMD EPYC XXXX X-Core Processor
CPU family: 26
$ sudo lscpu
Vendor ID: AuthenticAMD
Model name: AMD EPYC XXXX X-Core Processor
CPU family: 26
Fixes: 81d6de9 ("lscpu: remove the old code") Co-developed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Pratik R. Sampat <pratikrajesh.sampat@amd.com>
Stanislav Brabec [Sun, 21 Jul 2024 13:01:42 +0000 (15:01 +0200)]
agetty: Prevent cursor escape
Starting with 5de97519, it is possible to escape the login dialog on the
screen by arrow characters or using escape sequences.
Since full processing of escape sequences and ignore them would be
complicated, use a work around: instead of sending ESC to output, send a
printable character.
It could cause a rendering regression in a very obscure condition: compiled
without IUTF8, encoding is ISO-11548-1 and BRAILLE PATTERN DOTS-1245 is
part of login name. I believe that it is out of supported combinations.
Karel Zak [Mon, 15 Jul 2024 10:15:28 +0000 (12:15 +0200)]
Merge branch 'kill--decode' of https://github.com/masatake/util-linux
* 'kill--decode' of https://github.com/masatake/util-linux:
kill: (test) add a case for testing -l 0xSIGMASK and -d $PID options
kill: add a feature decoding signal masks
The directory can be directly used by libuuid, for example, by running
"uuidgen --time" as root, even if the uuidd daemon is not installed.
In this case, we must create a clock.txt file with the uuidd group to
prevent any potential ownership mismatch if the uuidd daemon is
installed later. The 2xxx mode (setgid) forces open(O_CREAT) in
libuuid to create the file with the uuidd group.
Please note that mode 2755 is the standard used for years in RHEL.
David Gibson [Tue, 9 Jul 2024 05:44:31 +0000 (15:44 +1000)]
unshare: Add options to identity map the user's subordinate uids and gids
--map-users=auto, --map-groups=auto and --map-auto allow automatically
mapping the first block of user or group IDs owned by the effective user
from /etc/sub[ug]id to a block starting at user ID 0. Add options
--map-users=subids, --map-groups=subids and --map-subids to perform a
mapping of the same IDs, but as an identity mapping instead of to UID 0.
This is useful in similar situations to --map-current-user, but preserves
access to the user's subordinate IDs. That allows nested namespaces to
be created with more complex user mappings, either with unshare or with
a container runtime such as podman.
Fixes: https://github.com/util-linux/util-linux/issues/3120 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
column: Adds option -S <num> so whitespaces are used instead of tabs in non table mode.
Entries are padded with whitespaces, then <num> spaces are added to separate the columns.
This should fix https://github.com/util-linux/util-linux/issues/1551
Karel Zak [Tue, 2 Jul 2024 09:14:06 +0000 (11:14 +0200)]
lib/fileutils: add ul_basename()
Unfortunately, the basename() function can be affected by the
creativity of different libc authors, resulting in varying behavior
across implementations.
Instead, use a local implementation to ensure consistency and
portability.
Karel Zak [Tue, 2 Jul 2024 07:32:19 +0000 (09:32 +0200)]
Merge branch 'automake/install-dependency' of https://github.com/t-8ch/util-linux
* 'automake/install-dependency' of https://github.com/t-8ch/util-linux:
autotools: Properly order install dependencies of pam_lastlog2
autotools: make pam install path configurable
Unfortunately, the behavior is different between DOS (original docs)
and GPT. Due to the need for backward compatibility, it is likely
impossible to change the default setting ...
Addresses: https://github.com/util-linux/util-linux/issues/3097 Signed-off-by: Karel Zak <kzak@redhat.com>
Thomas Weißschuh [Sun, 30 Jun 2024 09:23:53 +0000 (11:23 +0200)]
autotools: Properly order install dependencies of pam_lastlog2
As pam_lastlog2 is relinked during installation, all its dependencies
need to already be installed.
This is the same issue that affected pylibmount which was fixed in
commit 324330aca644 ("build-sys: Properly order install dependencies of pylibmount").
Extend the logic added in that commit to also apply to pam_lastlog2.
Closes: #3011 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
While at it, also move the initial definition of
usesecurelib_exec_LTLIBRARIES into Makefile.am.
Also add "exec" to the target name which is recognized by automake to
mark the targets as architecture-specific.
Stanislav Brabec [Wed, 19 Jun 2024 15:31:34 +0000 (17:31 +0200)]
umount, losetup: Document loop destroy behavior
The loop device detach runs asynchronously in the background. It can cause
unexpected errors. Document the possible existence of the loop device after
exit of losetup -d or umount and need of "udevadm settle".
Laurent Vivier [Wed, 19 Jun 2024 08:19:51 +0000 (10:19 +0200)]
unshare: load binfmt_misc interpreter
add -l, --load-interp <file> to load a binfmt_misc interpreter at startup.
The interpreter is loaded from the initial fileystem if the 'F' flags is
provided, otherwise from inside the new namespace
This makes possible to start a chroot of another architecture without
being root.
Thomas Weißschuh [Wed, 12 Jun 2024 21:32:15 +0000 (23:32 +0200)]
lib/sysfs: zero-terminate result of sysfs_blkdev_get_devchain()
sysfs_blkdev_get_devchain() does not zero-terminate its result, but the
caller expects a C-string.
Use ul_buffer_get_string() which includes a trailing zero-byte.
Now it's also valid for sz and bufsz to be equal.
See #3088. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Thomas Weißschuh [Thu, 13 Jun 2024 09:39:34 +0000 (11:39 +0200)]
lib/buffer: introduce ul_buffer_get_string()
Some users need a zero-byte-terminated string.
As the buffer internally already maintains a zero-termination, add a
helper function that exposes this to users.
wdctl: always query device node when sysfs is unavailable
When there is no sysfs at all for the watchdog, fall back to reading
from the device node.
This is also useful if the legacy compat /dev/watchdog device which
never has a sysfs interface.
Closes: #3073 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Thomas Weißschuh [Mon, 29 Apr 2024 06:11:57 +0000 (08:11 +0200)]
lsfd: (tests) skip tests using fd flags on qemu-user
The flags value visible in /proc/$PID/fdinfo/ is encoded using the
platform the kernel is running on.
Not all platforms use the same numeric flag value,
making this cross-platform interpretation brittle.
Karel Zak [Mon, 3 Jun 2024 10:33:01 +0000 (12:33 +0200)]
libmount: fix tree FD usage in subdir hook
* Initialize the tree file descriptor in the hook_subdir.c module if
it has not been initialized yet. (hook_mount.c does not open the
tree if the mount.<type> helper will be executed.)
* Move the function to open the tree to context.c to make it more
generic and usable in more places.
Reported-by: Linus Heckemann <git@sphalerite.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 3 Jun 2024 12:32:18 +0000 (14:32 +0200)]
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 <kzak@redhat.com>