]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 years agoMerge branch 'lsfd-s390-proc-net-L3' of https://github.com/masatake/util-linux
Karel Zak [Mon, 31 Oct 2022 12:54:45 +0000 (13:54 +0100)] 
Merge branch 'lsfd-s390-proc-net-L3' of https://github.com/masatake/util-linux

* 'lsfd-s390-proc-net-L3' of https://github.com/masatake/util-linux:
  lsfd: unify the code for reading /proc/net/tcp and udp
  lsfd: make the logic for verifying the initial line of /proc/net/{tcp,udp} more flexible

2 years agoMerge branch '1' of https://github.com/neheb/util-linux
Karel Zak [Mon, 31 Oct 2022 12:19:34 +0000 (13:19 +0100)] 
Merge branch '1' of https://github.com/neheb/util-linux

* '1' of https://github.com/neheb/util-linux:
  meson: remove some unused variables
  meson: fix array issue

2 years agoMerge branch 'fadvise-meson-build' of https://github.com/masatake/util-linux
Karel Zak [Mon, 31 Oct 2022 12:09:20 +0000 (13:09 +0100)] 
Merge branch 'fadvise-meson-build' of https://github.com/masatake/util-linux

* 'fadvise-meson-build' of https://github.com/masatake/util-linux:
  meson: build fadvise

2 years agoMerge branch 'fix-jfs' of https://github.com/mbroz/util-linux
Karel Zak [Mon, 31 Oct 2022 12:01:36 +0000 (13:01 +0100)] 
Merge branch 'fix-jfs' of https://github.com/mbroz/util-linux

* 'fix-jfs' of https://github.com/mbroz/util-linux:
  libblkid: jfs - avoid undefined shift

2 years agolibblkid: use blkid_probe_set_value() in more consistent way
Karel Zak [Mon, 31 Oct 2022 11:55:14 +0000 (12:55 +0100)] 
libblkid: use blkid_probe_set_value() in more consistent way

* use it if snprintf unnecessary
* use "const char" to be consistent

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'fs-endianess' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 31 Oct 2022 11:40:34 +0000 (12:40 +0100)] 
Merge branch 'fs-endianess' of https://github.com/t-8ch/util-linux

* 'fs-endianess' of https://github.com/t-8ch/util-linux:
  libblkid: squashfs3: report endianness
  libblkid: zfs: report endianness
  libblkid: ufs: report endianness
  libblkid: minix: report endianness
  libblkid: cramfs: report endianness
  libblkid: befs: report endianness
  libblkid: add blkid_probe_set_fsendianness()
  libblkid: squashfs: add testcase
  libblkid: squashfs3: add testcase

2 years agolibsmartcols: fix divide by zero [coverity]
Karel Zak [Mon, 31 Oct 2022 08:33:24 +0000 (09:33 +0100)] 
libsmartcols: fix divide by zero [coverity]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomeson: build fadvise
Masatake YAMATO [Sun, 30 Oct 2022 01:33:57 +0000 (10:33 +0900)] 
meson: build fadvise

Reported-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agomeson: remove some unused variables
Rosen Penev [Fri, 28 Oct 2022 23:58:25 +0000 (16:58 -0700)] 
meson: remove some unused variables

Found with muon's analyze.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agomeson: fix array issue
Rosen Penev [Fri, 28 Oct 2022 23:47:57 +0000 (16:47 -0700)] 
meson: fix array issue

+= cannot be used with a dep. Found with muon's analyze:

meson.build:643:5: error expected type dict|disabler|int|list|str, got
dep

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agolibblkid: jfs - avoid undefined shift
Milan Broz [Thu, 27 Oct 2022 14:05:35 +0000 (16:05 +0200)] 
libblkid: jfs - avoid undefined shift

JFS probe can use undefined shift if stored log2 of block
size is a bogus value. Avoid this by limiting shift size.

Reproducer found with OSS-Fuzz (issue 52643) running over
cryptsetup project (blkid is used in header init).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2 years agolibblkid: squashfs3: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:32:08 +0000 (16:32 +0200)] 
libblkid: squashfs3: report endianness

2 years agolibblkid: zfs: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:19:04 +0000 (16:19 +0200)] 
libblkid: zfs: report endianness

2 years agolibblkid: ufs: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:17:48 +0000 (16:17 +0200)] 
libblkid: ufs: report endianness

2 years agolibblkid: minix: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:16:05 +0000 (16:16 +0200)] 
libblkid: minix: report endianness

2 years agolibblkid: cramfs: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:07:44 +0000 (16:07 +0200)] 
libblkid: cramfs: report endianness

2 years agolibblkid: befs: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:07:35 +0000 (16:07 +0200)] 
libblkid: befs: report endianness

2 years agolibblkid: add blkid_probe_set_fsendianness()
Thomas Weißschuh [Wed, 26 Oct 2022 14:04:27 +0000 (16:04 +0200)] 
libblkid: add blkid_probe_set_fsendianness()

2 years agolibblkid: squashfs: add testcase
Thomas Weißschuh [Wed, 26 Oct 2022 14:31:29 +0000 (16:31 +0200)] 
libblkid: squashfs: add testcase

2 years agolibblkid: squashfs3: add testcase
Thomas Weißschuh [Wed, 26 Oct 2022 14:31:17 +0000 (16:31 +0200)] 
libblkid: squashfs3: add testcase

2 years agolibmount: Reuse the guessed root device
Viktor Rosendahl (BMW) [Mon, 24 Oct 2022 09:36:03 +0000 (11:36 +0200)] 
libmount: Reuse the guessed root device

Inside a container, the file /proc/self/mountinfo may contain many lines
with /dev/root. It is also quite likely that /dev/root is not visible
inside the container. This may cause mnt_guess_system_root() to try to use
libblkid before giving up, through mnt_resolve_spec() and
mnt_resolve_tag(), which calls blkid_evaluate_tag(). The call to
blkid_evaluate_tag() may trigger a scan of all block devices, which is
expensive.

For this reason, it doesn't make any sense for kernel_fs_postparse()
to call mnt_guess_system_root() more than once for every call to
mnt_table_parse_stream. Instead, save the result from the first call and
reuse it for all subsequent calls to kernel_fs_postparse(), so that there
is at most one call to mnt_guess_system_root() for every call
to mnt_table_parse_stream().

[kzak@redhat.com: - use sysroot_ prefix for the cached variables
  - simplify code logic in kernel_fs_postparse()
  - add free() to parser_cleanup()]

Signed-off-by: Viktor Rosendahl (BMW) <viktor.rosendahl@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'cramfs/endianess-mismatch' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 26 Oct 2022 07:41:29 +0000 (09:41 +0200)] 
Merge branch 'cramfs/endianess-mismatch' of https://github.com/t-8ch/util-linux

* 'cramfs/endianess-mismatch' of https://github.com/t-8ch/util-linux:
  libblkid: cramfs: report version
  libblkid: cramfs: report filesystem size
  libblkid: test big endian cramfs image
  libblkid: cramfs: handle cross-endianess for checksums

2 years agolsfd: unify the code for reading /proc/net/tcp and udp
Masatake YAMATO [Wed, 26 Oct 2022 03:01:37 +0000 (12:01 +0900)] 
lsfd: unify the code for reading /proc/net/tcp and udp

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: make the logic for verifying the initial line of /proc/net/{tcp,udp} more flexible
Masatake YAMATO [Wed, 26 Oct 2022 02:56:00 +0000 (11:56 +0900)] 
lsfd: make the logic for verifying the initial line of /proc/net/{tcp,udp} more flexible

The format of /proc/net/udp was changed in
6c25449e1a32 ("net: udp: fix alignment problem in udp4_seq_show()").
This kind of change can be applied to /proc/net/tcp, too.

Co-Authored-by: Thomas Weißschuh <thomas@t-8ch.de>
Co-Authored-by: Masatake YAMATO <yamato@redhat.com>
2 years agolibblkid: cramfs: report version
Thomas Weißschuh [Mon, 24 Oct 2022 21:34:04 +0000 (23:34 +0200)] 
libblkid: cramfs: report version

2 years agolibsmartcols: make columns reduction more backward compatible
Karel Zak [Tue, 25 Oct 2022 10:35:38 +0000 (12:35 +0200)] 
libsmartcols: make columns reduction more backward compatible

The original version truncates only columns with extreme and truncate
flags.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibsmartcols: improve columns reduction
Karel Zak [Fri, 14 Oct 2022 09:18:40 +0000 (11:18 +0200)] 
libsmartcols: improve columns reduction

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibsmartcols: truncate by one char
Karel Zak [Thu, 13 Oct 2022 09:56:20 +0000 (11:56 +0200)] 
libsmartcols: truncate by one char

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibsmartcols: use local sqrt() implemenation
Karel Zak [Thu, 13 Oct 2022 08:25:25 +0000 (10:25 +0200)] 
libsmartcols: use local sqrt() implemenation

We do not need any powerful and precise sqrt implementation, so
let's use local code rather than depend on an external library.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibsmartcols: use standard deviation to optimize columns width
Karel Zak [Wed, 12 Oct 2022 07:46:56 +0000 (09:46 +0200)] 
libsmartcols: use standard deviation to optimize columns width

The standard deviation together with mean (average) of the data width
can be used to detect "problematic" columns and to calculate optimal
width.

The idea is to sort column by avg+deviation and start columns width
reduction from the column with the most wide and variable width. The
width reduction is also optimized by 68–95–99 rule (aka empirical
rule, avg+n*deviation; where n={1,2,3}) to cover 95% or 68% data in
the column.

The disadvantage is we need to link libsmartcols with -lm (math) due
to sqrt() function.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolosetup: improve backing-file column formatting
Karel Zak [Wed, 12 Oct 2022 07:43:17 +0000 (09:43 +0200)] 
losetup: improve backing-file column formatting

Let's mark the column by no-extreme libsmartcols flag. It makes
output more compact if there is too long mount path.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolsblk: improve mountpoint columns formatting
Karel Zak [Wed, 12 Oct 2022 07:43:17 +0000 (09:43 +0200)] 
lsblk: improve mountpoint columns formatting

Let's mark the columns by no-extreme libsmartcols flag. It makes
output more compact if there are too long mount paths.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibsmartcols: improve debug messages
Karel Zak [Wed, 12 Oct 2022 07:40:43 +0000 (09:40 +0200)] 
libsmartcols: improve debug messages

* disable debug for tree-wall; it generates to many messages

* fix way how library prints column flags, 0x<hex> is more redable

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: don't print mount hins on terminal
Karel Zak [Tue, 25 Oct 2022 09:04:20 +0000 (11:04 +0200)] 
tests: don't print mount hins on terminal

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: cramfs: report filesystem size
Thomas Weißschuh [Mon, 24 Oct 2022 21:19:34 +0000 (23:19 +0200)] 
libblkid: cramfs: report filesystem size

2 years agolibblkid: test big endian cramfs image
Thomas Weißschuh [Mon, 24 Oct 2022 16:25:51 +0000 (18:25 +0200)] 
libblkid: test big endian cramfs image

2 years agolibblkid: cramfs: handle cross-endianess for checksums
Thomas Weißschuh [Mon, 24 Oct 2022 14:48:18 +0000 (16:48 +0200)] 
libblkid: cramfs: handle cross-endianess for checksums

2 years agotetss: use stat(1) in mount/set_ugid_mode
Karel Zak [Mon, 24 Oct 2022 11:02:26 +0000 (13:02 +0200)] 
tetss: use stat(1) in mount/set_ugid_mode

The permissions output from ls(1) is not portable. The output
contains '.' when SELinux context is enabled for the directory.

stat(1) also provides full control over formatting, so we do not need to
parse ls(1) output.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'tests' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 24 Oct 2022 09:04:40 +0000 (11:04 +0200)] 
Merge branch 'tests' of https://github.com/t-8ch/util-linux

* 'tests' of https://github.com/t-8ch/util-linux:
  ci: install dependencies from setup-ubuntu.sh
  ci: s390x: install more test dependencies
  lsfd: skip test mkfds-udp on s390x

2 years agolibblkid: (exfat) fix divide by zero [coverity scan]
Karel Zak [Mon, 24 Oct 2022 08:54:24 +0000 (10:54 +0200)] 
libblkid: (exfat) fix divide by zero [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofdisk: fix --output option parsing
Karel Zak [Mon, 24 Oct 2022 07:57:07 +0000 (09:57 +0200)] 
fdisk: fix --output option parsing

Fixes: https://github.com/util-linux/util-linux/issues/1859
Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1022249
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoci: install dependencies from setup-ubuntu.sh
Thomas Weißschuh [Fri, 21 Oct 2022 19:40:37 +0000 (21:40 +0200)] 
ci: install dependencies from setup-ubuntu.sh

2 years agoci: s390x: install more test dependencies
Thomas Weißschuh [Fri, 21 Oct 2022 19:32:53 +0000 (21:32 +0200)] 
ci: s390x: install more test dependencies

2 years agolsfd: skip test mkfds-udp on s390x
Thomas Weißschuh [Fri, 21 Oct 2022 19:28:33 +0000 (21:28 +0200)] 
lsfd: skip test mkfds-udp on s390x

It is broken for now.

2 years agolibblkid: fix jmicron checksum and LE to CPU
Karel Zak [Fri, 21 Oct 2022 16:11:59 +0000 (18:11 +0200)] 
libblkid: fix jmicron checksum and LE to CPU

- don't cast packed struct to uint16_t pointer, use temporary value
- calculate real count for the loop
- convert all to LE for checksum calculation (jm_to_cpu() ignores fillers)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolsfd: fix compiler warning [-Werror,-Wextra-semi]
Karel Zak [Fri, 21 Oct 2022 12:23:50 +0000 (14:23 +0200)] 
lsfd: fix compiler warning [-Werror,-Wextra-semi]

isc-utils/lsfd-sock-xinfo.c:588:34: error: extra ';' outside of a function [-Werror,-Wextra-semi]
define_fill_column_func(tcp, TCP);
                                 ^
misc-utils/lsfd-sock-xinfo.c:703:34: error: extra ';' outside of a function [-Werror,-Wextra-semi]
define_fill_column_func(udp, UDP);
                                 ^
Addresses: 92a0dbce7c779923bd2a6fd7c53470ff6982ea50
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'lsfd-udp' of https://github.com/masatake/util-linux
Karel Zak [Fri, 21 Oct 2022 11:02:56 +0000 (13:02 +0200)] 
Merge branch 'lsfd-udp' of https://github.com/masatake/util-linux

* 'lsfd-udp' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case testing UDP sockets
  lsfd: use extra information loaded from /proc/net/udp
  lsfd: (man) write more about TCP scokets

2 years agoMerge branch 'fix-exfat' of https://github.com/mbroz/util-linux
Karel Zak [Fri, 21 Oct 2022 10:55:19 +0000 (12:55 +0200)] 
Merge branch 'fix-exfat' of https://github.com/mbroz/util-linux

* 'fix-exfat' of https://github.com/mbroz/util-linux:
  libblkid: exfat - avoid undefined shift

2 years agoMerge branch 'ci/big-endian' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 21 Oct 2022 10:39:11 +0000 (12:39 +0200)] 
Merge branch 'ci/big-endian' of https://github.com/t-8ch/util-linux

* 'ci/big-endian' of https://github.com/t-8ch/util-linux:
  Run Ci on big-endian s390x
  tests: disable nonfunctional tests under qemu user emulation
  ci: don't run make with infinite parallel jobs

2 years agolibblkid: exfat - avoid undefined shift
Milan Broz [Thu, 20 Oct 2022 12:34:27 +0000 (14:34 +0200)] 
libblkid: exfat - avoid undefined shift

Exfat filesystem probe can use undefined shift if block_bits
or bpc_bits is a bogus value. Avoid this by limiting shift size.

Reproducer found with OSS-Fuzz (issue 52571) running over
cryptsetup project (blkid is used in header init).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2 years agotests: (lsfd) add a case testing UDP sockets
Masatake YAMATO [Wed, 19 Oct 2022 20:17:38 +0000 (05:17 +0900)] 
tests: (lsfd) add a case testing UDP sockets

This tests UDP.LADDR, UDP.LPORT, UDP.RADDR, and UDP.RPORT.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use extra information loaded from /proc/net/udp
Masatake YAMATO [Mon, 17 Oct 2022 18:11:44 +0000 (03:11 +0900)] 
lsfd: use extra information loaded from /proc/net/udp

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: (man) write more about TCP scokets
Masatake YAMATO [Mon, 17 Oct 2022 18:09:43 +0000 (03:09 +0900)] 
lsfd: (man) write more about TCP scokets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolibblkid: cleanup indentation
Karel Zak [Wed, 19 Oct 2022 09:24:30 +0000 (11:24 +0200)] 
libblkid: cleanup indentation

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: use checksum for jmicron
Karel Zak [Wed, 19 Oct 2022 09:16:17 +0000 (11:16 +0200)] 
libblkid: use checksum for jmicron

Addresses: https://github.com/util-linux/util-linux/pull/1843
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'fadvice-delete-unused-type' of https://github.com/masatake/util-linux
Karel Zak [Wed, 19 Oct 2022 08:09:16 +0000 (10:09 +0200)] 
Merge branch 'fadvice-delete-unused-type' of https://github.com/masatake/util-linux

* 'fadvice-delete-unused-type' of https://github.com/masatake/util-linux:
  fadvice: delete a unused struct definition

2 years agomkfs.bfs, mkfs.cramfs: cleanup optional argument use
Karel Zak [Tue, 18 Oct 2022 10:47:39 +0000 (12:47 +0200)] 
mkfs.bfs, mkfs.cramfs: cleanup optional argument use

* fix --help
* fix getopt() call

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoRun Ci on big-endian s390x
Thomas Weißschuh [Fri, 7 Oct 2022 22:47:01 +0000 (00:47 +0200)] 
Run Ci on big-endian s390x

Fixes #1808

2 years agotests: disable nonfunctional tests under qemu user emulation
Thomas Weißschuh [Mon, 10 Oct 2022 12:34:58 +0000 (14:34 +0200)] 
tests: disable nonfunctional tests under qemu user emulation

2 years agoci: don't run make with infinite parallel jobs
Thomas Weißschuh [Sat, 8 Oct 2022 02:12:43 +0000 (04:12 +0200)] 
ci: don't run make with infinite parallel jobs

2 years agofadvice: delete a unused struct definition
Masatake YAMATO [Mon, 17 Oct 2022 20:12:23 +0000 (05:12 +0900)] 
fadvice: delete a unused struct definition

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agoMerge branch 'autotools/endianess' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 17 Oct 2022 08:15:28 +0000 (10:15 +0200)] 
Merge branch 'autotools/endianess' of https://github.com/t-8ch/util-linux

* 'autotools/endianess' of https://github.com/t-8ch/util-linux:
  autotools: stop using AC_C_BIGENDIAN / WORDS_BIGENDIAN

2 years agoMerge branch 'new-guids' of https://github.com/thesamesam/util-linux
Karel Zak [Mon, 17 Oct 2022 07:56:47 +0000 (09:56 +0200)] 
Merge branch 'new-guids' of https://github.com/thesamesam/util-linux

* 'new-guids' of https://github.com/thesamesam/util-linux:
  include: Add additional GPT partition types (HPPA/PARISC)

2 years agolibblkid: cleanup cramfs_verify_csum()
Karel Zak [Mon, 17 Oct 2022 07:55:59 +0000 (09:55 +0200)] 
libblkid: cleanup cramfs_verify_csum()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'cramfs/csum' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 17 Oct 2022 07:43:02 +0000 (09:43 +0200)] 
Merge branch 'cramfs/csum' of https://github.com/t-8ch/util-linux

* 'cramfs/csum' of https://github.com/t-8ch/util-linux:
  libblkid: cramfs: add checksum support

2 years agoMerge branch 'master' of https://github.com/Mango0x45/util-linux
Karel Zak [Mon, 17 Oct 2022 07:41:04 +0000 (09:41 +0200)] 
Merge branch 'master' of https://github.com/Mango0x45/util-linux

* 'master' of https://github.com/Mango0x45/util-linux:
  build-sys: sort the gitignore and add fadvise

2 years agomkfs.cramfs: Support BSD lock
root [Sun, 16 Oct 2022 15:53:02 +0000 (23:53 +0800)] 
mkfs.cramfs: Support BSD lock

Addresses: #1842 #921
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomkfs.bfs: Support BSD lock
plus [Thu, 13 Oct 2022 08:37:20 +0000 (16:37 +0800)] 
mkfs.bfs: Support BSD lock

Addresses: #1842 #921
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: ext - avoid undefined shift
Milan Broz [Thu, 13 Oct 2022 12:59:15 +0000 (14:59 +0200)] 
libblkid: ext - avoid undefined shift

Ext filesystems probe can use undefined shift if s_log_block_size
is a bogus value. Avoid this by limiting shift size.

Reproducer found with OSS-Fuzz (issue 52370) running over
cryptsetup project (blkid is used in header init).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: erofs - avoid undefined shift
Milan Broz [Wed, 12 Oct 2022 21:02:27 +0000 (23:02 +0200)] 
libblkid: erofs - avoid undefined shift

Erofs probe can use undefined shift if blkszbits
is a bogus value. Avoid this by limiting shift size.

Reproducer found with OSS-Fuzz (issue 52298) running over
cryptsetup project (blkid is used in header init).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofsck: Processes may kill other processes.
zhanchengbin [Mon, 10 Oct 2022 09:23:24 +0000 (17:23 +0800)] 
fsck: Processes may kill other processes.

A error in disk-utils/fsck.c, if run the fsck -N command, processes
don't execute, just show what would be done. However, the pid whose
value is -1 is added to the instance_list list in the execute
function,if the kill_all function is called later, kill(-1, signum)
is executed, Signals are sent to all processes except the number one
process and itself. Other processes will be killed if they use the
default signal processing function.

Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
2 years agoinclude: Add additional GPT partition types (HPPA/PARISC)
Sam James [Fri, 14 Oct 2022 21:41:51 +0000 (22:41 +0100)] 
include: Add additional GPT partition types (HPPA/PARISC)

See https://github.com/systemd/systemd/commit/5a9276f65981528f05025f8cc0fa03b6006b297f.

Signed-off-by: Sam James <sam@gentoo.org>
2 years agoautotools: stop using AC_C_BIGENDIAN / WORDS_BIGENDIAN
Thomas Weißschuh [Fri, 14 Oct 2022 19:54:47 +0000 (21:54 +0200)] 
autotools: stop using AC_C_BIGENDIAN / WORDS_BIGENDIAN

This define is specific to autotools. Not defining the macro will lead
to silently miscompiled code as has happened with the meson build.

Instead use macros provided by the compiler itself. It does not need any
support from the buildsystem and is supported by both gcc and clang.

If a compiler does not support this feature we will get a loud error
instead of silent miscompilation.

Furthermore it probably better supports universal binaries on macOS
which compiles multiple architectures in a single build.

2 years agolibblkid: cramfs: add checksum support
Thomas Weißschuh [Thu, 13 Oct 2022 22:33:54 +0000 (00:33 +0200)] 
libblkid: cramfs: add checksum support

2 years agobuild-sys: sort the gitignore and add fadvise
Thomas Voss [Thu, 13 Oct 2022 17:58:59 +0000 (19:58 +0200)] 
build-sys: sort the gitignore and add fadvise

The fadvise binary was missing from the .gitignore, so it's been added.
At the same time I also sorted the binaries for those nice eye candy
points :)

2 years agoMerge branch 'apfs/test' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 13 Oct 2022 07:31:27 +0000 (09:31 +0200)] 
Merge branch 'apfs/test' of https://github.com/t-8ch/util-linux

* 'apfs/test' of https://github.com/t-8ch/util-linux:
  libblkid: apfs: add test

2 years agoMerge branch 'meson/xattr' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 13 Oct 2022 07:30:30 +0000 (09:30 +0200)] 
Merge branch 'meson/xattr' of https://github.com/t-8ch/util-linux

* 'meson/xattr' of https://github.com/t-8ch/util-linux:
  meson: use uniform indentation
  meson: check for xattr functions

2 years agolibblkid: apfs: add test
Thomas Weißschuh [Mon, 10 Oct 2022 21:07:25 +0000 (23:07 +0200)] 
libblkid: apfs: add test

Fixes #1807

Information known to macOS:
```
$ hdiutil attach apfs.img
/dev/disk1
/dev/disk2              EF57347C-0000-11AA-AA11-0030654
/dev/disk2s1            41504653-0000-11AA-AA11-0030654 /Volumes/testapfs

$ diskutil info disk2
   Device Identifier:        disk2
   Device Node:              /dev/disk2
   Whole:                    Yes
   Part of Whole:            disk2
   Device / Media Name:      Disk Image

   Volume Name:              Not applicable (no file system)
   Mounted:                  Not applicable (no file system)
   File System:              None

   Content (IOContent):      EF57347C-0000-11AA-AA11-00306543ECAC
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Disk / Partition UUID:    25E5F1D3-11C0-4D36-98A5-3F66953519B9

   Disk Size:                10.5 MB (10485760 Bytes) (exactly 20480 512-Byte-Units)
   Device Block Size:        4096 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (no file system)

   Device Location:          External
   Removable Media:          Removable
   Media Removal:            Software-Activated

   Virtual:                  Yes

$ diskutil info disk2s1
   Device Identifier:        disk2s1
   Device Node:              /dev/disk2s1
   Whole:                    No
   Part of Whole:            disk2

   Volume Name:              testapfs
   Mounted:                  Yes
   Mount Point:              /Volumes/testapfs

   Partition Type:           41504653-0000-11AA-AA11-00306543ECAC
   File System Personality:  APFS
   Type (Bundle):            apfs
   Name (User Visible):      APFS
   Owners:                   Disabled

   OS Can Be Installed:      Yes
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              3EA5C1EF-64CB-447C-AE37-8046CDC35010
   Disk / Partition UUID:    3EA5C1EF-64CB-447C-AE37-8046CDC35010

   Disk Size:                10.5 MB (10485760 Bytes) (exactly 20480 512-Byte-Units)
   Device Block Size:        4096 Bytes

   Volume Total Space:       10.5 MB (10485760 Bytes) (exactly 20480 512-Byte-Units)
   Volume Used Space:        376.8 KB (376832 Bytes) (exactly 736 512-Byte-Units) (3.6%)
   Volume Free Space:        10.1 MB (10108928 Bytes) (exactly 19744 512-Byte-Units) (96.4%)
   Allocation Block Size:    4096 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No

   Device Location:          External
   Removable Media:          Removable
   Media Removal:            Software-Activated
```

2 years agomeson: use uniform indentation
Thomas Weißschuh [Mon, 10 Oct 2022 16:30:01 +0000 (18:30 +0200)] 
meson: use uniform indentation

2 years agomeson: check for xattr functions
Thomas Weißschuh [Mon, 10 Oct 2022 16:28:16 +0000 (18:28 +0200)] 
meson: check for xattr functions

2 years agotest_mkfds: avoid multiplication overflow
Thomas Weißschuh [Mon, 10 Oct 2022 16:00:07 +0000 (18:00 +0200)] 
test_mkfds: avoid multiplication overflow

2 years agomeson: build test_mkfds
Thomas Weißschuh [Mon, 10 Oct 2022 14:08:10 +0000 (16:08 +0200)] 
meson: build test_mkfds

2 years agolibblkid: btrfs - avoid calling clz with zero argument
Milan Broz [Mon, 10 Oct 2022 06:29:22 +0000 (08:29 +0200)] 
libblkid: btrfs - avoid calling clz with zero argument

If btrfs superblock contains unknown checksum type,
the values are parsed anyway.

Bogus sector size then can lead to clz() with zero argument
(this is undefined).

Reproducer found with OSS-Fuzz (issue 52286) running over
cryptsetup project (blkid is used in header init).

2 years agolibblkid: avoid buffer overflow in ocfs superblock parsing
Milan Broz [Sun, 9 Oct 2022 18:20:45 +0000 (20:20 +0200)] 
libblkid: avoid buffer overflow in ocfs superblock parsing

Label and mount values are checked only according to on-disk
values and not checked against the real structure size.
This can lead to reading of memory outside of superblock
struct and subsequent crash.

Reproducer found with OSS-Fuzz (issue 52270) running over
cryptsetup project (blkid is used in header init).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2 years agouuidd: fix random UUIDs
Karel Zak [Mon, 10 Oct 2022 07:37:51 +0000 (09:37 +0200)] 
uuidd: fix random UUIDs

Commit f27876f introduces copy & past bug and replaces
__uuid_generate_random() with __uuid_generate_time().

Fixes: https://github.com/util-linux/util-linux/issues/1837
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'lsfd-sock-column-namespace' of https://github.com/masatake/util-linux
Karel Zak [Mon, 10 Oct 2022 07:29:34 +0000 (09:29 +0200)] 
Merge branch 'lsfd-sock-column-namespace' of https://github.com/masatake/util-linux

* 'lsfd-sock-column-namespace' of https://github.com/masatake/util-linux:
  lsfd: <breaking comaptiblity> move PROTONAME column to SOCK. column namespace
  lsfd: introduce SOCK. column namespace

2 years agoMerge branch 'patch-1' of https://github.com/jamacku/util-linux
Karel Zak [Mon, 10 Oct 2022 07:11:46 +0000 (09:11 +0200)] 
Merge branch 'patch-1' of https://github.com/jamacku/util-linux

* 'patch-1' of https://github.com/jamacku/util-linux:
  ci: Update Differential ShellCheck GitHub Action

2 years agoci: Update Differential ShellCheck GitHub Action
Jan Macku [Fri, 7 Oct 2022 12:41:15 +0000 (14:41 +0200)] 
ci: Update Differential ShellCheck GitHub Action

The new version of Differential ShellCheck GitHub Action brings many improvements:

- External sourcing by default (`shellcheck -x`)
- Improved shell script autodetection
- and more

2 years agofadvise: add bash-completion script
Masatake YAMATO [Tue, 4 Oct 2022 16:52:45 +0000 (01:52 +0900)] 
fadvise: add bash-completion script

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: <breaking comaptiblity> move PROTONAME column to SOCK. column namespace
Masatake YAMATO [Sat, 1 Oct 2022 21:16:29 +0000 (06:16 +0900)] 
lsfd: <breaking comaptiblity> move PROTONAME column to SOCK. column namespace

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: introduce SOCK. column namespace
Masatake YAMATO [Sat, 1 Oct 2022 21:00:50 +0000 (06:00 +0900)] 
lsfd: introduce SOCK. column namespace

lsfd has many columns already. We will add more in the future.
e.g. --help output is too long.

Groping columns is one of the ways to improve the usability of lsfd.
As the first step, this change introduces the "SOCK." column namespace.

Conceptually SOCKNETNS, SOCKSTATE, and SOCKTYPE migrate to the
namespace.  At the implementation level, they are renamed to
SOCK.NETNS, SOCK.STATE, and SOCK.TYPE.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolibblkid: (xfs) fix typo in operators [coverity scan]
Karel Zak [Mon, 3 Oct 2022 09:05:39 +0000 (11:05 +0200)] 
libblkid: (xfs) fix typo in operators [coverity scan]

Addresses: https://github.com/util-linux/util-linux/pull/1804
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: (xfs) cleanup checksum code
Karel Zak [Mon, 3 Oct 2022 08:30:23 +0000 (10:30 +0200)] 
libblkid: (xfs) cleanup checksum code

* move variables definition to the begin of the block
* check blkid_probe_get_sb_buffer() result [detected by coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'lsfd-inet-xinfo' of https://github.com/masatake/util-linux
Karel Zak [Mon, 3 Oct 2022 07:49:07 +0000 (09:49 +0200)] 
Merge branch 'lsfd-inet-xinfo' of https://github.com/masatake/util-linux

* 'lsfd-inet-xinfo' of https://github.com/masatake/util-linux:
  lsfd: (man) write about TCP scokets
  tests: (lsfd) add a case testing TCP sockets
  lsfd: use extra information loaded from /proc/net/tcp
  lsfd: cosmetic change, delete whitespaces
  lsfd: add SOCKLISTENING column

2 years agolsfd: (man) write about TCP scokets
Masatake YAMATO [Sat, 1 Oct 2022 20:35:58 +0000 (05:35 +0900)] 
lsfd: (man) write about TCP scokets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) add a case testing TCP sockets
Masatake YAMATO [Sat, 1 Oct 2022 19:36:40 +0000 (04:36 +0900)] 
tests: (lsfd) add a case testing TCP sockets

This tests INET.LADDR, INET.RADDR, TCP.LADDR, TCP.LPORT,
TCP.RADDR, and TCP.RPORT columns.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use extra information loaded from /proc/net/tcp
Masatake YAMATO [Sat, 1 Oct 2022 04:24:27 +0000 (13:24 +0900)] 
lsfd: use extra information loaded from /proc/net/tcp

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: cosmetic change, delete whitespaces
Masatake YAMATO [Sat, 1 Oct 2022 03:04:42 +0000 (12:04 +0900)] 
lsfd: cosmetic change, delete whitespaces

2 years agolsfd: add SOCKLISTENING column
Masatake YAMATO [Sat, 1 Oct 2022 20:16:54 +0000 (05:16 +0900)] 
lsfd: add SOCKLISTENING column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agofadvise: new command wrapping posix_fadvise
Masatake YAMATO [Fri, 23 Sep 2022 22:10:51 +0000 (07:10 +0900)] 
fadvise: new command wrapping posix_fadvise

For measuring and monitoring the performance aspect of a command,
people may want to drop the page caches related to specified files.

In some cases, writing 1 to /proc/sys/vm/drop_caches is overkill.  The
fadvise command can be used for dropping page caches related to
specified files; the impact on a system is much smaller than
/proc/sys/vm/drop_caches.

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