John Paul Adrian Glaubitz points out that libseccomp needs to release 2.6.0,
too.
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de> Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Karel Zak [Tue, 9 Apr 2024 10:16:21 +0000 (12:16 +0200)]
Merge branch 'logger/fixes' of https://github.com/t-8ch/util-linux
* 'logger/fixes' of https://github.com/t-8ch/util-linux:
logger: correctly format tv_usec
logger: rework error handling in logger_gettimeofday()
logger: handle failures of gettimeofday()
Karel Zak [Tue, 9 Apr 2024 10:07:12 +0000 (12:07 +0200)]
Merge branch 'lsfd--verify-proc-syscall-for-master' of https://github.com/masatake/util-linux
* 'lsfd--verify-proc-syscall-for-master' of https://github.com/masatake/util-linux:
tests: (lsfd::mkfds-multiplexing) skip if /proc/$pid/syscall is broken
tv_usec is an unspecified signed integer type.
The format string %u assumes an unsigned int, which is incorrect.
Especially on 32bit big-endian, where it can lead to invalid values.
3dd79293b5b655da9d913dedd8facb08959a7826 added -I option.
However, the code used bit flags (FL_DF and FL_DF_INODES) wrongly;
the code broke the output of -D option.
Jordan Williams [Mon, 8 Apr 2024 15:12:17 +0000 (10:12 -0500)]
meson: Disable targets requiring pam when it is missing
Several executables require the pam library.
The current behavior in Meson only requires this library when these
executables are explicitly enabled.
Unfortunately, by default, Meson will not throw an error when the
required pam library is missing while still trying to build these
executables.
To fix this, make the pam library a disabler which automatically
disables these executables if it is not found.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Jordan Williams [Mon, 8 Apr 2024 14:33:19 +0000 (09:33 -0500)]
meson: Require Python dependency which can be embedded for pylibmount
Meson doesn't properly check that the necessary Python.h header file is
available for the pylibmount module.
Passing true for the embed keyword argument for the Python dependency
method ensures that this header file is available.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Jordan Williams [Mon, 8 Apr 2024 13:30:24 +0000 (08:30 -0500)]
meson: Enforce sqlite dependency for liblastlog2
liblastlog2 requires the sqlite dependency.
Currently, Meson enforces this dependency to be available only when the
build-liblastlog2 feature is explicitly enabled.
liblastlog2 is built by default, so if sqlite is not available, the
build will be configured correctly, but fail to compile.
This commit fixes this case by automatically disabling the
build-liblastlog2 feature when it is auto and sqlite is not found.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Karel Zak [Mon, 8 Apr 2024 07:55:59 +0000 (09:55 +0200)]
Merge branch 'test_mkfds-sockdiag-for-master' of https://github.com/masatake/util-linux
* 'test_mkfds-sockdiag-for-master' of https://github.com/masatake/util-linux:
tests: (test_mkfds::sockdiag) verify the recieved message to detect whether the socket is usable or not
lsfd: add LSFD_DEBUG env var for debugging
tests: (lsfd) skip some cases if NETLINK_SOCK_DIAG for AF_UNIX is not available
tests: (test_mkfds::sockdiag) new factory
tests: (lsfd-functions.bash,cosmetic) unify the style to define functions
tests: (lsfd) fix typoes in an error name
Karel Zak [Mon, 8 Apr 2024 07:48:10 +0000 (09:48 +0200)]
Merge branch 'xry111/pidfs' of https://github.com/xry111/util-linux
* 'xry111/pidfs' of https://github.com/xry111/util-linux:
lsfd: test: Adapt test cases for pidfs
lsfd: Support pidfs
lsfd: Refactor the pidfd logic into lsfd-pidfd.c
include: Include <unistd.h> in pidfd-utils.h for syscall()
Karel Zak [Mon, 8 Apr 2024 07:43:15 +0000 (09:43 +0200)]
Merge branch 'meson-make-libmount-optional' of https://github.com/jwillikers/util-linux
* 'meson-make-libmount-optional' of https://github.com/jwillikers/util-linux:
meson: Only build libmount when required
meson: Use libblkid as a dependency
meson: Use libmount as a dependency
Karel Zak [Mon, 8 Apr 2024 07:41:03 +0000 (09:41 +0200)]
Merge branch 'lsns--opened-ns' of https://github.com/masatake/util-linux
* 'lsns--opened-ns' of https://github.com/masatake/util-linux:
lsns: show namespaces only kept alive by open file descriptors
lsns: (refactor) use ul_new_path and procfs_process_init_path
Jordan Williams [Fri, 5 Apr 2024 14:49:17 +0000 (07:49 -0700)]
meson: Only build libmount when required
It is not currently possible to build any part of util-linux without
building libmount when using Meson.
The libuuid library is commonly used on macOS, where it is not possible
to build libmount.
To address this, this PR makes it possible to build without libmount and
libblkid.
Options have been added to allow toggling whether to build targets that
require libmount.
This makes it possible to fully disable building libmount.
The python object had to be defined outside of the meson.build file in
libmount/python since this may no longer be included.
The python object is used for tests.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Jordan Williams [Fri, 5 Apr 2024 15:30:02 +0000 (08:30 -0700)]
meson: Use libblkid as a dependency
Several utilities depend on libblkid internally.
Currently, link_with and global include directories are used to
associate targets with libblkid.
This PR uses Meson's dependencies argument for targets to define this
relationship instead.
This carries include directories along with the library to link.
An additional dependency is declared for the static libblkid library.
A couple of executables use this dependency explicitly.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Jordan Williams [Fri, 5 Apr 2024 15:33:22 +0000 (08:33 -0700)]
meson: Use libmount as a dependency
Several utilities depend on libmount internally.
Currently, link_with and global include directories are used to
associate targets with libmount.
This PR uses Meson's dependencies argument for targets to define this
relationship instead.
This carries include directories along with the library to link.
An additional dependency is declared for the static libmount library.
A couple of executables use this dependency explicitly.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Karel Zak [Fri, 5 Apr 2024 08:57:13 +0000 (10:57 +0200)]
Merge branch 'meson-optional-rt' of https://github.com/jwillikers/util-linux
* 'meson-optional-rt' of https://github.com/jwillikers/util-linux:
meson: Only pick up the rt library once
meson: Add build-lsfd option and make rt dependency optional
Karel Zak [Fri, 5 Apr 2024 07:40:48 +0000 (09:40 +0200)]
Merge branch 'PR/libsmartcols-json-empty' of github.com:karelzak/util-linux-work
* 'PR/libsmartcols-json-empty' of github.com:karelzak/util-linux-work:
libsmartcols: print empty arrays in better way
lib/jsonwrt: introduce ul_jsonwrt_empty()
Karel Zak [Wed, 3 Apr 2024 11:57:18 +0000 (13:57 +0200)]
lib/jsonwrt: introduce ul_jsonwrt_empty()
The new function optimizes the printing of empty objects and arrays in
a "pretty" way, instead of using the ul_jsonwrt_..._open() and
ul_jsonwrt_..._close() functions, which add extra line breaks to the
output.
Commit 5d71d711d07a ("libblkid: topolicy/ioctl: use union for multiple data types")
incorrectly assumed that set_ulong and set_int refer to the type
returned by the kernel. Instead the different function pointer names
refer to the types of the function pointers.
However all ioctls, except for the later added BLKGETDISKSEQ, return
32bit integers.
This made libblkid also interpret the upper 32bits too, leading to
garbage values.
Introduce a new member 'kernel_size' to also handle the 64bit
BLKGETDISKSEQ.
Drop data.ul as it is no actually used.
Closes #2904 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Xi Ruoyao [Wed, 3 Apr 2024 07:29:34 +0000 (15:29 +0800)]
lsfd: Refactor the pidfd logic into lsfd-pidfd.c
We'll reuse these logic for pidfd support on Linux >= 6.9. This should
be a no-functional change.
Besides moving the code, this change also renames anon_pidfd_data to
pidfd_data, and removes a redundant nullity check for free (because
free(NULL) will just do nothing per the C standard).
Masatake YAMATO [Sat, 24 Feb 2024 19:56:51 +0000 (04:56 +0900)]
lsns: show namespaces only kept alive by open file descriptors
Close #1884.
Quoted from the original issue comment submitted by @hesch:
It can happen, that a namespace is only kept alive by an open file
descriptor of a program as ilustrated by A.B:
1. 'ip netns add foo' - add a namespace
2. 'sleep 999 4< /run/netns/foo & sleep 2' - open the fd to the
namespace in a background job
3. 'ip netns delete foo' - delete the namespace (only deletes
the /run/netns/foo)
Now there exists a namespace with no process running in it and it has
no bind mount so it does not show up in /proc/mounts, but it is still
there and could be mounted back.
Karel Zak [Tue, 2 Apr 2024 10:58:02 +0000 (12:58 +0200)]
Merge branch 'lsns--Q' of https://github.com/masatake/util-linux
* 'lsns--Q' of https://github.com/masatake/util-linux:
tests: (lsns) add a case testing -Q, --filter option
tests: (test_mkfds::userns) add a new factory
tests: (test_mkfds::multiplexing) fix the factory description
lsns: add -H, --list-columns option
lsns: implement -Q, --filter option
lsfd: (man) fix the decoration of an optional parameter
lsns: add a missing '=' character in the help message
lsns: (man) make the namespace parameter optional
lsblk: (refactor) refer to a parameter instead of a file static var
Jordan Williams [Fri, 29 Mar 2024 17:14:44 +0000 (12:14 -0500)]
meson: Add build-lsfd option and make rt dependency optional
A dependency on the rt library is unnecessarily required when checking
for the clock_gettime and timer_create functions.
This causes the build to fail if the rt library is not found.
This should not fail the build as rt is only required for the checks.
Additionally, the lsfd executable and some tests require rt.
There is currently no option to toggle building lsfd.
This PR makes it possible to build without the rt library.
Function checks no longer require rt for the build.
The function checks for the rt library only run when rt is available.
This PR adds an option to allow building without lsfd.
This makes it possible to build without the executable that requires rt.
To not require rt for the test, a additional check has been added.
The effected tests won't be built unless rt has been found.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Jordan Williams [Fri, 29 Mar 2024 19:00:01 +0000 (14:00 -0500)]
meson: Fix false positive detection of mempcpy on macOS
The has_function check incorrectly detects mempcpy on macOS.
This function is not available on macOS and should not be detected.
Likely, this has to do with Meson's detection of compiler built-ins.
Using a specific prefix and defining _GNU_SOURCE fixes the detection.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Karel Zak [Mon, 1 Apr 2024 10:14:50 +0000 (12:14 +0200)]
libblkid: Fix segfault when blkid.conf doesn't exist
* Move 'line' and 'uevent' to the beginning of the LIBECONF code.
* Remove unwanted space between function name and arguments.
* Check for 'line' pointer before dereferencing.
References: https://github.com/util-linux/util-linux/pull/2883 Signed-off-by: Karel Zak <kzak@redhat.com>
Oldřich Jedlička [Sat, 30 Mar 2024 13:45:10 +0000 (14:45 +0100)]
libblkid: check OPAL lock only when necessary
When the HW OPAL encryption is used, the LUKS2 subsystem field is "HW-OPAL"
(see also [1]). Finish the probe only in case LUKS2 is set to use HW OPAL
and the disk is locked.
Thomas Weißschuh [Sat, 30 Mar 2024 10:14:47 +0000 (11:14 +0100)]
libblkid: introduce luks opal prober
Accesses to a disk locked with OPAL trigger IO errors logged by the
kernel which should be avoided.
Running the normal luks prober first breaks the ordering of probers
leading to incorrect detections, for example detecting mdadm superblocks
before version 1.1 as luks.
Introduce a new prober that only runs on OPAL-locked disks to avoid
these false-positives.
Jordan Williams [Fri, 29 Mar 2024 21:56:43 +0000 (16:56 -0500)]
meson: Don't define HAVE_ENVIRON_DECL when environ is unavailable
HAVE_ENVIRON_DECL is being defined to 0 by cfg_data.set10().
The code only checks whether or not is defined.
This leads to it not being declared appropriately.
Use cfg_data.set() instead of cfg_data.set10() to define it when true.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Karel Zak [Wed, 27 Mar 2024 10:46:01 +0000 (11:46 +0100)]
Merge branch 'blkid/json' of https://github.com/t-8ch/util-linux
* 'blkid/json' of https://github.com/t-8ch/util-linux:
blkid: add json output format
blkid: (tests) test output formats
blkid: (tests) use correct blkid binary
Karel Zak [Tue, 26 Mar 2024 11:45:24 +0000 (12:45 +0100)]
lsipc: fix semaphore USED counter
The code incorrectly counts only with the first item in the linked
list (due to a typo). It seems rather fragile to use "semds" and
"semdsp" as variable names in the same code ...
# lsipc -gs
Old:
KEY ID PERMS OWNER NSEMS RESOURCE DESCRIPTION LIMIT USED USE%
SEMMNI Number of semaphore identifiers 32000 3 0.01%
SEMMNS Total number of semaphores 1024000000 369 0.00%
SEMMSL Max semaphores per semaphore set. 32000 - -
SEMOPM Max number of operations per semop(2) 500 - -
SEMVMX Semaphore max value 32767 - -
Fixed:
KEY ID PERMS OWNER NSEMS RESOURCE DESCRIPTION LIMIT USED USE%
SEMMNI Number of semaphore identifiers 32000 3 0.01%
SEMMNS Total number of semaphores 1024000000 156 0.00%
SEMMSL Max semaphores per semaphore set. 32000 - -
SEMOPM Max number of operations per semop(2) 500 - -
SEMVMX Semaphore max value 32767 - -
Addresses: https://issues.redhat.com/browse/RHEL-30269 Signed-off-by: Karel Zak <kzak@redhat.com>