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

12 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

12 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

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

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

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

12 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

12 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

12 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

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

12 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

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

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

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

12 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

12 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>
12 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>
12 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>
12 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.

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

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

12 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

12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
13 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>
13 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

13 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

13 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

13 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

13 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>
13 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>
13 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.

13 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>
13 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>
13 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>
13 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>
13 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>
13 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)

13 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

13 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

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

13 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

13 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>
13 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>
13 months agogithub: check apt-cache in more robust way (v2)
Masatake YAMATO [Tue, 15 Aug 2023 11:51:23 +0000 (20:51 +0900)] 
github: check apt-cache in more robust way (v2)

The original change (86d5c4dbf6e62c52fe9295f4e55eb629d8e26cfb) didn't
consider "set -e" at the beginning of the script.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
13 months agoRevert "tools/all_syscalls: use sh and replace awk with grep & sed"
Karel Zak [Tue, 15 Aug 2023 11:12:16 +0000 (13:12 +0200)] 
Revert "tools/all_syscalls: use sh and replace awk with grep & sed"

This reverts commit a01065546d9613ffc9835398f56756f08a0193be.

13 months agoRevert "tools/all_syscalls: use pipefail"
Karel Zak [Tue, 15 Aug 2023 10:49:20 +0000 (12:49 +0200)] 
Revert "tools/all_syscalls: use pipefail"

Our CI don't like it.

See also old http://github.com/util-linux/util-linux/commit/fffe5f7c72121c054645c60c0bb49f653bb7142e

This reverts commit d53a1529bd79077a8e7232651f99f20890283c0c.

13 months agosetarch: add PER_LINUX_FDPIC fallback
Karel Zak [Tue, 15 Aug 2023 09:33:31 +0000 (11:33 +0200)] 
setarch: add PER_LINUX_FDPIC fallback

Fixes: https://github.com/util-linux/util-linux/issues/2436
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agoMerge branch 'PR/libblkid-fix-topology-64vs32' of github.com:karelzak/util-linux...
Karel Zak [Tue, 15 Aug 2023 09:05:20 +0000 (11:05 +0200)] 
Merge branch 'PR/libblkid-fix-topology-64vs32' of github.com:karelzak/util-linux-work

* 'PR/libblkid-fix-topology-64vs32' of github.com:karelzak/util-linux-work:
  libblkid: fix topology chain types mismatch

13 months agogithub: check apt-cache in more robust way
Karel Zak [Tue, 15 Aug 2023 09:02:43 +0000 (11:02 +0200)] 
github: check apt-cache in more robust way

Reported-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agosetarch: add riscv64/riscv32 support
Michal Biesek [Mon, 14 Aug 2023 00:37:45 +0000 (02:37 +0200)] 
setarch: add riscv64/riscv32 support

Signed-off-by: Michal Biesek <michalbiesek@gmail.com>
13 months agoMerge branch 'master' of https://github.com/apprehensions/util-linux
Karel Zak [Mon, 14 Aug 2023 11:09:51 +0000 (13:09 +0200)] 
Merge branch 'master' of https://github.com/apprehensions/util-linux

* 'master' of https://github.com/apprehensions/util-linux:
  tools/all_syscalls: use pipefail
  meson: run tests if with option program-tests
  meson: use meson features instead of bash
  tools/all_syscalls: use sh and replace awk with grep & sed

13 months agolibblkid: fix topology chain types mismatch
Karel Zak [Mon, 14 Aug 2023 10:31:48 +0000 (12:31 +0200)] 
libblkid: fix topology chain types mismatch

Reported-by: https://github.com/util-linux/util-linux/pull/2430
References: https://github.com/util-linux/util-linux/commit/3ab9e699a8d90f55e0447516b7e05a8686180467
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agoMerge branch 'verity' of https://github.com/bluca/util-linux
Karel Zak [Mon, 14 Aug 2023 10:02:47 +0000 (12:02 +0200)] 
Merge branch 'verity' of https://github.com/bluca/util-linux

* 'verity' of https://github.com/bluca/util-linux:
  verity: modernize example in manpage
  verity: use <roothash>-verity as the device mapper name instead of libmnt_<image>

13 months agoMerge branch 'fincore/noheader' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 14 Aug 2023 09:48:19 +0000 (11:48 +0200)] 
Merge branch 'fincore/noheader' of https://github.com/t-8ch/util-linux

* 'fincore/noheader' of https://github.com/t-8ch/util-linux:
  fincore: (tests) adapt alternative testcases to new header format

13 months agoverity: modernize example in manpage
Luca Boccassi [Thu, 10 Aug 2023 23:19:16 +0000 (00:19 +0100)] 
verity: modernize example in manpage

These days it's no longer necessary to create the verity hash device
with dd, and to transcribe the roothash by hand. Update the example,
also using the file extensions that are used by systemd for verity
autodiscovery (e.g.: RootImage=img.raw will automatically use
img.verity and img.roothash from the same directory, if present).

Signed-off-by: Luca Boccassi <bluca@debian.org>
13 months agoverity: use <roothash>-verity as the device mapper name instead of libmnt_<image>
Luca Boccassi [Thu, 10 Aug 2023 23:18:22 +0000 (00:18 +0100)] 
verity: use <roothash>-verity as the device mapper name instead of libmnt_<image>

If the roothash is the same among two volumes, then the images are guaranteed
to be equivalent. The filename of the image on the other hand does not imply
that the images are equivalent.
In systemd we open verity devices as '<roothash>-verity', so that we know for
sure we can reuse them. Do the same here, so that we are a bit more confident
that images can be reused before the safety check, and also so that we can
take advantage of the kernel refcounting together with images used by systemd,
as setting up verity is expensive.

Signed-off-by: Luca Boccassi <bluca@debian.org>
13 months agoeject: (tests) don't write mount hint to terminal
Karel Zak [Thu, 10 Aug 2023 09:13:47 +0000 (11:13 +0200)] 
eject: (tests) don't write mount hint to terminal

References: 4b9e3937966f7ddf90e6013c87f73c260963b0ea
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agolibblkid: (bcachefs) fix not detecting large superblocks
Colin Gillespie [Wed, 9 Aug 2023 08:28:07 +0000 (18:28 +1000)] 
libblkid: (bcachefs) fix not detecting large superblocks

Probing does not detect bcachefs filesystems with a superblock larger
than 4KiB. Bcachefs superblocks grow in size and can become much larger
than this.

Increase the superblock maximum size limit to 1MiB.

Validate the superblock isn't larger than the maximum size defined in
the superblocks layout section.

13 months agouuidd: enable cont-clock in service file
Karel Zak [Wed, 9 Aug 2023 11:12:34 +0000 (13:12 +0200)] 
uuidd: enable cont-clock in service file

Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agouuidd: improve man page for -cont-clock
Karel Zak [Wed, 9 Aug 2023 10:56:42 +0000 (12:56 +0200)] 
uuidd: improve man page for -cont-clock

Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agoenosys: fix build on hppa
John David Anglin [Mon, 7 Aug 2023 15:37:17 +0000 (15:37 +0000)] 
enosys: fix build on hppa

The following patch fixes the definition of SECCOMP_ARCH_NATIVE
on hppa.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
13 months agozramctl: add hint about supported algorithms
Karel Zak [Wed, 9 Aug 2023 09:26:28 +0000 (11:26 +0200)] 
zramctl: add hint about supported algorithms

It seems the current list of the algorithms is confusing for
end-users, because it's inaccurate in many cases. Let's explain why
the list cannot be "perfect".

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2203324
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agofincore: (tests) adapt alternative testcases to new header format
Thomas Weißschuh [Tue, 8 Aug 2023 20:07:43 +0000 (22:07 +0200)] 
fincore: (tests) adapt alternative testcases to new header format

For #2380 the testcases for 4k pages were adapted to the new output
format, but the other testcases were missed.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
13 months agotools/all_syscalls: use pipefail
sewn [Tue, 8 Aug 2023 08:50:10 +0000 (11:50 +0300)] 
tools/all_syscalls: use pipefail

13 months agomeson: properly handle gettext non-existence
Thomas Weißschuh [Sat, 5 Aug 2023 06:57:28 +0000 (08:57 +0200)] 
meson: properly handle gettext non-existence

Commit e91a49c9747f ("meson: don't build po if no gettext")
tried to add the possibility to build util-linux without gettext.

Unfortunately by default the call to find_program() would abort the
build if the program is not found.
Avoid aborting the build.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>