]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
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 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 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>
22 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>
22 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>
22 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>
22 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

22 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

22 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

22 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>
22 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>
22 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>
22 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>
22 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>
22 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

22 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>
22 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"

22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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

22 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

22 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

22 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

22 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'

22 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

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

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

22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
23 months agolslogins: (man) fix -y option formatting
Thomas Weißschuh [Mon, 28 Aug 2023 07:30:59 +0000 (09:30 +0200)] 
lslogins: (man) fix -y option formatting

Fixes #2461

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agofincore: fix alignment of column listing in --help
Thomas Weißschuh [Mon, 28 Aug 2023 07:28:53 +0000 (09:28 +0200)] 
fincore: fix alignment of column listing in --help

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agoinclude: add DragonFlyBSD GPT partition types
Thomas Weißschuh [Mon, 28 Aug 2023 07:01:49 +0000 (09:01 +0200)] 
include: add DragonFlyBSD GPT partition types

Fixes #2462

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibblkid: (bcachefs) fix size validation
Thomas Weißschuh [Wed, 23 Aug 2023 09:58:33 +0000 (11:58 +0200)] 
libblkid: (bcachefs) fix size validation

Avoid signed shift out-of-bounds.

Also mark the constants explitly as unsigned instead of casting.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibblkid: (bcachefs) fix compiler warning [-Werror=sign-compare]
Karel Zak [Wed, 23 Aug 2023 09:53:45 +0000 (11:53 +0200)] 
libblkid: (bcachefs) fix compiler warning [-Werror=sign-compare]

Addresses: https://github.com/util-linux/util-linux/pull/2427
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agobash-completion: add -T to last
Karel Zak [Wed, 23 Aug 2023 08:12:46 +0000 (10:12 +0200)] 
bash-completion: add -T to last

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agoMerge branch 'master' of https://github.com/tragdate/util-linux
Karel Zak [Wed, 23 Aug 2023 08:11:11 +0000 (10:11 +0200)] 
Merge branch 'master' of https://github.com/tragdate/util-linux

* 'master' of https://github.com/tragdate/util-linux:
  last(1): Document -T option for tab-separated output
  last: Add -T option for tab-separated output

23 months agoMerge branch 'udf' of https://github.com/pali/util-linux
Karel Zak [Wed, 23 Aug 2023 08:08:39 +0000 (10:08 +0200)] 
Merge branch 'udf' of https://github.com/pali/util-linux

* 'udf' of https://github.com/pali/util-linux:
  Fix detection of UDF filesystem

23 months agoMerge branch 'uclampset-updates' of https://github.com/qais-yousef/util-linux
Karel Zak [Wed, 23 Aug 2023 08:07:53 +0000 (10:07 +0200)] 
Merge branch 'uclampset-updates' of https://github.com/qais-yousef/util-linux

* 'uclampset-updates' of https://github.com/qais-yousef/util-linux:
  uclampset: Remove validation logic
  uclampset: doc: Add a reference to latest kernel documentation
  Update my email address

23 months agoMerge branch 'master' of https://github.com/breavyn/util-linux
Karel Zak [Wed, 23 Aug 2023 08:06:18 +0000 (10:06 +0200)] 
Merge branch 'master' of https://github.com/breavyn/util-linux

* 'master' of https://github.com/breavyn/util-linux:
  libblkid: (bcachefs) fix not detecting large superblocks

23 months agolast(1): Document -T option for tab-separated output
Trag Date [Wed, 23 Aug 2023 01:44:27 +0000 (04:44 +0300)] 
last(1): Document -T option for tab-separated output

This commit updates the last(1) man page to include the new -T option, which allows for tab-separated output. This addition to the documentation ensures users are aware of this new functionality and can utilize it to enhance their awk parsing.

Signed-off-by: Cristian Zmole <chiarel@tragdate.ninja>
23 months agolast: Add -T option for tab-separated output
Trag Date [Wed, 23 Aug 2023 01:43:04 +0000 (04:43 +0300)] 
last: Add -T option for tab-separated output

This commit introduces a -T option to the last command, allowing for tab-separated output. This change significantly improves the usability of last in conjunction with awk, enabling more efficient and intuitive parsing of command output.

Signed-off-by: Cristian Zmole <chiarel@tragdate.ninja>
23 months agoFix detection of UDF filesystem
Pali Rohár [Tue, 22 Aug 2023 19:21:37 +0000 (21:21 +0200)] 
Fix detection of UDF filesystem

OSTA UDF standard is "profile" of the ISO/IEC 13346 and ECMA-167 standard.
Fix UDF detection and check for "*OSTA UDF Compliant" domain id which
distinguish UDF from all other ISO/IEC 13346 and ECMA-167 filesystems.

23 months agouclampset: Remove validation logic
Qais Yousef [Sat, 19 Aug 2023 17:32:41 +0000 (18:32 +0100)] 
uclampset: Remove validation logic

While experimenting with a potential extension to uclamp; I realized
I had to modify uclampset to be able to use this extension, which is not
scalable.

Since the syscall will do checks anyway, drop the validation logic and
let the kernel do its work without duplication that can potentially get
stale.

Use more magic value for NOT_SET define. We do have uclamp_set_set flag
to verify if the value is valid anyway, so this is extra paranoia.

Signed-off-by: Qais Yousef <qyousef@layalina.io>
23 months agouclampset: doc: Add a reference to latest kernel documentation
Qais Yousef [Sat, 19 Aug 2023 17:28:53 +0000 (18:28 +0100)] 
uclampset: doc: Add a reference to latest kernel documentation

Kernel has gained a documentation for uclamp feature. Add a reference to
it to help users to find out and learn more about it.

Signed-off-by: Qais Yousef <qyousef@layalina.io>
23 months agoUpdate my email address
Qais Yousef [Sat, 19 Aug 2023 17:26:42 +0000 (18:26 +0100)] 
Update my email address

My email address at arm is no longer active. Switch to my personal one.

Done via

git grep -l 'qais.yousef@arm.com' | xargs sed -i 's/qais.yousef@arm.com/qyousef@layalina.io/g'

Signed-off-by: Qais Yousef <qyousef@layalina.io>
23 months agolibmount: Fix regression when mounting with atime
Filipe Manana [Thu, 17 Aug 2023 09:20:13 +0000 (10:20 +0100)] 
libmount: Fix regression when mounting with atime

A regression was introduced in v2.39 that causes mounting with the atime
option to fail:

  $ mkfs.ext4 -F /dev/sdi
  $ mount -o atime /dev/sdi /mnt/sdi
  mount: /mnt/sdi: not mount point or bad option.
         dmesg(1) may have more information after failed mount system call.

The failure comes from the mount_setattr(2) call returning -EINVAL. This
is because we pass an invalid value for the attr_clr argument. From a
strace capture we have:

  mount_setattr(4, "", AT_EMPTY_PATH, {attr_set=0, attr_clr=MOUNT_ATTR_NOATIME, propagation=0 /* MS_??? */, userns_fd=0}, 32) = -1 EINVAL (Invalid argument)

We can't pass MOUNT_ATTR_NOATIME to mount_setattr(2) through the attr_clr
argument because all atime options are exclusive, so in order to set atime
one has to pass MOUNT_ATTR__ATIME to attr_clr and leave attr_set as
MOUNT_ATTR_RELATIME (which is defined as a value of 0).

This can be read from the man page for mount_setattr(2) and also from the
kernel source:

  $ cat fs/namespace.c
  static int build_mount_kattr(const struct mount_attr *attr, size_t usize,
                               struct mount_kattr *kattr, unsigned int flags)
  {
      (...)
      /*
       * Since the MOUNT_ATTR_<atime> values are an enum, not a bitmap,
       * users wanting to transition to a different atime setting cannot
       * simply specify the atime setting in @attr_set, but must also
       * specify MOUNT_ATTR__ATIME in the @attr_clr field.
       * So ensure that MOUNT_ATTR__ATIME can't be partially set in
       * @attr_clr and that @attr_set can't have any atime bits set if
       * MOUNT_ATTR__ATIME isn't set in @attr_clr.
       */
      if (attr->attr_clr & MOUNT_ATTR__ATIME) {
          if ((attr->attr_clr & MOUNT_ATTR__ATIME) != MOUNT_ATTR__ATIME)
              return -EINVAL;

              /*
               * Clear all previous time settings as they are mutually
               * exclusive.
               */
              kattr->attr_clr |= MNT_RELATIME | MNT_NOATIME;
              switch (attr->attr_set & MOUNT_ATTR__ATIME) {
              case MOUNT_ATTR_RELATIME:
                  kattr->attr_set |= MNT_RELATIME;
                  break;
              case MOUNT_ATTR_NOATIME:
                  kattr->attr_set |= MNT_NOATIME;
                  break;
              case MOUNT_ATTR_STRICTATIME:
                  break;
              default:
                  return -EINVAL;
              }
    (...)

So fix this by setting attr_clr MOUNT_ATTR__ATIME if we want to clear any
atime related option.

Signed-off-by: Filipe Manana <fdmanana@kernel.org>
23 months agoterm-utils: fix indentation
Karel Zak [Wed, 16 Aug 2023 07:34:19 +0000 (09:34 +0200)] 
term-utils: fix indentation

References: 87fcd95ac5ad18e471b17f448daa55b2ce2fac6a
References: 5c62c27001467f3ef0baaa66ae4e3bb80a0298a6
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agoMerge branch 'logind' of https://github.com/thkukuk/util-linux
Karel Zak [Wed, 16 Aug 2023 07:29:50 +0000 (09:29 +0200)] 
Merge branch 'logind' of https://github.com/thkukuk/util-linux

* 'logind' of https://github.com/thkukuk/util-linux:
  write: query logind for list of users with tty (#2088)
  agetty: use sd_get_sessions() for number of users (#2088)
  wall: query logind for list of users with tty (#2088)

23 months agoMerge branch 'enosys/ioctl' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 16 Aug 2023 07:23:01 +0000 (09:23 +0200)] 
Merge branch 'enosys/ioctl' of https://github.com/t-8ch/util-linux

* 'enosys/ioctl' of https://github.com/t-8ch/util-linux:
  enosys: avoid warnings when no aliases are found
  enosys: don't validate that numbers are found from headers
  enosys: add support for ioctl blocking
  enosys: store blocked syscalls in list instead of array
  enosys: build BPF dynamically
  enosys: list syscall numbers

23 months agoMerge branch 'libblkid/limit-buffer' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 16 Aug 2023 07:00:21 +0000 (09:00 +0200)] 
Merge branch 'libblkid/limit-buffer' of https://github.com/t-8ch/util-linux

* 'libblkid/limit-buffer' of https://github.com/t-8ch/util-linux:
  libblkid: limit read buffer size

23 months agoMerge branch 'PR/losetup-mode-cleanup'
Karel Zak [Wed, 16 Aug 2023 06:57:37 +0000 (08:57 +0200)] 
Merge branch 'PR/losetup-mode-cleanup'

23 months agoMerge branch 'feat-riscv64' of https://github.com/michalbiesek/util-linux
Karel Zak [Wed, 16 Aug 2023 06:56:38 +0000 (08:56 +0200)] 
Merge branch 'feat-riscv64' of https://github.com/michalbiesek/util-linux

* 'feat-riscv64' of https://github.com/michalbiesek/util-linux:
  setarch: add riscv64/riscv32 support

23 months agolibblkid: limit read buffer size
Thomas Weißschuh [Tue, 15 Aug 2023 19:25:44 +0000 (21:25 +0200)] 
libblkid: limit read buffer size

Many probers read data from disk bounded by some field from the probed
disk itself.
The probers should validate the read length before using.
Add a fallback that kicks in when the proper does not check the length
epxlicitly.

See #2427
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolosetup: cleanup device node modes
Karel Zak [Tue, 15 Aug 2023 10:32:49 +0000 (12:32 +0200)] 
losetup: cleanup device node modes

The current code follows ro/rw mode not only set mode of the new
device, but also to open the device node for ioctls.

Linux kernel does not care and it seems O_RDONLY is good enough
for all cases (ioctls).

Unfortunately, udevd is sensitive as it monitors devices by inotify
and IN_CLOSE_WRITE event is expected to apply udev rules for the
device.

Changes:

* remove LOOPDEV_FL_{RDONLY,RDWR} private flags, it's too complex and
  unnecessary

* use mode_t for open() modes (rater than int)

* re-open only if O_RDWR requested otherwise default to O_RDONLY

* make sure O_RDWR is used on device setup

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