]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
21 months agoMerge branch 'libblkid/vxfs/cleanup' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 23 Oct 2023 10:47:19 +0000 (12:47 +0200)] 
Merge branch 'libblkid/vxfs/cleanup' of https://github.com/t-8ch/util-linux

* 'libblkid/vxfs/cleanup' of https://github.com/t-8ch/util-linux:
  libblkid: (vxfs) simplify prober
  libblkid: (superblocks) add helper blkid32_to_cpu()
  libblkid: (vxfs) use hex escape for magic
  libblkid: (vxfs) add test files

21 months agoMerge branch 'wdctl/sysfs' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 23 Oct 2023 10:37:19 +0000 (12:37 +0200)] 
Merge branch 'wdctl/sysfs' of https://github.com/t-8ch/util-linux

* 'wdctl/sysfs' of https://github.com/t-8ch/util-linux:
  wdctl: use only sysfs if sufficient

21 months agoMerge branch 'libmount/null-api' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 23 Oct 2023 10:35:57 +0000 (12:35 +0200)] 
Merge branch 'libmount/null-api' of https://github.com/t-8ch/util-linux

* 'libmount/null-api' of https://github.com/t-8ch/util-linux:
  libmount: guard against sysapi == NULL

21 months agoMerge branch 'PR/lscpu-caches-sep' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 23 Oct 2023 10:35:34 +0000 (12:35 +0200)] 
Merge branch 'PR/lscpu-caches-sep' of github.com:karelzak/util-linux-work

* 'PR/lscpu-caches-sep' of github.com:karelzak/util-linux-work:
  lscpu: fix caches separator for --parse=<list>

21 months agoMerge branch 'chfn_gecos' of https://github.com/mator/util-linux
Karel Zak [Mon, 23 Oct 2023 10:34:56 +0000 (12:34 +0200)] 
Merge branch 'chfn_gecos' of https://github.com/mator/util-linux

* 'chfn_gecos' of https://github.com/mator/util-linux:
  Use empty libuser config file.

21 months agoMerge branch 'topic-fix-fail-to-find-exfat-volume-label' of https://github.com/Yuezha...
Karel Zak [Mon, 23 Oct 2023 10:32:58 +0000 (12:32 +0200)] 
Merge branch 'topic-fix-fail-to-find-exfat-volume-label' of https://github.com/YuezhangMo/util-linux

* 'topic-fix-fail-to-find-exfat-volume-label' of https://github.com/YuezhangMo/util-linux:
  libblkid: exfat: fix fail to find volume label

21 months agoMerge branch 'misc/fixes' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 23 Oct 2023 10:29:50 +0000 (12:29 +0200)] 
Merge branch 'misc/fixes' of https://github.com/t-8ch/util-linux

* 'misc/fixes' of https://github.com/t-8ch/util-linux:
  meson: don't try to build test_ca without libcap-ng
  blkpr: store return value of getopt_long in int

21 months agoMerge branch 'meson/int-cmp' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 23 Oct 2023 10:28:26 +0000 (12:28 +0200)] 
Merge branch 'meson/int-cmp' of https://github.com/t-8ch/util-linux

* 'meson/int-cmp' of https://github.com/t-8ch/util-linux:
  meson: avoid int operation with non-int

21 months agoMerge branch 'path' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 23 Oct 2023 10:26:45 +0000 (12:26 +0200)] 
Merge branch 'path' of https://github.com/stoeckmann/util-linux

* 'path' of https://github.com/stoeckmann/util-linux:
  sys-utils/lscpu: Use ul_path_scanf where possible
  lib/path: Set errno in case of fgets failure
  lib/path: fix typos
  lib/path: remove ul_prefix_fopen
  lib/path: set errno in case of error
  lib/path: fix possible out of boundary access

21 months agoMerge branch 'login-simplify' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 23 Oct 2023 10:23:51 +0000 (12:23 +0200)] 
Merge branch 'login-simplify' of https://github.com/stoeckmann/util-linux

* 'login-simplify' of https://github.com/stoeckmann/util-linux:
  login: access login.noauth file directly
  login: use xasprintf

21 months agowdctl: use only sysfs if sufficient
Thomas Weißschuh [Fri, 13 Oct 2023 14:44:51 +0000 (16:44 +0200)] 
wdctl: use only sysfs if sufficient

Also avoid opening device if nowayout is set.

Opening the device node starts the watchdog.
With 'nowayout' enabled unstoppably.

Also the device node can only be opened once at the same time which can
be problematic.

Prefer to retrieve the information via sysfs which does not have such
problems.

Fixes #2543

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agolibblkid: (vxfs) simplify prober
Thomas Weißschuh [Sat, 14 Oct 2023 10:56:42 +0000 (12:56 +0200)] 
libblkid: (vxfs) simplify prober

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agolibblkid: (superblocks) add helper blkid32_to_cpu()
Thomas Weißschuh [Sat, 14 Oct 2023 10:56:04 +0000 (12:56 +0200)] 
libblkid: (superblocks) add helper blkid32_to_cpu()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agolibblkid: (vxfs) use hex escape for magic
Thomas Weißschuh [Sat, 14 Oct 2023 10:18:14 +0000 (12:18 +0200)] 
libblkid: (vxfs) use hex escape for magic

It's easier to read and more consistent.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agolibblkid: (vxfs) add test files
Thomas Weißschuh [Sat, 14 Oct 2023 10:14:42 +0000 (12:14 +0200)] 
libblkid: (vxfs) add test files

The test files have been constructed manually from the prober.
While not providing a real test at least they make sure that the
existing logic stays stable.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agolibmount: guard against sysapi == NULL
Thomas Weißschuh [Fri, 13 Oct 2023 08:17:16 +0000 (10:17 +0200)] 
libmount: guard against sysapi == NULL

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agolscpu: fix caches separator for --parse=<list>
Karel Zak [Thu, 12 Oct 2023 22:03:15 +0000 (00:03 +0200)] 
lscpu: fix caches separator for --parse=<list>

Fixes: https://github.com/util-linux/util-linux/issues/2544
Signed-off-by: Karel Zak <kzak@redhat.com>
21 months agoUse empty libuser config file.
Anatoly Pugachev [Thu, 12 Oct 2023 11:13:02 +0000 (14:13 +0300)] 
Use empty libuser config file.

In case of an absence /etc/libuser.conf, use empty file by pointing
LIBUSER_CONF to /dev/null. This allows chfn/gecos to pass without error.

PS: The "libuser" library is no longer maintained, and it was recommended
by the original author to not use it anymore.

21 months agomeson: don't try to build test_ca without libcap-ng
Thomas Weißschuh [Wed, 11 Oct 2023 14:35:45 +0000 (16:35 +0200)] 
meson: don't try to build test_ca without libcap-ng

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agolibblkid: exfat: fix fail to find volume label
Yuezhang Mo [Wed, 11 Oct 2023 10:42:11 +0000 (18:42 +0800)] 
libblkid: exfat: fix fail to find volume label

Commit f98b56326 set the maximum number of iterations to 10000.
If the volume label is after the 10000th entry, the volume label
will not be found. So this commit sets the maximum number of
iterations to correct value 256×1024×1024/32.

Fixes: f98b56326 ("libblkid: [exfat] Limit maximum number of iterations in find_label")
Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Andy Wu <Andy.Wu@sony.com>
Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
21 months agoblkpr: store return value of getopt_long in int
Thomas Weißschuh [Wed, 11 Oct 2023 05:20:43 +0000 (07:20 +0200)] 
blkpr: store return value of getopt_long in int

getopt_long returns an int. Don't try to store it in a char.

See #2538.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agosys-utils/lscpu: Use ul_path_scanf where possible
Tobias Stoeckmann [Tue, 10 Oct 2023 19:08:41 +0000 (21:08 +0200)] 
sys-utils/lscpu: Use ul_path_scanf where possible

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
21 months agolib/path: Set errno in case of fgets failure
Tobias Stoeckmann [Tue, 10 Oct 2023 19:00:48 +0000 (21:00 +0200)] 
lib/path: Set errno in case of fgets failure

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
21 months agologin: access login.noauth file directly
Tobias Stoeckmann [Sun, 8 Oct 2023 18:22:47 +0000 (20:22 +0200)] 
login: access login.noauth file directly

There is no need to scan a directory if we already know the filename
we are looking for.

While at it, close resources afterwards.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
21 months agologin: use xasprintf
Tobias Stoeckmann [Sun, 8 Oct 2023 18:21:04 +0000 (20:21 +0200)] 
login: use xasprintf

It is easier to use xasprintf than performing all its internals
explicitly in login's code base.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
21 months agoMerge branch 'libmount/errormsg' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 9 Oct 2023 11:04:07 +0000 (13:04 +0200)] 
Merge branch 'libmount/errormsg' of https://github.com/t-8ch/util-linux

* 'libmount/errormsg' of https://github.com/t-8ch/util-linux:
  libmount: report all kernel messages for fd-based mount API
  libmount: add helper to log mount messages as emitted by kernel
  libmount: change syscall status macros to be functions

21 months agoMerge branch 'lsfs--sockdiag-RW' of https://github.com/masatake/util-linux
Karel Zak [Mon, 9 Oct 2023 10:26:37 +0000 (12:26 +0200)] 
Merge branch 'lsfs--sockdiag-RW' of https://github.com/masatake/util-linux

* 'lsfs--sockdiag-RW' of https://github.com/masatake/util-linux:
  lsfd: (man) update the description of ENDPOINTS column of UNIX-Stream sockets
  tests: (lsfd) extend the mkfds-socketpair case to test ENDPOINTS with SOCK.SHUTDOWN info
  lsfd: append SOCK.SHUTDOWN value to ENDPOINTS column of UNIX-STREAM sockets
  tests: (lsfd) add a case for testing SOCK.SHUTDOWN column
  tests: (test_mkfds::socketpair) add "halfclose" parameter
  lsfd: don't capitalize the help strings for the columns
  lsfd: (man) write about SOCK.SHUTDOWN column
  lsfd: add SOCK.SHUTDOWN column
  lsfd: call xinfo backend method before calling socket generic method when filling columns
  tests: (lsfd) add a case for testing ENDPOINTS column of UNIX-STREAM sockets
  tests: (lsfd::mkfds-socketpair) make a case for testing DGRAM a subtest and add a subtest for STREAM
  lsfd: (man) document the ENDPOINT column for UNIX socket
  lsfd: fill ENDPOINTS column of unix socket using UNIX_DIAG_PEER information
  lsfd: make the sock_xinfo layer be able to prepare an ipc_class for a given socket
  lsfd: initialize the ipc table before loading lists of unix socket peers via netlink diag

21 months agoautotools: fix AC_DEFINE_UNQUOTED() use
Karel Zak [Mon, 9 Oct 2023 10:18:31 +0000 (12:18 +0200)] 
autotools: fix AC_DEFINE_UNQUOTED() use

Let's use AC_DEFINE_UNQUOTED() for string-like content, otherwise use
a simple AC_DEFINE().

Signed-off-by: Karel Zak <kzak@redhat.com>
21 months agoautotools: fix librtas check
Karel Zak [Mon, 9 Oct 2023 10:15:20 +0000 (12:15 +0200)] 
autotools: fix librtas check

Fixes: https://github.com/util-linux/util-linux/discussions/2527
Signed-off-by: Karel Zak <kzak@redhat.com>
21 months agolsfd: (man) update the description of ENDPOINTS column of UNIX-Stream sockets
Masatake YAMATO [Mon, 2 Oct 2023 14:56:47 +0000 (23:56 +0900)] 
lsfd: (man) update the description of ENDPOINTS column of UNIX-Stream sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agotests: (lsfd) extend the mkfds-socketpair case to test ENDPOINTS with SOCK.SHUTDOWN...
Masatake YAMATO [Mon, 2 Oct 2023 12:52:00 +0000 (21:52 +0900)] 
tests: (lsfd) extend the mkfds-socketpair case to test ENDPOINTS with SOCK.SHUTDOWN info

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agolsfd: append SOCK.SHUTDOWN value to ENDPOINTS column of UNIX-STREAM sockets
Masatake YAMATO [Mon, 2 Oct 2023 14:50:21 +0000 (23:50 +0900)] 
lsfd: append SOCK.SHUTDOWN value to ENDPOINTS column of UNIX-STREAM sockets

An example output:

   # ./lsfd -Q '((PID == 1) || (PID == 1896)) && (TYPE == "UNIX-STREAM") && ((FD == 1) || (FD == 278))' -o+ENDPOINTS
   COMMAND        PID USER ASSOC  XMODE        TYPE SOURCE MNTID INODE NAME                                             ENDPOINTS
   systemd          1 root   278 rw---m UNIX-STREAM sockfs     9 37012 state=connected path=/run/systemd/journal/stdout 1896,ModemManager,1-w
   ModemManager  1896 root     1 rw---- UNIX-STREAM sockfs     9 43126 state=connected                                  1,systemd,278r-
                                                                                                                        1870458,systemd-journal,68r-

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agotests: (lsfd) add a case for testing SOCK.SHUTDOWN column
Masatake YAMATO [Mon, 2 Oct 2023 14:35:46 +0000 (23:35 +0900)] 
tests: (lsfd) add a case for testing SOCK.SHUTDOWN column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agotests: (test_mkfds::socketpair) add "halfclose" parameter
Masatake YAMATO [Mon, 2 Oct 2023 12:44:13 +0000 (21:44 +0900)] 
tests: (test_mkfds::socketpair) add "halfclose" parameter

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agolsfd: don't capitalize the help strings for the columns
Masatake YAMATO [Mon, 2 Oct 2023 14:19:51 +0000 (23:19 +0900)] 
lsfd: don't capitalize the help strings for the columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agolsfd: (man) write about SOCK.SHUTDOWN column
Masatake YAMATO [Mon, 2 Oct 2023 14:15:59 +0000 (23:15 +0900)] 
lsfd: (man) write about SOCK.SHUTDOWN column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agolsfd: add SOCK.SHUTDOWN column
Masatake YAMATO [Mon, 2 Oct 2023 14:03:06 +0000 (23:03 +0900)] 
lsfd: add SOCK.SHUTDOWN column

An example output:

   # ./lsfd -p1 -Q '(TYPE == "UNIX-STREAM")' -o+SOCK.SHUTDOWN
   systemd   1 root   443 rw---m UNIX-STREAM sockfs     9 183103884 state=connected path=/run/systemd/journal/stdout r-
   systemd   1 root   462 rw---- UNIX-STREAM sockfs     9  11172039 state=listen path=/run/libvirt/libvirt-sock      rw

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agolsfd: call xinfo backend method before calling socket generic method when filling...
Masatake YAMATO [Mon, 2 Oct 2023 14:00:41 +0000 (23:00 +0900)] 
lsfd: call xinfo backend method before calling socket generic method when filling columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agotests: (lsfd) add a case for testing ENDPOINTS column of UNIX-STREAM sockets
Masatake YAMATO [Thu, 3 Aug 2023 16:29:53 +0000 (01:29 +0900)] 
tests: (lsfd) add a case for testing ENDPOINTS column of UNIX-STREAM sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agotests: (lsfd::mkfds-socketpair) make a case for testing DGRAM a subtest and add a...
Masatake YAMATO [Mon, 9 Oct 2023 06:29:40 +0000 (15:29 +0900)] 
tests: (lsfd::mkfds-socketpair) make a case for testing DGRAM a subtest and add a subtest for STREAM

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
21 months agomeson: avoid int operation with non-int
Thomas Weißschuh [Mon, 9 Oct 2023 05:34:46 +0000 (07:34 +0200)] 
meson: avoid int operation with non-int

`conf` as configuration_data() object can contain any datatype.
For `HAVE_FOO` variables this will be a `1` int to generate
`#define HAVE_FOO 1` or a `false` bool to generate `#undef HAVE_FOO`
in `conf.h`.

When retrieving and testing `HAVE_FOO` from `conf` it can be both types.
Newer versions of meson are unhappy about comparisions of int with
non-int

    ../meson.build:734: DEPRECATION: Project uses feature that was always broken, and is now deprecated since '1.2.0': int operations with non-int. It is not commutative and only worked because of leaky Python abstractions.

    WARNING: Broken features used:
     * 1.2.0: {'int operations with non-int'}

As both `int` and `bool` support a `.to_string()` method, we can use
that to convert them into a well-known type and compare that.

Unfortunately meson does not implement a way to determine the type of a
value.
A method `int.to_int()` would also have worked but does not exist.

This broken feature was actually first recognized in util-linux.
See #2312 and https://github.com/mesonbuild/meson/pull/11879.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
21 months agolib/path: fix typos
Tobias Stoeckmann [Sun, 8 Oct 2023 18:51:07 +0000 (20:51 +0200)] 
lib/path: fix typos

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
21 months agolib/path: remove ul_prefix_fopen
Tobias Stoeckmann [Sun, 8 Oct 2023 18:49:31 +0000 (20:49 +0200)] 
lib/path: remove ul_prefix_fopen

The function ul_prefix_fopen does not properly check for paths which are
too long. Since the only caller of ul_prefix_fopen can be easily
converted to ul_path_fopen, remove the function.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
21 months agolib/path: set errno in case of error
Tobias Stoeckmann [Sun, 8 Oct 2023 18:47:53 +0000 (20:47 +0200)] 
lib/path: set errno in case of error

Some programs like lscpu expect errno to be set if ul_path_cpuparse
fails.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
21 months agolib/path: fix possible out of boundary access
Tobias Stoeckmann [Sun, 8 Oct 2023 18:41:29 +0000 (20:41 +0200)] 
lib/path: fix possible out of boundary access

If fgets reads from a file starting with a NUL byte in ul_path_cpuparse,
then the check for newline leads to an out of boundary access.

Proof of Concept (compile with --enable-asan):

1. Prepare /tmp/poc with required files
```
$ install -d /tmp/poc/sys/devices/system/cpu
$ dd if=/dev/zero of=/tmp/poc/sys/devices/system/cpu/possible bs=1 count=1
$ install -D /dev/null /tmp/poc/proc/cpuinfo
```

2. Run lscpu with sysroot option
```
$ lscpu --sysroot /tmp/poc
=================================================================
==78238==ERROR: AddressSanitizer: heap-buffer-overflow
```

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
22 months agolibmount: report all kernel messages for fd-based mount API
Thomas Weißschuh [Thu, 5 Oct 2023 11:21:23 +0000 (13:21 +0200)] 
libmount: report all kernel messages for fd-based mount API

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibmount: add helper to log mount messages as emitted by kernel
Thomas Weißschuh [Thu, 5 Oct 2023 11:19:14 +0000 (13:19 +0200)] 
libmount: add helper to log mount messages as emitted by kernel

The kernel helpfully provides feedback about failed operations via the
filesystem descriptor. Read that information and expose it via libmounts
debug facilities.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibmount: change syscall status macros to be functions
Thomas Weißschuh [Thu, 5 Oct 2023 11:18:15 +0000 (13:18 +0200)] 
libmount: change syscall status macros to be functions

Functions are easier to modify and reason about.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoMerge branch 'libblkid/align' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 4 Oct 2023 18:08:06 +0000 (20:08 +0200)] 
Merge branch 'libblkid/align' of https://github.com/t-8ch/util-linux

* 'libblkid/align' of https://github.com/t-8ch/util-linux:
  libblkid: (probe) remove chunking from blkid_probe_get_idmag()
  libblkid: (probe) read data in chunks
  swapon: (tests) abort test on failing commands
  libblkid: reset errno before calling probefuncs
  libfdisk: reset errno before calling read()

22 months agolibblkid: (probe) remove chunking from blkid_probe_get_idmag()
Thomas Weißschuh [Sun, 1 Oct 2023 12:24:04 +0000 (14:24 +0200)] 
libblkid: (probe) remove chunking from blkid_probe_get_idmag()

blkid_probe_get_buffer is doing the same thing internally now.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (probe) read data in chunks
Thomas Weißschuh [Sat, 30 Sep 2023 21:59:44 +0000 (23:59 +0200)] 
libblkid: (probe) read data in chunks

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoMerge branch 'libmount/tab-uaf' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 4 Oct 2023 18:03:02 +0000 (20:03 +0200)] 
Merge branch 'libmount/tab-uaf' of https://github.com/t-8ch/util-linux

* 'libmount/tab-uaf' of https://github.com/t-8ch/util-linux:
  Revert "libmount: (tab) avoid leaking memory allocated in loop"

22 months agoMerge branch 'setpriv/completion' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 4 Oct 2023 17:57:21 +0000 (19:57 +0200)] 
Merge branch 'setpriv/completion' of https://github.com/t-8ch/util-linux

* 'setpriv/completion' of https://github.com/t-8ch/util-linux:
  setpriv: fix group argument completion

22 months agoMerge branch 'libfdisk/errno' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 4 Oct 2023 17:56:39 +0000 (19:56 +0200)] 
Merge branch 'libfdisk/errno' of https://github.com/t-8ch/util-linux

* 'libfdisk/errno' of https://github.com/t-8ch/util-linux:
  libfdisk: reset errno before calling read()

22 months agoMerge branch 'ci/musl' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 4 Oct 2023 17:35:26 +0000 (19:35 +0200)] 
Merge branch 'ci/musl' of https://github.com/t-8ch/util-linux

* 'ci/musl' of https://github.com/t-8ch/util-linux:
  ci: run full testsuite under musl libc
  build-sys: only build col on glibc
  lib/timeutils: don't use glibc strptime extension

22 months agoRevert "libmount: (tab) avoid leaking memory allocated in loop"
Thomas Weißschuh [Wed, 4 Oct 2023 15:21:47 +0000 (17:21 +0200)] 
Revert "libmount: (tab) avoid leaking memory allocated in loop"

coverity claims that this is now a use-after-free.
Let's revert the original change and make the code clearer before trying
another fix.

This reverts commit d36306a560fd6d747e18ab22fc1279f4a373f43d.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoswapon: (tests) abort test on failing commands
Thomas Weißschuh [Mon, 2 Oct 2023 16:17:01 +0000 (18:17 +0200)] 
swapon: (tests) abort test on failing commands

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: reset errno before calling probefuncs
Thomas Weißschuh [Mon, 2 Oct 2023 20:24:21 +0000 (22:24 +0200)] 
libblkid: reset errno before calling probefuncs

The probers optionally use errno to communicate error details.
When a leftover errno is set from libblkid internally this can confuse
the probers.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolsfd: (man) document the ENDPOINT column for UNIX socket
Masatake YAMATO [Mon, 2 Oct 2023 12:07:02 +0000 (21:07 +0900)] 
lsfd: (man) document the ENDPOINT column for UNIX socket

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolsfd: fill ENDPOINTS column of unix socket using UNIX_DIAG_PEER information
Masatake YAMATO [Thu, 3 Aug 2023 16:10:58 +0000 (01:10 +0900)] 
lsfd: fill ENDPOINTS column of unix socket using UNIX_DIAG_PEER information

An example output:

   # ./lsfd -Q '((PID == 1) || (PID == 1896)) && (TYPE == "UNIX-STREAM") && ((FD == 1) || (FD == 278))' -o+ENDPOINTS
   COMMAND        PID USER ASSOC  XMODE        TYPE SOURCE MNTID INODE NAME                                             ENDPOINTS
   systemd          1 root   278 rw---m UNIX-STREAM sockfs     9 37012 state=connected path=/run/systemd/journal/stdout 1896,ModemManager,1
   ModemManager  1896 root     1 rw---- UNIX-STREAM sockfs     9 43126 state=connected                                  1,systemd,278
                                                                                                                        1870458,systemd-journal,68

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agosetpriv: fix group argument completion
Thomas Weißschuh [Mon, 2 Oct 2023 13:52:33 +0000 (15:52 +0200)] 
setpriv: fix group argument completion

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolsfd: make the sock_xinfo layer be able to prepare an ipc_class for a given socket
Masatake YAMATO [Thu, 3 Aug 2023 15:51:49 +0000 (00:51 +0900)] 
lsfd: make the sock_xinfo layer be able to prepare an ipc_class for a given socket

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolsfd: initialize the ipc table before loading lists of unix socket peers via netlink...
Masatake YAMATO [Sun, 23 Jul 2023 07:35:20 +0000 (16:35 +0900)] 
lsfd: initialize the ipc table before loading lists of unix socket peers via netlink diag

Loading the lists is done in initialize_classes().

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolibfdisk: reset errno before calling read()
Thomas Weißschuh [Mon, 2 Oct 2023 11:01:47 +0000 (13:01 +0200)] 
libfdisk: reset errno before calling read()

The else branch will be executed on short reads.
For those errno is not reset so a random left-over errno value may be
checked.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibfdisk: reset errno before calling read()
Thomas Weißschuh [Mon, 2 Oct 2023 11:01:47 +0000 (13:01 +0200)] 
libfdisk: reset errno before calling read()

The else branch will be executed on short reads.
For those errno is not reset so a random left-over errno value may be
checked.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoMerge branch 'blkid/exclusive-opts' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Oct 2023 10:42:11 +0000 (12:42 +0200)] 
Merge branch 'blkid/exclusive-opts' of https://github.com/t-8ch/util-linux

* 'blkid/exclusive-opts' of https://github.com/t-8ch/util-linux:
  blkid: fix call to err_exclusive_options

22 months agoMerge branch 'https-everywhere' of https://github.com/jwilk-forks/util-linux
Karel Zak [Mon, 2 Oct 2023 10:41:51 +0000 (12:41 +0200)] 
Merge branch 'https-everywhere' of https://github.com/jwilk-forks/util-linux

* 'https-everywhere' of https://github.com/jwilk-forks/util-linux:
  docs: use HTTPS for GitHub clone URLs

22 months agoMerge branch 'libblkid/lvm-small-device' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Oct 2023 10:41:17 +0000 (12:41 +0200)] 
Merge branch 'libblkid/lvm-small-device' of https://github.com/t-8ch/util-linux

* 'libblkid/lvm-small-device' of https://github.com/t-8ch/util-linux:
  libblkid: (lvm2) read complete superblock

22 months agoMerge branch 'libblkid/drbd-simplify' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Oct 2023 10:40:55 +0000 (12:40 +0200)] 
Merge branch 'libblkid/drbd-simplify' of https://github.com/t-8ch/util-linux

* 'libblkid/drbd-simplify' of https://github.com/t-8ch/util-linux:
  libblkid: (drbd) avoid unaligned accesses
  include/c.h: add helpers for unaligned structure access
  libblkid: (drbd) use magics
  libblkid: (probe) allow superblock offset from end of device
  libblkid: (cramfs) use magic hint
  libblkid: (probe) add magic hint
  libblkid: (drbd) validate size in standard minsz predicate
  libblkid: (via_raid) validate size in standard minsz predicate
  libblkid: (silicon_raid) validate size in standard minsz predicate
  libblkid: (promise_raid) validate size in standard minsz predicate
  libblkid: (nvidia_raid) validate size in standard minsz predicate
  libblkid: (lsi_raid) validate size in standard minsz predicate
  libblkid: (jmicron_raid) validate size in standard minsz predicate
  libblkid: (isw_raid) validate size in standard minsz predicate
  libblkid: (highpoint_raid) validate size in standard minsz predicate
  libblkid: (ddf_raid) validate size in standard minsz predicate
  libblkid: (adapted_raid) validate size in standard minsz predicate
  libblkid: (probe) remove duplicate log

22 months agoMerge branch 'analyzer2' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Oct 2023 10:40:38 +0000 (12:40 +0200)] 
Merge branch 'analyzer2' of https://github.com/t-8ch/util-linux

* 'analyzer2' of https://github.com/t-8ch/util-linux:
  libblkid: (probe) handle probe without chain gracefully
  libsmartcols: (cell) consistently handle NULL argument
  lib/idcache: always gracefully handle null cache
  script-playutils: close filestream in case ignore_line() fails
  lib/colors: correct documentation of colors_add_scheme()
  treewide: use reallocarray to allocated memory that will be reallocated

22 months agoMerge branch 'libmount/tab-leak' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 2 Oct 2023 10:37:52 +0000 (12:37 +0200)] 
Merge branch 'libmount/tab-leak' of https://github.com/t-8ch/util-linux

* 'libmount/tab-leak' of https://github.com/t-8ch/util-linux:
  libmount: (tab) avoid leaking memory allocated in loop

22 months agoMerge branch 'lsfd--bpf-name#in-flight' of https://github.com/masatake/util-linux
Karel Zak [Mon, 2 Oct 2023 10:37:30 +0000 (12:37 +0200)] 
Merge branch 'lsfd--bpf-name#in-flight' of https://github.com/masatake/util-linux

* 'lsfd--bpf-name#in-flight' of https://github.com/masatake/util-linux:
  tests: (lsfd) extend the cases for testing BPF.NAME column
  lsfd.1.adoc: document BPF.NAME column
  lsfd: add BPF.NAME column
  lsfd: add xstrfappend and xstrvfappend
  lib/strutils: add strfappend and strvfappend
  tests: (test_mkfds::{bpf-prog,bpf-map}) fix memory leaks
  tests: (test_mkfds) add missing PARAM_END marker
  tests: (test_mkfds) use SYS_bpf instead of __NR_bpf
  tests: (test_mkfds) revise the usage of " __attribute__((__unused__))"
  tests: (lsfd::mkfds-bpf-map) chmod a+x

22 months agolsblk: improve --tree description
Karel Zak [Mon, 2 Oct 2023 09:51:56 +0000 (11:51 +0200)] 
lsblk: improve --tree description

Addresses: https://github.com/util-linux/util-linux/issues/2516
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoblkid: fix call to err_exclusive_options
Thomas Weißschuh [Mon, 2 Oct 2023 09:39:53 +0000 (11:39 +0200)] 
blkid: fix call to err_exclusive_options

err_exclusive_options needs to be passed the long options array,
otherwise it will crash.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agodocs: use HTTPS for GitHub clone URLs
Jakub Wilk [Mon, 2 Oct 2023 05:22:54 +0000 (07:22 +0200)] 
docs: use HTTPS for GitHub clone URLs

GitHub has dropped support for the git:// protocol:
https://github.blog/changelog/2022-03-15-removed-unencrypted-git-protocol-and-certain-ssh-keys/

22 months agolibmount: (tab) avoid leaking memory allocated in loop
Thomas Weißschuh [Wed, 27 Sep 2023 18:37:22 +0000 (20:37 +0200)] 
libmount: (tab) avoid leaking memory allocated in loop

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (lvm2) read complete superblock
Thomas Weißschuh [Sun, 1 Oct 2023 09:48:01 +0000 (11:48 +0200)] 
libblkid: (lvm2) read complete superblock

The lvm2_calc_crc() will create a checksum over LVM2_LABEL_SIZE bytes,
which all need to be read.

Currently this works because the superblock is cached by
blkid_probe_get_idmag() which always reads 1024 bytes.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (drbd) avoid unaligned accesses
Thomas Weißschuh [Sun, 1 Oct 2023 11:57:43 +0000 (13:57 +0200)] 
libblkid: (drbd) avoid unaligned accesses

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoinclude/c.h: add helpers for unaligned structure access
Thomas Weißschuh [Sun, 1 Oct 2023 11:57:12 +0000 (13:57 +0200)] 
include/c.h: add helpers for unaligned structure access

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (drbd) use magics
Thomas Weißschuh [Sat, 30 Sep 2023 21:58:05 +0000 (23:58 +0200)] 
libblkid: (drbd) use magics

Reuse more of the standard prober functionality.
This also avoids a potential unaligned access when comparing the
superblock magic as a number.
In case the superblock was already cached by a different loader the
return address may have been unaligned leading to undefined behavior.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (probe) allow superblock offset from end of device
Thomas Weißschuh [Sat, 30 Sep 2023 21:56:46 +0000 (23:56 +0200)] 
libblkid: (probe) allow superblock offset from end of device

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (cramfs) use magic hint
Thomas Weißschuh [Sun, 1 Oct 2023 08:29:48 +0000 (10:29 +0200)] 
libblkid: (cramfs) use magic hint

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (probe) add magic hint
Thomas Weißschuh [Sat, 30 Sep 2023 21:55:31 +0000 (23:55 +0200)] 
libblkid: (probe) add magic hint

This hint can be used by the probing callback to make decision based on
the matched magic. This avoids a awkward memcmp() on the magic string.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (drbd) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 21:21:33 +0000 (23:21 +0200)] 
libblkid: (drbd) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (via_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:08:40 +0000 (00:08 +0200)] 
libblkid: (via_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (silicon_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:08:31 +0000 (00:08 +0200)] 
libblkid: (silicon_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (promise_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:08:23 +0000 (00:08 +0200)] 
libblkid: (promise_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (nvidia_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:08:12 +0000 (00:08 +0200)] 
libblkid: (nvidia_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (lsi_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:08:06 +0000 (00:08 +0200)] 
libblkid: (lsi_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (jmicron_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:07:59 +0000 (00:07 +0200)] 
libblkid: (jmicron_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (isw_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:07:22 +0000 (00:07 +0200)] 
libblkid: (isw_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (highpoint_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:07:13 +0000 (00:07 +0200)] 
libblkid: (highpoint_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (ddf_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:07:02 +0000 (00:07 +0200)] 
libblkid: (ddf_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (adapted_raid) validate size in standard minsz predicate
Thomas Weißschuh [Sat, 30 Sep 2023 22:06:53 +0000 (00:06 +0200)] 
libblkid: (adapted_raid) validate size in standard minsz predicate

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (probe) remove duplicate log
Thomas Weißschuh [Sat, 30 Sep 2023 21:05:21 +0000 (23:05 +0200)] 
libblkid: (probe) remove duplicate log

remove_buffer() already emits the same message.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agotests: (lsfd) extend the cases for testing BPF.NAME column
Masatake YAMATO [Tue, 26 Sep 2023 16:15:21 +0000 (01:15 +0900)] 
tests: (lsfd) extend the cases for testing BPF.NAME column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolsfd.1.adoc: document BPF.NAME column
Masatake YAMATO [Tue, 26 Sep 2023 15:51:26 +0000 (00:51 +0900)] 
lsfd.1.adoc: document BPF.NAME column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolsfd: add BPF.NAME column
Masatake YAMATO [Tue, 26 Sep 2023 16:12:16 +0000 (01:12 +0900)] 
lsfd: add BPF.NAME column

An example output:

  $ sudo  ./lsfd -oCOMMAND,PID,ASSOC,TYPE,BPF.NAME,NAME -Q '(TYPE =~ "bpf-*")' -p 1
  COMMAND PID ASSOC     TYPE        BPF.NAME NAME
  systemd   1     9 bpf_link                 anon_inode:bpf_link
  systemd   1    13  bpf-map     cgroup_hash id=391 type=hash-of-maps name=cgroup_hash
  systemd   1    14 bpf-prog restrict_filesy id=8210 type=lsm name=restrict_filesy
  systemd   1    28 bpf-prog      sd_devices id=8298 type=cgroup_device name=sd_devices
  systemd   1    29 bpf-prog      sd_devices id=8299 type=cgroup_device name=sd_devices
  systemd   1    30 bpf-prog      sd_devices id=8300 type=cgroup_device name=sd_devices
  ...

Using memset was suggested by Thomas Weißschuh
<thomas@t-8ch.de>.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolsfd: add xstrfappend and xstrvfappend
Masatake YAMATO [Fri, 29 Sep 2023 20:26:48 +0000 (05:26 +0900)] 
lsfd: add xstrfappend and xstrvfappend

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolib/strutils: add strfappend and strvfappend
Masatake YAMATO [Fri, 29 Sep 2023 20:21:40 +0000 (05:21 +0900)] 
lib/strutils: add strfappend and strvfappend

Signed-off-by: Masatake YAMATO <yamato@redhat.com>