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>
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.).
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>
Karel Zak [Thu, 22 Feb 2024 09:26:15 +0000 (10:26 +0100)]
Merge branch 'enosys/dump' of https://github.com/t-8ch/util-linux
* 'enosys/dump' of https://github.com/t-8ch/util-linux:
setpriv: (tests) add seccomp test
setpriv: add support for seccomp filters
enosys: add functionality to dump filter
include: introduce seccomp.h
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 [Wed, 14 Feb 2024 13:46:26 +0000 (14:46 +0100)]
Merge branch 'lslogins-lastlog2' of https://github.com/schubi2/util-linux
* 'lslogins-lastlog2' of https://github.com/schubi2/util-linux:
added build option login-lastlogin
added sqlite3 to packit
added sqlite3 to debian build
fixed time
unifiy test output
cleanup tests
cleanup tests
fixed time-stamp
creating lastlog2 database in the tests
check test output
cleanup; Added testcase for lslogins and lastlog2 DB
lslogins: Add support for lastlog2
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.
"Fetching and setting the value of errno is async-signal-safe
provided that the signal handler saves errno on entry and
restores its value before returning."
save and restore errno on cases where it is needed.
Karel Zak [Thu, 8 Feb 2024 11:42:51 +0000 (12:42 +0100)]
fsck: warn if fsck.<type> not found and device is specified
The fsck(8) command prints an error for certain 'required'
filesystems, such as extN, if the corresponding fsck.<type> helper is
not found. However, for other filesystems, it silently ignores the
device. While this behavior is acceptable for the -A option, if a user
explicitly specifies the device on the command line, it is probably a
good idea to be more verbose and issue a warning that the device will
be ignored. The warning is enabled only for interactive mode (only one
device specified or -s).
Note that some filesystems do not have an fsck utility, so caution is
needed when issuing such warnings to prevent the generation of a large
number of unwanted entries in system logs, etc."
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Karel Zak <kzak@redhat.com>
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 11:07:49 +0000 (12:07 +0100)]
Merge branch 'lsfd--error' of https://github.com/masatake/util-linux
* 'lsfd--error' of https://github.com/masatake/util-linux:
tests: (lsfd) add a case testing ERROR type appeared in TYPE column
tests: (test_mkfds::mmap) new factory
lsfd: add --_drop-prvilege option for testing purpose
lsfd: add ERROR as a new type
lsfd: (refactor) make the steps for new_file consistent
lsfd: (refactor) add abst_class as super class of file_class
lsfd: (refactor) simplify the step to make a file struct
lsfd: (refactor) simplify the step to copy a file struct if the result of its stat is reusable
lsfd: (refactor) flatten bit fields in struct file
lsfd: fix typos of a function name
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