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

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

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

Addresses: https://github.com/util-linux/util-linux/issues/2516
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agotests: (lsfd) extend the cases for testing BPF.NAME column
Masatake YAMATO [Tue, 26 Sep 2023 16:15:21 +0000 (01:15 +0900)] 
tests: (lsfd) extend the cases for testing BPF.NAME column

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

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

An example output:

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

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

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

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

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (test_mkfds::{bpf-prog,bpf-map}) fix memory leaks
Masatake YAMATO [Tue, 26 Sep 2023 16:04:54 +0000 (01:04 +0900)] 
tests: (test_mkfds::{bpf-prog,bpf-map}) fix memory leaks

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (test_mkfds) add missing PARAM_END marker
Masatake YAMATO [Tue, 26 Sep 2023 16:01:58 +0000 (01:01 +0900)] 
tests: (test_mkfds) add missing PARAM_END marker

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (test_mkfds) use SYS_bpf instead of __NR_bpf
Masatake YAMATO [Tue, 26 Sep 2023 16:01:12 +0000 (01:01 +0900)] 
tests: (test_mkfds) use SYS_bpf instead of __NR_bpf

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (test_mkfds) revise the usage of " __attribute__((__unused__))"
Masatake YAMATO [Tue, 26 Sep 2023 15:58:55 +0000 (00:58 +0900)] 
tests: (test_mkfds) revise the usage of " __attribute__((__unused__))"

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (lsfd::mkfds-bpf-map) chmod a+x
Masatake YAMATO [Fri, 29 Sep 2023 20:28:58 +0000 (05:28 +0900)] 
tests: (lsfd::mkfds-bpf-map) chmod a+x

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agoMerge branch 'libblkid/vxfs-endianness' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 27 Sep 2023 08:35:12 +0000 (10:35 +0200)] 
Merge branch 'libblkid/vxfs-endianness' of https://github.com/t-8ch/util-linux

* 'libblkid/vxfs-endianness' of https://github.com/t-8ch/util-linux:
  libblkid: (vxfs) report endianness

22 months agoMerge branch 'libblkid/bcachefs/label_sub' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 27 Sep 2023 08:34:47 +0000 (10:34 +0200)] 
Merge branch 'libblkid/bcachefs/label_sub' of https://github.com/t-8ch/util-linux

* 'libblkid/bcachefs/label_sub' of https://github.com/t-8ch/util-linux:
  libblkid: (bcachefs) add support for sub-device labels

22 months agolibblkid: (vxfs) report endianness
Thomas Weißschuh [Tue, 26 Sep 2023 22:49:04 +0000 (00:49 +0200)] 
libblkid: (vxfs) report endianness

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (bcachefs) add support for sub-device labels
Thomas Weißschuh [Tue, 26 Sep 2023 07:43:35 +0000 (09:43 +0200)] 
libblkid: (bcachefs) add support for sub-device labels

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (ntfs) validate that sector_size is a power of two
Thomas Weißschuh [Mon, 25 Sep 2023 22:27:22 +0000 (00:27 +0200)] 
libblkid: (ntfs) validate that sector_size is a power of two

The NTFS prober reads data based off an offset of the sector size.
If the sector size is unaligned and the read data is cached then other
probers can read unaligned values.

Sector sizes for NTFS actually only make sense as power-of-two so
validate that and as a sideeffect avoid the unaligned reads.

Also add the reproducer from OSS-Fuzz that found this issue.

Fixes #2509

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoMerge branch 'login-terminal' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 25 Sep 2023 10:44:46 +0000 (12:44 +0200)] 
Merge branch 'login-terminal' of https://github.com/stoeckmann/util-linux

* 'login-terminal' of https://github.com/stoeckmann/util-linux:
  login: prevent undefined ioctl and tcsetattr calls
  login: use correct terminal fd during setup

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

* 'timestamp' of https://github.com/t-8ch/util-linux:
  lib/timeutils: (parse_timestamp_reference) report errors on overflow
  lib/timeutils: print error if timestamp can't be parsed
  lib/timeutils: test epoch timestamp

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

* 'ci/cache-openwrt-sdk' of https://github.com/t-8ch/util-linux:
  ci: cache openwrt sdk

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

* 'ci/gcc-13' of https://github.com/t-8ch/util-linux:
  ci: also use GCC 13 for sanitizer builds
  ci: don't combine -Werror and -fsanitize

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 agolib/timeutils: (parse_timestamp_reference) report errors on overflow
Thomas Weißschuh [Sun, 24 Sep 2023 21:43:44 +0000 (23:43 +0200)] 
lib/timeutils: (parse_timestamp_reference) report errors on overflow

Instead of silently returning '0' on 'minus'-underflow and silently
wrapping on 'plus'-overflow return ERANGE.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolib/timeutils: print error if timestamp can't be parsed
Thomas Weißschuh [Sun, 24 Sep 2023 21:32:08 +0000 (23:32 +0200)] 
lib/timeutils: print error if timestamp can't be parsed

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolib/timeutils: test epoch timestamp
Thomas Weißschuh [Sun, 24 Sep 2023 21:14:34 +0000 (23:14 +0200)] 
lib/timeutils: test epoch timestamp

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoci: cache openwrt sdk
Thomas Weißschuh [Fri, 22 Sep 2023 20:03:34 +0000 (22:03 +0200)] 
ci: cache openwrt sdk

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoci: also use GCC 13 for sanitizer builds
Thomas Weißschuh [Fri, 22 Sep 2023 18:38:13 +0000 (20:38 +0200)] 
ci: also use GCC 13 for sanitizer builds

Now that -Werror is not used anymore with -fsanitize the false-postives
are not a problem anymore and we get the better runtime checks of newer
sanitizers.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoci: don't combine -Werror and -fsanitize
Thomas Weißschuh [Fri, 22 Sep 2023 09:19:24 +0000 (11:19 +0200)] 
ci: don't combine -Werror and -fsanitize

As explained in [0]:

    Note that sanitizers tend to increase the rate of false positive
    warnings, most notably those around -Wmaybe-uninitialized. We recommend
    against combining -Werror and [the use of] sanitizers.

[0] https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Instrumentation-Options.html#index-fsanitize_003dundefined

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
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 agologin: prevent undefined ioctl and tcsetattr calls
Tobias Stoeckmann [Thu, 21 Sep 2023 18:25:55 +0000 (20:25 +0200)] 
login: prevent undefined ioctl and tcsetattr calls

Do not call tcsetattr if tcgetattr fails, because the content of
tt and ttt is undefined in that case.

Also do not just warn if ioctl fails, but also avoid calling it again
after tty has been re-opened.

I've solved this by setting struct variables to values which cannot be
valid at this point. If they do have these exact values, then the
calls will be prevented.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
22 months agologin: use correct terminal fd during setup
Tobias Stoeckmann [Thu, 21 Sep 2023 18:15:46 +0000 (20:15 +0200)] 
login: use correct terminal fd during setup

The function get_terminal_name iterates through standard file
descriptors until it finds a terminal. This means that it's not
guaranteed that STDIN_FILENO (i.e. 0) is actually a terminal.

Do not modify permissions on possible files. Instead, retrieve
the file descriptor which was used by get_terminal_name as well.

Proof of Concept (as root):

1. Create a temporary file with a mode different than TTYPERM.
```
install -m 700 /dev/null /tmp/test
ls -l /tmp/test
-rwx------ 1 root root 0 Sep 21 20:15 /tmp/test
```

2. Run login within a terminal with adjusted stdin.
```
login < /tmp/test
host login:
            Hangup
```

3. Check permissions of input file.
```
ls -l /tmp/test
-rw------- 1 root root 0 Sep 21 20:15 /tmp/test
```

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
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>
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'