]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
22 months agoMerge branch 'analyzer1' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 25 Sep 2023 10:32:25 +0000 (12:32 +0200)] 
Merge branch 'analyzer1' of https://github.com/t-8ch/util-linux

* 'analyzer1' of https://github.com/t-8ch/util-linux:
  libsmartcols: handle nameless tables in export format
  ldattach: don't call exit() from signal handler
  lslogins: fix realloc() loop allocation size
  more: avoid out-of-bound access
  libfdisk: handle allocation failure in fdisk_new_partition
  lib/env: fix function name remote_entry -> remove_entry
  libmount: gracefully handle NULL path in mnt_resolve_target()
  libblkid: avoid memory leak of cachefile path
  lib/env: avoid underflow of read_all_alloc() return value

22 months agoMerge branch 'realloc' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 25 Sep 2023 10:30:37 +0000 (12:30 +0200)] 
Merge branch 'realloc' of https://github.com/t-8ch/util-linux

* 'realloc' of https://github.com/t-8ch/util-linux:
  treewide: use (x)reallocarray() when applicable

22 months agoMerge branch 'ci/clang-17' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 25 Sep 2023 10:29:38 +0000 (12:29 +0200)] 
Merge branch 'ci/clang-17' of https://github.com/t-8ch/util-linux

* 'ci/clang-17' of https://github.com/t-8ch/util-linux:
  ci: build with clang 17

22 months agoMerge branch 'login-comment' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 25 Sep 2023 10:28:07 +0000 (12:28 +0200)] 
Merge branch 'login-comment' of https://github.com/stoeckmann/util-linux

* 'login-comment' of https://github.com/stoeckmann/util-linux:
  login: Use pid_t for child_pid
  login: move comment

22 months agoMerge branch 'lsfd--resolve-mqueue-nodev' of https://github.com/masatake/util-linux
Karel Zak [Mon, 25 Sep 2023 10:22:54 +0000 (12:22 +0200)] 
Merge branch 'lsfd--resolve-mqueue-nodev' of https://github.com/masatake/util-linux

* 'lsfd--resolve-mqueue-nodev' of https://github.com/masatake/util-linux:
  lsfd: collect the device number for mqueue fs in the initialization stage
  tests: (lsfd) show the entry for mqueue in /proc/self/mountinfo

22 months agolibsmartcols: handle nameless tables in export format
Thomas Weißschuh [Fri, 22 Sep 2023 09:20:36 +0000 (11:20 +0200)] 
libsmartcols: handle nameless tables in export format

fputs(NULL) is not allowed.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoldattach: don't call exit() from signal handler
Thomas Weißschuh [Fri, 22 Sep 2023 18:21:38 +0000 (20:21 +0200)] 
ldattach: don't call exit() from signal handler

Instead use _exit().

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolslogins: fix realloc() loop allocation size
Thomas Weißschuh [Fri, 22 Sep 2023 18:08:22 +0000 (20:08 +0200)] 
lslogins: fix realloc() loop allocation size

If stat() fails the realloc loop would always try to allocate zero
bytes.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agomore: avoid out-of-bound access
Thomas Weißschuh [Fri, 22 Sep 2023 17:53:24 +0000 (19:53 +0200)] 
more: avoid out-of-bound access

The realloc() needs to happen before that memory is used.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibfdisk: handle allocation failure in fdisk_new_partition
Thomas Weißschuh [Fri, 22 Sep 2023 17:35:01 +0000 (19:35 +0200)] 
libfdisk: handle allocation failure in fdisk_new_partition

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolib/env: fix function name remote_entry -> remove_entry
Thomas Weißschuh [Fri, 22 Sep 2023 17:34:03 +0000 (19:34 +0200)] 
lib/env: fix function name remote_entry -> remove_entry

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibmount: gracefully handle NULL path in mnt_resolve_target()
Thomas Weißschuh [Fri, 22 Sep 2023 09:30:57 +0000 (11:30 +0200)] 
libmount: gracefully handle NULL path in mnt_resolve_target()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: avoid memory leak of cachefile path
Thomas Weißschuh [Fri, 22 Sep 2023 09:20:04 +0000 (11:20 +0200)] 
libblkid: avoid memory leak of cachefile path

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolib/env: avoid underflow of read_all_alloc() return value
Thomas Weißschuh [Fri, 22 Sep 2023 09:19:37 +0000 (11:19 +0200)] 
lib/env: avoid underflow of read_all_alloc() return value

read_all_alloc() returns a negative error on failure.
When casting this to an unsigned type the failure check "< 1"
will not work.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agotreewide: use (x)reallocarray() when applicable
Thomas Weißschuh [Fri, 22 Sep 2023 09:56:42 +0000 (11:56 +0200)] 
treewide: use (x)reallocarray() when applicable

reallocarray() prevents overflow of the multiplication.
It also avoids issues with operator precedence like in libmount/src/context.c:

    pids = realloc(cxt->children, sizeof(pid_t) * cxt->nchildren + 1);

This only allocated one additional byte, and not enough space for
another child.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoci: build with clang 17
Thomas Weißschuh [Wed, 20 Sep 2023 21:31:04 +0000 (23:31 +0200)] 
ci: build with clang 17

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agologin: Use pid_t for child_pid
Tobias Stoeckmann [Tue, 19 Sep 2023 18:45:40 +0000 (20:45 +0200)] 
login: Use pid_t for child_pid

Since child_pid keeps track of a PID, it should be of type pid_t
and not of type int.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
22 months agologin: move comment
Tobias Stoeckmann [Tue, 19 Sep 2023 18:42:03 +0000 (20:42 +0200)] 
login: move comment

In 0b4d75fae55b4a5ff8f65df8551c56cf1eeb9b08 the variable "timeout" has
been moved from global to local scope, but its comment was not.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
22 months agotest: (lsfd) add a case for testing BPF-MAP.TYPE and BPF-MAP.TYPE.RAW columns
Masatake YAMATO [Wed, 19 Jul 2023 06:38:55 +0000 (15:38 +0900)] 
test: (lsfd) add a case for testing BPF-MAP.TYPE and BPF-MAP.TYPE.RAW columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotest: (mkfds::bpf-map) new factory
Masatake YAMATO [Wed, 19 Jul 2023 06:27:07 +0000 (15:27 +0900)] 
test: (mkfds::bpf-map) new factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolsfd: add BPF-MAP.TYPE, BPF-MAP.TYPE.RAW, and BPF-MAP.ID columns
Masatake YAMATO [Tue, 11 Jul 2023 13:12:05 +0000 (22:12 +0900)] 
lsfd: add BPF-MAP.TYPE, BPF-MAP.TYPE.RAW, and BPF-MAP.ID columns

Based on these new columns, the NAME column for "bpf-map" is enhanced.

An example output:

  # ./lsfd -p 1 -Q '(TYPE == "bpf-map")' | head
  COMMAND PID USER ASSOC  XMODE    TYPE       SOURCE MNTID INODE NAME
  systemd   1 root    13 rw---- bpf-map anon_inodefs    15   106 id=305 type=hash-of-maps

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolsfd: (man) add bps(8) and ss(8) to the "SEE ALSO" section
Masatake YAMATO [Sat, 16 Sep 2023 21:33:13 +0000 (06:33 +0900)] 
lsfd: (man) add bps(8) and ss(8) to the "SEE ALSO" section

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agobuild-sys: fix libmount/src/hooks.c use
Karel Zak [Mon, 18 Sep 2023 11:08:57 +0000 (13:08 +0200)] 
build-sys: fix libmount/src/hooks.c use

Reported-by: Samuel Thibault <samuel.thibault@aquilenet.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoautotools: fix non-Linux build
Karel Zak [Mon, 18 Sep 2023 10:59:30 +0000 (12:59 +0200)] 
autotools: fix non-Linux build

Signed-off-by: Karel Zak <kzak@redhat.com>
Co-Author: Samuel Thibault <samuel.thibault@aquilenet.fr>

22 months agoMerge branch 'lsfd--monitor-flag-for-poll-syscall' of https://github.com/masatake...
Karel Zak [Mon, 18 Sep 2023 10:10:01 +0000 (12:10 +0200)] 
Merge branch 'lsfd--monitor-flag-for-poll-syscall' of https://github.com/masatake/util-linux

* 'lsfd--monitor-flag-for-poll-syscall' of https://github.com/masatake/util-linux:
  tests: (test_mkfds::mkfds-multiplexing) make the output of ts_skip_subtest visible
  tests: (test_mkfds::mkfds-multiplexing) dump /proc/$pid/syscall for debugging
  lsfd: (man) write about XMODE.m and classical system calls for multiplexing
  tests: (lsfd) add a case testing XMODE.m for classical syscalls for multiplexing
  tests: (test_mkfds) add ppoll multiplexer
  tests: (test_mkfds) add poll multiplexer
  tests: (test_mkfds) add pselect6 and select multiplexers
  tests: (test_mkfds) add a new factory "multiplexing"
  tests: (test_mkfds) allow to add factory-made fds to the multiplexer as event source
  tests: (test_mkfds, refactor) make the function for waiting events plugable
  tests: (test_mkfds) include locale headers first to define _GNU_SOURCE
  tests: (test_mkfds) use err() when a system call fails
  lsfd: (comment) fix a typo
  lsfd: mark XMODE.m on fds monitored by select(2) and pselect6(2)
  lsfd: mark XMODE.m on fds monitored by poll(2) and ppoll(2)
  lsfd: cache the result of checking whether "XMODE" column is enabled or not
  procfs: add a helper function to access /proc/$pid/syscall
  lsfd: (refactor) make the code for traversing threads reusable

22 months agoMerge branch 'kraj/lscpu' of https://github.com/kraj/util-linux
Karel Zak [Mon, 18 Sep 2023 09:23:18 +0000 (11:23 +0200)] 
Merge branch 'kraj/lscpu' of https://github.com/kraj/util-linux

* 'kraj/lscpu' of https://github.com/kraj/util-linux:
  lscpu: Use 4K buffer size instead of BUFSIZ

22 months agolsfd: collect the device number for mqueue fs in the initialization stage
Masatake YAMATO [Mon, 18 Sep 2023 06:39:39 +0000 (15:39 +0900)] 
lsfd: collect the device number for mqueue fs in the initialization stage

Though lsfd reads device minor numbers for file-systems having "nodev"
from /proc/$pid/mountinfo, we observed lsfd failed to resolve the
values of SOURCE column for mqueue files on s390 CI/CD env. It seems
that /proc/$pid/mountinfo doesn't provide enough information.

This change makes lsfd open a mqueue file in lsfd's initialization
stage as a new data source for resolving; lsfd can collect an
actually-used minor number from the file descriptor with fstat(2).

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agoMerge branch 'vla-alloca' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 18 Sep 2023 09:14:38 +0000 (11:14 +0200)] 
Merge branch 'vla-alloca' of https://github.com/t-8ch/util-linux

* 'vla-alloca' of https://github.com/t-8ch/util-linux:
  buildsys: warn on usage of alloca()
  more: remove usage of alloca()
  buildsys: warn on usage of VLAs
  lib/mbsedit: remove usage of VLA
  lscpu: remove usage of VLA
  fdisk: remove usage of VLA
  libfdisk: (dos) remove usage of VLA
  libblkid: (stratis) remove usage of VLA
  lib/path: remove usage of VLA

22 months agotests: (lsfd) show the entry for mqueue in /proc/self/mountinfo
Masatake YAMATO [Sun, 17 Sep 2023 23:28:25 +0000 (08:28 +0900)] 
tests: (lsfd) show the entry for mqueue in /proc/self/mountinfo

The entry is useful debugging the lsfd and the test case for mqueue.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agoMerge branch 'tests/caps' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 18 Sep 2023 09:11:33 +0000 (11:11 +0200)] 
Merge branch 'tests/caps' of https://github.com/t-8ch/util-linux

* 'tests/caps' of https://github.com/t-8ch/util-linux:
  tests: fix capability testing

22 months agoMerge branch 'master' of https://github.com/gjioui/util-linux
Karel Zak [Mon, 18 Sep 2023 09:08:51 +0000 (11:08 +0200)] 
Merge branch 'master' of https://github.com/gjioui/util-linux

* 'master' of https://github.com/gjioui/util-linux:
  Add Phytium FTC862 cpu model. fix:#2486

22 months agoMerge branch 'PR/scriptreplay-flow'
Karel Zak [Mon, 18 Sep 2023 09:08:26 +0000 (11:08 +0200)] 
Merge branch 'PR/scriptreplay-flow'

22 months agolscpu: Use 4K buffer size instead of BUFSIZ
Khem Raj [Fri, 15 Sep 2023 07:18:18 +0000 (00:18 -0700)] 
lscpu: Use 4K buffer size instead of BUFSIZ

Some lines in /proc/cpuinfo can be large e.g. flags and can then
truncate them in displaying them

BUFSIZ can vary quite a bit  e.g. glibc/linux systems its 8192
but on musl/linux and OSX its 1024, on mingW it is 256, some tests e.g.
x86_64-64cpu-linux6.2.tar.gz has added really long line for cpu flags
line which is greater than 1024 characters and hence this test fails
on musl because lscpu -s reports truncated string

Fixes x86_64-64cpu-linux6.2 tests

Signed-off-by: Khem Raj <raj.khem@gmail.com>
s

22 months agobuildsys: warn on usage of alloca()
Thomas Weißschuh [Wed, 13 Sep 2023 04:32:52 +0000 (06:32 +0200)] 
buildsys: warn on usage of alloca()

alloca() is susceptible to security issues, ensure it is not
introduced.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agomore: remove usage of alloca()
Thomas Weißschuh [Tue, 12 Sep 2023 22:25:36 +0000 (00:25 +0200)] 
more: remove usage of alloca()

alloca() is susceptible to security issues, avoid it.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agobuildsys: warn on usage of VLAs
Thomas Weißschuh [Tue, 12 Sep 2023 21:49:21 +0000 (23:49 +0200)] 
buildsys: warn on usage of VLAs

Variable-length-arrays are susceptible to security issues, ensure none
are introduced.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolib/mbsedit: remove usage of VLA
Thomas Weißschuh [Tue, 12 Sep 2023 22:20:02 +0000 (00:20 +0200)] 
lib/mbsedit: remove usage of VLA

Variable-length-arrays are susceptible to security issues, avoid them.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolscpu: remove usage of VLA
Thomas Weißschuh [Tue, 12 Sep 2023 22:08:59 +0000 (00:08 +0200)] 
lscpu: remove usage of VLA

Variable-length-arrays are susceptible to security issues, avoid them.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agofdisk: remove usage of VLA
Thomas Weißschuh [Tue, 12 Sep 2023 22:09:39 +0000 (00:09 +0200)] 
fdisk: remove usage of VLA

Variable-length-arrays are susceptible to security issues, avoid them.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibfdisk: (dos) remove usage of VLA
Thomas Weißschuh [Tue, 12 Sep 2023 22:08:39 +0000 (00:08 +0200)] 
libfdisk: (dos) remove usage of VLA

Variable-length-arrays are susceptible to security issues, avoid them.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (stratis) remove usage of VLA
Thomas Weißschuh [Tue, 12 Sep 2023 22:08:21 +0000 (00:08 +0200)] 
libblkid: (stratis) remove usage of VLA

Variable-length-arrays are susceptible to security issues, avoid them.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolib/path: remove usage of VLA
Thomas Weißschuh [Tue, 12 Sep 2023 22:08:05 +0000 (00:08 +0200)] 
lib/path: remove usage of VLA

Variable-length-arrays are susceptible to security issues, avoid them.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agotests: fix capability testing
Thomas Weißschuh [Tue, 12 Sep 2023 08:34:37 +0000 (10:34 +0200)] 
tests: fix capability testing

The old capability testing logic would incorrectly interpret the following
output from getpcaps as cap_wake_alarm being supported:

$ getpcaps 0
0: cap_wake_alarm=i

Instead of realying on brittle command output parsing at a test helper
to detect capabilities.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibblkid: prune unneeded buffers
Thomas Weißschuh [Sun, 10 Sep 2023 20:46:00 +0000 (22:46 +0200)] 
libblkid: prune unneeded buffers

When a new buffer is cached that is a superset of another existing
buffer the old buffer can be removed as future requests can be satisfied
by the new one.

As probe functions can have local references to buffered data, delay the
cleanup until the probefunc is finished to avoid accessing freed data.

For the bcachefs.img testfile this reduces the final (maximal) cache
from 34338 bytes in 54 buffers
  to 24760 bytes in 40 buffers.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibblkid: add remove_buffer helper
Thomas Weißschuh [Sun, 10 Sep 2023 20:11:20 +0000 (22:11 +0200)] 
libblkid: add remove_buffer helper

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agoAdd Phytium FTC862 cpu model.
unknown [Tue, 12 Sep 2023 08:11:43 +0000 (16:11 +0800)] 
Add Phytium FTC862 cpu model.
fix:#2486

23 months agotests: (test_mkfds::mkfds-multiplexing) make the output of ts_skip_subtest visible
Masatake YAMATO [Mon, 14 Aug 2023 19:11:50 +0000 (04:11 +0900)] 
tests: (test_mkfds::mkfds-multiplexing) make the output of ts_skip_subtest visible

23 months agotests: (test_mkfds::mkfds-multiplexing) dump /proc/$pid/syscall for debugging
Masatake YAMATO [Thu, 3 Aug 2023 14:52:15 +0000 (23:52 +0900)] 
tests: (test_mkfds::mkfds-multiplexing) dump /proc/$pid/syscall for debugging

23 months agolsfd: (man) write about XMODE.m and classical system calls for multiplexing
Masatake YAMATO [Sun, 30 Jul 2023 09:29:42 +0000 (18:29 +0900)] 
lsfd: (man) write about XMODE.m and classical system calls for multiplexing

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (lsfd) add a case testing XMODE.m for classical syscalls for multiplexing
Masatake YAMATO [Sun, 30 Jul 2023 09:06:19 +0000 (18:06 +0900)] 
tests: (lsfd) add a case testing XMODE.m for classical syscalls for multiplexing

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agoautotools: fix typos
Karel Zak [Mon, 11 Sep 2023 18:27:37 +0000 (20:27 +0200)] 
autotools: fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agoscriptreplay: support ctrl+s and ctrl+g
Karel Zak [Mon, 11 Sep 2023 13:17:01 +0000 (15:17 +0200)] 
scriptreplay: support ctrl+s and ctrl+g

The old scriptreplay supported XON/XOFF flow control. The new
implementation uses cfmakeraw() and it disables it by default. Let's
enable it by IXON iflag.

Fixes: https://github.com/util-linux/util-linux/issues/2480
References: https://github.com/util-linux/util-linux/pull/1101
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agotests: (test_mkfds) add ppoll multiplexer
Masatake YAMATO [Sun, 30 Jul 2023 09:03:03 +0000 (18:03 +0900)] 
tests: (test_mkfds) add ppoll multiplexer

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (test_mkfds) add poll multiplexer
Masatake YAMATO [Sun, 30 Jul 2023 08:56:54 +0000 (17:56 +0900)] 
tests: (test_mkfds) add poll multiplexer

23 months agotests: (test_mkfds) add pselect6 and select multiplexers
Masatake YAMATO [Sun, 30 Jul 2023 03:51:36 +0000 (12:51 +0900)] 
tests: (test_mkfds) add pselect6 and select multiplexers

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (test_mkfds) add a new factory "multiplexing"
Masatake YAMATO [Sat, 29 Jul 2023 19:36:30 +0000 (04:36 +0900)] 
tests: (test_mkfds) add a new factory "multiplexing"

23 months agotests: (test_mkfds) allow to add factory-made fds to the multiplexer as event source
Masatake YAMATO [Sat, 29 Jul 2023 18:39:29 +0000 (03:39 +0900)] 
tests: (test_mkfds) allow to add factory-made fds to the multiplexer as event source

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (test_mkfds, refactor) make the function for waiting events plugable
Masatake YAMATO [Sat, 29 Jul 2023 17:36:03 +0000 (02:36 +0900)] 
tests: (test_mkfds, refactor) make the function for waiting events plugable

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (test_mkfds) include locale headers first to define _GNU_SOURCE
Masatake YAMATO [Fri, 28 Jul 2023 17:31:52 +0000 (02:31 +0900)] 
tests: (test_mkfds) include locale headers first to define _GNU_SOURCE

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (test_mkfds) use err() when a system call fails
Masatake YAMATO [Fri, 28 Jul 2023 16:21:00 +0000 (01:21 +0900)] 
tests: (test_mkfds) use err() when a system call fails

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agolsfd: (comment) fix a typo
Masatake YAMATO [Fri, 28 Jul 2023 16:17:13 +0000 (01:17 +0900)] 
lsfd: (comment) fix a typo

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agolsfd: mark XMODE.m on fds monitored by select(2) and pselect6(2)
Masatake YAMATO [Thu, 27 Jul 2023 17:43:06 +0000 (02:43 +0900)] 
lsfd: mark XMODE.m on fds monitored by select(2) and pselect6(2)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agolsfd: mark XMODE.m on fds monitored by poll(2) and ppoll(2)
Masatake YAMATO [Thu, 27 Jul 2023 16:57:43 +0000 (01:57 +0900)] 
lsfd: mark XMODE.m on fds monitored by poll(2) and ppoll(2)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agolsfd: cache the result of checking whether "XMODE" column is enabled or not
Masatake YAMATO [Thu, 27 Jul 2023 16:35:00 +0000 (01:35 +0900)] 
lsfd: cache the result of checking whether "XMODE" column is enabled or not

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agoprocfs: add a helper function to access /proc/$pid/syscall
Masatake YAMATO [Thu, 27 Jul 2023 15:30:16 +0000 (00:30 +0900)] 
procfs: add a helper function to access /proc/$pid/syscall

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agolsfd: (refactor) make the code for traversing threads reusable
Masatake YAMATO [Thu, 27 Jul 2023 15:29:49 +0000 (00:29 +0900)] 
lsfd: (refactor) make the code for traversing threads reusable

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agoMerge branch 'lsfd--fix-the-way-to-stop-mkfds-1' of https://github.com/masatake/util...
Karel Zak [Mon, 11 Sep 2023 09:07:54 +0000 (11:07 +0200)] 
Merge branch 'lsfd--fix-the-way-to-stop-mkfds-1' of https://github.com/masatake/util-linux

* 'lsfd--fix-the-way-to-stop-mkfds-1' of https://github.com/masatake/util-linux:
  tests: (lsfd::filter-floating-point-nums) use --raw output to make the case more robust
  tests: (lsfd::column-xmode) do rm -f the file for testing before making it
  tests: make ts_skip_capability accepts the output of older version of getpcaps
  tests: (lsfd::mkfds-unix-dgram) don't depend on the number of whitespaces in the output
  tests: (lsfd) avoid race conditions (part 1)
  tests: (test_mkfds) monitor stdin by default

23 months agoMerge branch 'gitignore-lsclocks' of https://github.com/bcarnes/util-linux
Karel Zak [Mon, 11 Sep 2023 09:00:50 +0000 (11:00 +0200)] 
Merge branch 'gitignore-lsclocks' of https://github.com/bcarnes/util-linux

* 'gitignore-lsclocks' of https://github.com/bcarnes/util-linux:
  add missing lsclocks to .gitignore

23 months agoMerge branch 'patch-1' of https://github.com/ThomasKaiser/util-linux
Karel Zak [Mon, 11 Sep 2023 07:14:12 +0000 (09:14 +0200)] 
Merge branch 'patch-1' of https://github.com/ThomasKaiser/util-linux

* 'patch-1' of https://github.com/ThomasKaiser/util-linux:
  Revise/add HiSilicon core names

23 months agoMerge branch 'waitpid--suppress-message' of https://github.com/masatake/util-linux
Karel Zak [Mon, 11 Sep 2023 07:12:42 +0000 (09:12 +0200)] 
Merge branch 'waitpid--suppress-message' of https://github.com/masatake/util-linux

* 'waitpid--suppress-message' of https://github.com/masatake/util-linux:
  waitpid: warn of "exited" only when --verbose is given

23 months agoMerge branch 'PR/libmount-stat.h'
Karel Zak [Mon, 11 Sep 2023 07:11:41 +0000 (09:11 +0200)] 
Merge branch 'PR/libmount-stat.h'

23 months agoMerge branch 'setpgid' of https://github.com/DaanDeMeyer/util-linux
Karel Zak [Mon, 11 Sep 2023 07:08:42 +0000 (09:08 +0200)] 
Merge branch 'setpgid' of https://github.com/DaanDeMeyer/util-linux

23 months agoRevise/add HiSilicon core names
Thomas Kaiser [Fri, 8 Sep 2023 13:19:34 +0000 (15:19 +0200)] 
Revise/add HiSilicon core names

23 months agoadd missing lsclocks to .gitignore
Brian Carnes [Fri, 8 Sep 2023 00:08:45 +0000 (17:08 -0700)] 
add missing lsclocks to .gitignore

23 months agotests: (lsfd::filter-floating-point-nums) use --raw output to make the case more...
Masatake YAMATO [Sat, 2 Sep 2023 19:38:10 +0000 (04:38 +0900)] 
tests: (lsfd::filter-floating-point-nums) use --raw output to make the case more robust

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (lsfd::column-xmode) do rm -f the file for testing before making it
Masatake YAMATO [Sat, 2 Sep 2023 19:33:21 +0000 (04:33 +0900)] 
tests: (lsfd::column-xmode) do rm -f the file for testing before making it

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: make ts_skip_capability accepts the output of older version of getpcaps
Masatake YAMATO [Sat, 2 Sep 2023 19:27:44 +0000 (04:27 +0900)] 
tests: make ts_skip_capability accepts the output of older version of getpcaps

In https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=8a2ac848a2065641e20a8b50384b68e8781cc6fc,
the default output format of getpcaps command was changed.

ts_skip_capability() assumes only the newer format, a format
introduced in the commit.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (lsfd::mkfds-unix-dgram) don't depend on the number of whitespaces in the...
Masatake YAMATO [Sat, 2 Sep 2023 17:40:41 +0000 (02:40 +0900)] 
tests: (lsfd::mkfds-unix-dgram) don't depend on the number of whitespaces in the output

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (lsfd) avoid race conditions (part 1)
Masatake YAMATO [Thu, 31 Aug 2023 18:20:20 +0000 (03:20 +0900)] 
tests: (lsfd) avoid race conditions (part 1)

For terminating test_mkfds process, the test cases
used SIGCONT. test_mkfds used pselect for waiting for the signal.
After receiving the signal test_mkfds exited.

There is a race condition in this logic. If a test case sends SIGCONT
to test_mkfds process before the process calls pselect, the signal
may be lost. As the result, test_mkfds keeps waiting forever in pselect.

This change replaces the code sending SIGCONT with writing to the pipe
connecting to the stdin of test_mkfds. test_mkfds also monitors
its stdin in the pselect call. Unlike the signal, the written bytes to
the pipe are queued.

This change doesn't touch tests/ts/lsfd/option-inet and option-summary
test cases. They don't use coproc. So fixing the race condition in the test
cases can be much complicated. I will make a dedicated pull request (part 2)
for them.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agotests: (test_mkfds) monitor stdin by default
Masatake YAMATO [Thu, 31 Aug 2023 15:56:06 +0000 (00:56 +0900)] 
tests: (test_mkfds) monitor stdin by default

After making file descriptors as specified in arguments, test_mkfds
waits for an event with pselect. When test_mkfds gets the event, it
exits.

The original code monitored stdin when the test_mkfds process ran in
the foreground. However, monitoring stdin is useful even when it runs
in the background. ts/lsfd/mkfds-* test cases run test_mkfds as a
co-process.  So the test cases can terminate their test_mkfds
processes with echo command if the processes monitor stdin.

This change also adds -X/--dont-monitor-stdin option. As the name
shows, with the option, test_mkfds doesn't monitor stdin as before.
Some test cases run test_mkfds directly. In such a case,
tests/functions.sh may connect stdin of test_mkfds to
/dev/null. /dev/null is always ready to be read.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agowaitpid: warn of "exited" only when --verbose is given
Masatake YAMATO [Thu, 31 Aug 2023 18:34:40 +0000 (03:34 +0900)] 
waitpid: warn of "exited" only when --verbose is given

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
23 months agoMerge branch 'libblkid/protection' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 31 Aug 2023 08:51:59 +0000 (10:51 +0200)] 
Merge branch 'libblkid/protection' of https://github.com/t-8ch/util-linux

* 'libblkid/protection' of https://github.com/t-8ch/util-linux:
  libblkid: protect shared buffers against modifications
  libblkid: (vfat) avoid modifying shared buffer
  libblkid: (jmicron_raid) use checksum APIs
  libblkid: (jmicron_raid) avoid modifying shared buffer
  libblkid: (zonefs) avoid modifying shared buffer

23 months agoMerge branch 'PR/losetup-json' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 31 Aug 2023 08:41:32 +0000 (10:41 +0200)] 
Merge branch 'PR/losetup-json' of github.com:karelzak/util-linux-work

* 'PR/losetup-json' of github.com:karelzak/util-linux-work:
  losetup: make --output-all more usable
  losetup: add MAJ a MIN for device and backing-file
  losetup: fix JSON MAJ:MIN

23 months agolibmount: make.stx_mnt_id use more robust
Karel Zak [Thu, 31 Aug 2023 08:30:55 +0000 (10:30 +0200)] 
libmount: make.stx_mnt_id use more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolibmount: report statx in features list
Karel Zak [Thu, 31 Aug 2023 08:26:37 +0000 (10:26 +0200)] 
libmount: report statx in features list

Let's make statx() support visible in "mount -V" output.

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolibmount: fix statx() includes
Karel Zak [Wed, 23 Aug 2023 09:50:37 +0000 (11:50 +0200)] 
libmount: fix statx() includes

Using sys/stat.h and linux/stat is too tricky.h together. It seems
better to rely on libc and use sys/stat.h only. Users affected
by old libc must update to use recent util-linux.

Fixes: https://github.com/util-linux/util-linux/issues/2448
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agoAdd new setpgid utility
Daan De Meyer [Sun, 20 Aug 2023 09:42:51 +0000 (11:42 +0200)] 
Add new setpgid utility

This program allows running a command in a new process group and
optionally makes the new process group the foreground process group
of the ctty.

This is useful when running programs through wrappers programs (think
bubblewrap, ...) and wanting to make sure that SIGINT is only sent to
the innermost process. This is possible by putting the innermost process
in a new process group and making that process group the foreground process
group of the controlling terminal.

By adding a separate utility to util-linux, we can apply this to any
program even if the program itself doesn't implement this functionality.

23 months agolibblkid: protect shared buffers against modifications
Thomas Weißschuh [Tue, 29 Aug 2023 10:06:54 +0000 (12:06 +0200)] 
libblkid: protect shared buffers against modifications

The cached buffers are shared between multiple probers.
To avoid (potentially security-sensitive) interdependencies between
probers make let the kernel enforce the write-protection.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibblkid: (vfat) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:44:48 +0000 (12:44 +0200)] 
libblkid: (vfat) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibblkid: (jmicron_raid) use checksum APIs
Thomas Weißschuh [Tue, 29 Aug 2023 10:31:35 +0000 (12:31 +0200)] 
libblkid: (jmicron_raid) use checksum APIs

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibblkid: (jmicron_raid) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:29:31 +0000 (12:29 +0200)] 
libblkid: (jmicron_raid) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibblkid: (zonefs) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:22:28 +0000 (12:22 +0200)] 
libblkid: (zonefs) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolosetup: make --output-all more usable
Karel Zak [Mon, 28 Aug 2023 14:58:13 +0000 (16:58 +0200)] 
losetup: make --output-all more usable

The other tools (e.g. lsblk) can use --output-all with --list or
--json. Let's make it usable also with losetup.

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agoMerge branch 'PR/uuidgen-count' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 28 Aug 2023 12:03:47 +0000 (14:03 +0200)] 
Merge branch 'PR/uuidgen-count' of github.com:karelzak/util-linux-work

* 'PR/uuidgen-count' of github.com:karelzak/util-linux-work:
  uuidgen: mark some options mutually exclusive
  uuidgen: add option --count

23 months agolosetup: add MAJ a MIN for device and backing-file
Karel Zak [Mon, 28 Aug 2023 11:53:40 +0000 (13:53 +0200)] 
losetup: add MAJ a MIN for device and backing-file

Addresses: https://github.com/util-linux/util-linux/issues/2460
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolosetup: fix JSON MAJ:MIN
Karel Zak [Mon, 28 Aug 2023 11:21:33 +0000 (13:21 +0200)] 
losetup: fix JSON MAJ:MIN

Fixes: https://github.com/util-linux/util-linux/issues/2460
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agoMerge branch 'lslogins/man-shell' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 28 Aug 2023 09:39:12 +0000 (11:39 +0200)] 
Merge branch 'lslogins/man-shell' of https://github.com/t-8ch/util-linux

* 'lslogins/man-shell' of https://github.com/t-8ch/util-linux:
  lslogins: (man) fix -y option formatting

23 months agoMerge branch 'fincore/alignment' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 28 Aug 2023 09:38:43 +0000 (11:38 +0200)] 
Merge branch 'fincore/alignment' of https://github.com/t-8ch/util-linux

* 'fincore/alignment' of https://github.com/t-8ch/util-linux:
  fincore: fix alignment of column listing in --help

23 months agouuidgen: mark some options mutually exclusive
Karel Zak [Wed, 23 Aug 2023 09:36:45 +0000 (11:36 +0200)] 
uuidgen: mark some options mutually exclusive

* types cannot be mixed (--time, --random, --md5 and --sha1)
* --count makes sense only for --time and --random
* --name and --namespace makes sense only for --md5 and --sha1

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agouuidgen: add option --count
Karel Zak [Wed, 23 Aug 2023 09:21:22 +0000 (11:21 +0200)] 
uuidgen: add option --count

This is mostly for testing purpose or performance tuning. The new
option allows generate multiple UUIDs using the enhanced capability of
the libuuid to cache time-based UUIDs.

 $ uuidgen --time --count 3
 638b9432-4196-11ee-bb1f-7824af891670
 638b94be-4196-11ee-bb1f-7824af891670
 638b94fa-4196-11ee-bb1f-7824af891670

Fixes: https://github.com/util-linux/util-linux/issues/2449
Signed-off-by: Karel Zak <kzak@redhat.com>