Karel Zak [Tue, 27 Feb 2024 17:38:02 +0000 (18:38 +0100)]
hexdump: check blocksize when display data
hexdump(1) stores input to buffer and apply format unit when prints
the output. The unit can move pointer which points to the buffer, but
code does not check for limits.
Fixes: https://github.com/util-linux/util-linux/issues/2806 Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit dfa1ad272528a92384adac523cf2f2949b767d8d)
Karel Zak [Mon, 26 Feb 2024 11:44:10 +0000 (12:44 +0100)]
libmount: report kernel message from new API
This is a very minimalistic implementation for v2.40 designed to print
error messages from the kernel. It exclusively displays errors, and
the patch does not introduce any new library interface for this
purpose. Instead, it simply replaces hardcoded messages within
libmount with kernel messages.
It's worth noting that the final implementation will necessitate
per-hook error handling in libmount and likely a new library API to
access other types of messages (warnings, notices, etc.).
Thomas Weißschuh [Fri, 23 Feb 2024 07:15:32 +0000 (08:15 +0100)]
meson: run compiler checks with -D_GNU_SOURCE when necessary
Through the addition of default_options: c_std=c99 some build-time
checks were incorrect. Explicitly add -D_GNU_SOURCE where necessary.
Fixes: 6240e4458cdf ("build: use -std=c99 and -std=c++11 by default") Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit 1eeabbb42649f8334b6330689fec54325591fe2f)
Jan Kara [Wed, 21 Feb 2024 17:30:50 +0000 (18:30 +0100)]
libmount: don't hold write fd to mounted device
Avoid holding writeable fd to a loop device that is being mounted. In
the hardened configurations (CONFIG_BLK_DEV_WRITE_MOUNTED = n) the
kernel wants to make sure nobody else has the block device writeably
open when mounting so this makes the mount fail.
Reported-by: JunChao Sun <sunjunchao2870@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Acked-by: Christian Brauner <brauner@kernel.org>
(cherry picked from commit 1cde32f323e0970f6c7f35940dcc0aea97b821e5)
Karel Zak [Wed, 21 Feb 2024 09:13:50 +0000 (10:13 +0100)]
docs: cleanup public domain license texts
The absence of an official 'Public domain' definition is the reason
why, for example, the Fedora distribution aggregates all variants from
various projects to make them reviewable.
This commit unifies the 'Public domain' statements to make it simple.
Karel Zak [Tue, 20 Feb 2024 11:26:33 +0000 (12:26 +0100)]
more: fix poll() use
The more(1) command utilizes signalfd() to monitor signals and reads
commands from the user via stderr (as stdin is typically used for
piping and not for user interaction).
However, the current more_poll() implementation ignores stderr. As a result,
more(1) waits on read(stderr) while completely ignoring signals. This issue
becomes evident when using commands like:
grep foo /path/file | more
In such cases, it's only possible to exit 'more' by pressing 'q';
CTRL+C does not work.
Changes:
- Refactor more_poll() code:
- Introduce an enum to access pfd[] items instead of using magical constants.
- Implement a while() loop to handle EAGAIN or POLLHUP.
- Ignore stdin after POLLHUP (indicating that the pipe's peer closed).
- Ensure stderr is also checked.
- Use return codes akin to classic poll().
Note: I have doubts regarding the usability of stdin in more_poll(),
as the function is primarily used to wait for user input (via stderr)
and to monitor signals. Nevertheless, it is retained for potential use
in detecting when the pipe's peer (or the entire session) has been
terminated (see commit 68e14d3d5f4116ad3aca0e392d008645ea90cf70).
Milan Broz [Fri, 16 Feb 2024 15:44:12 +0000 (16:44 +0100)]
libblkid: Check offset in LUKS2 header
LUKS2 binary header contains offset field that describes where
the header should be located.
If this offset is not correct, blkid should tread this header
as invalid.
This patch fixes problem when both swap and LUKS headers are
present (LUKS header was swapped out) and detected LUKS header
is at a wrong offset.
As LUKS has higher priority, it confuses detection.
Karel Zak [Thu, 15 Feb 2024 09:33:42 +0000 (10:33 +0100)]
docs: add hints about systemd
Suggested-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 9cb7b7671d903573d6c3b9d8112ec13953cdcdc6)
Unfortunately, this new feature introduces a regression. We need a
better solution (probably mount options option to enable the feature)
rather than enable it by default.
Fixes: https://github.com/util-linux/util-linux/issues/2773
References: https://github.com/util-linux/util-linux/issues/2370
(cherry picked from commit c19ae2094e865f1a153e25b865315bd68edf075b)
Fabian Vogt [Wed, 7 Feb 2024 10:29:26 +0000 (11:29 +0100)]
lastlog2: Fix various issues with meson
- Make sure @usrbin_execdir@ is actually replaced
- pam_lastlog2.so is always a shared library that's dlopen()ed,
so use shared_module and do not generate a pkgconfig module
Karel Zak [Mon, 5 Feb 2024 10:55:39 +0000 (11:55 +0100)]
Merge branch 'meson/lastlog2' of https://github.com/t-8ch/util-linux
* 'meson/lastlog2' of https://github.com/t-8ch/util-linux:
meson: only build liblastlog when enabled
meson: create dedicated config for pam_lastlog2
meson: use a dependency object for sqlite3
meson: use a dependency object for liblastlog2
Karel Zak [Mon, 5 Feb 2024 09:54:17 +0000 (10:54 +0100)]
Merge branch 'enosys/optim' of https://github.com/t-8ch/util-linux
* 'enosys/optim' of https://github.com/t-8ch/util-linux:
enosys: optimize bytecode when execve is not blocked
enosys: optimize bytecode when no ioctls are blocked
enosys: add helpers for 64 bit integer loading
enosys: drop unnessecary load of ioctl number
Karel Zak [Mon, 29 Jan 2024 13:01:34 +0000 (14:01 +0100)]
Merge branch 'lsfd--limit-listing-kthreads' of https://github.com/masatake/util-linux
* 'lsfd--limit-listing-kthreads' of https://github.com/masatake/util-linux:
lsfd: don't list kernel threads unless --threads is given
lsfd: (refactor) rename a function, s/new_process/new_proc/g
Karel Zak [Wed, 24 Jan 2024 08:56:13 +0000 (09:56 +0100)]
Merge branch 'boilerplate/test' of https://github.com/t-8ch/util-linux
* 'boilerplate/test' of https://github.com/t-8ch/util-linux:
Documentation: add basic smoketest for boilerplate.c
treewide: fix newlines when using fputs