]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 years agoMerge branch 'lsfd-sock-unix-xinfo' of https://github.com/masatake/util-linux
Karel Zak [Fri, 30 Sep 2022 08:44:55 +0000 (10:44 +0200)] 
Merge branch 'lsfd-sock-unix-xinfo' of https://github.com/masatake/util-linux

* 'lsfd-sock-unix-xinfo' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case for testing SOCKNETNS column
  tests: (lsfd) extend unix-stream test case to test SEQPACKET socket
  tests: (lsfd) add a case testing UNIX+DGRAM socket
  tests: (lsfd) add a case testing UNIX-STREAM sockets
  tests: (mkfds) add a factory making unix sockets
  lsfd: (man) write about UNIX-STREAM and UNIX sockets
  lsfd: use extra information loaded from /proc/net/unix
  lsfd: add new columns: SOCKNETNS, SOCKSTATE, and SOCKTYPE as stubs
  lsfd: facilitate the way to attach extra info loaded from /proc/net/* to sockets
  tests: (mkfds) quit when a byte is given via standard input
  tests: (mkfds) call close method of factory only when it is specified
  tests: (mkfds) cosmetic change, deleting empty lines
  tests: (mkfds) add boolean, a new parameter type
  tests: (mkfds) add a method for printing factory specific data to struct factory
  tests: (mkfds) allow a factory to make a factory specific temporarily data
  tests: (mkfds) delete unused "child" parameter for factories
  tests: (mkfds) delete per-factory "fork" field

2 years agoMerge branch 'ynezz/aarch64-kernel-5.15-lscpu-crash-fix' of https://github.com/ynezz...
Karel Zak [Fri, 30 Sep 2022 08:43:44 +0000 (10:43 +0200)] 
Merge branch 'ynezz/aarch64-kernel-5.15-lscpu-crash-fix' of https://github.com/ynezz/util-linux

* 'ynezz/aarch64-kernel-5.15-lscpu-crash-fix' of https://github.com/ynezz/util-linux:
  lib/path: ul_path_cpuparse: fix parsing of empty sysfs files

2 years agoMerge branch 'codeql' of https://github.com/mrc0mmand/util-linux
Karel Zak [Fri, 30 Sep 2022 08:43:14 +0000 (10:43 +0200)] 
Merge branch 'codeql' of https://github.com/mrc0mmand/util-linux

* 'codeql' of https://github.com/mrc0mmand/util-linux:
  ci: use CodeQL instead of LGTM

2 years agoMerge branch 'xfs/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 30 Sep 2022 08:42:13 +0000 (10:42 +0200)] 
Merge branch 'xfs/checksum' of https://github.com/t-8ch/util-linux

* 'xfs/checksum' of https://github.com/t-8ch/util-linux:
  libblkid: superblocks: add trailing comma to array
  libblkid: xfs: add checksum support
  libblkid: xfs: add more superblock fields

2 years agolib/path: ul_path_cpuparse: fix parsing of empty sysfs files
Petr Štetiar [Thu, 22 Sep 2022 09:49:13 +0000 (11:49 +0200)] 
lib/path: ul_path_cpuparse: fix parsing of empty sysfs files

Kernel 5.15 returns empty content for topology/thread_siblings on
aarch64 platform, which in conjunction of uninitialized `buf` memory
buffer results in the garbage:

 (gdb) p buf
 $14 = " @\377\367\177\000\000\000\275\000\347j\032\236"

This garbage is then being later consumed by underlying helper functions
like for example cpumask_parse() and this leads to the following crash
later:

 in __libc_free (p=0x7ff7f67c00) at src/malloc/mallocng/free.c:105
 in free (p=<optimized out>) at src/malloc/free.c:5
 in add_cpuset_to_array (setsize=<optimized out>, set=<optimized out>, items=<optimized out>, ary=<optimized out>) at ../sys-utils/lscpu-topology.c:29
 in cputype_read_topology (cxt=cxt@entry=0x7ff7fffe70, ct=0x4298a0) at ../sys-utils/lscpu-topology.c:153
 in lscpu_read_topology (cxt=cxt@entry=0x7ff7fffe70) at ../sys-utils/lscpu-topology.c:629
 in main (argc=1, argv=0x7ffffffdb8) at ../sys-utils/lscpu.c:1341

It looks like the problem is that current logic expects fgets() to set
errno on failure, but fgets() is not documented to do so and and neither
glibc nor musl set errno.  So if errno was set to 0 before fgets() call,
the failure from fgets() is ignored and then invalid buffer is being
parsed.

Fixes: #1810
Suggested-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2 years agotests: (lsfd) add a case for testing SOCKNETNS column
Masatake YAMATO [Sat, 24 Sep 2022 17:17:59 +0000 (02:17 +0900)] 
tests: (lsfd) add a case for testing SOCKNETNS column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) extend unix-stream test case to test SEQPACKET socket
Masatake YAMATO [Sat, 24 Sep 2022 09:21:30 +0000 (18:21 +0900)] 
tests: (lsfd) extend unix-stream test case to test SEQPACKET socket

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) add a case testing UNIX+DGRAM socket
Masatake YAMATO [Sat, 24 Sep 2022 08:54:38 +0000 (17:54 +0900)] 
tests: (lsfd) add a case testing UNIX+DGRAM socket

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) add a case testing UNIX-STREAM sockets
Masatake YAMATO [Fri, 23 Sep 2022 19:23:27 +0000 (04:23 +0900)] 
tests: (lsfd) add a case testing UNIX-STREAM sockets

This tests STTYPE, NAME, SOCKSTATE, SOCKTYPE, and UNIX.PATH columns.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) add a factory making unix sockets
Masatake YAMATO [Fri, 23 Sep 2022 18:20:30 +0000 (03:20 +0900)] 
tests: (mkfds) add a factory making unix sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: (man) write about UNIX-STREAM and UNIX sockets
Masatake YAMATO [Fri, 23 Sep 2022 19:45:03 +0000 (04:45 +0900)] 
lsfd: (man) write about UNIX-STREAM and UNIX sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use extra information loaded from /proc/net/unix
Masatake YAMATO [Tue, 20 Sep 2022 21:16:15 +0000 (06:16 +0900)] 
lsfd: use extra information loaded from /proc/net/unix

The loaded information is displayed at SOCKNETNS, SOCKSTATE,
SOCKTYPE, and/or UNIX.PATH columns of UNIX-STREAM and UNIX
typed sockets.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: add new columns: SOCKNETNS, SOCKSTATE, and SOCKTYPE as stubs
Masatake YAMATO [Tue, 20 Sep 2022 21:03:56 +0000 (06:03 +0900)] 
lsfd: add new columns: SOCKNETNS, SOCKSTATE, and SOCKTYPE as stubs

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: facilitate the way to attach extra info loaded from /proc/net/* to sockets
Masatake YAMATO [Tue, 20 Sep 2022 20:25:49 +0000 (05:25 +0900)] 
lsfd: facilitate the way to attach extra info loaded from /proc/net/* to sockets

Files under /proc/net/ like unix, tcp, udp, etc. provides extra
information about sockets. To unitize these information in
lsfd, this change adds stub for loading the information form
/proc/net/* and attaching it to struct file presenting sockets.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) quit when a byte is given via standard input
Masatake YAMATO [Fri, 23 Sep 2022 17:38:24 +0000 (02:38 +0900)] 
tests: (mkfds) quit when a byte is given via standard input

The original code monitored only SIGCONT.  It is suitable for using
the command from a test script.  Monitoring standard input is helpful
for developing a new factory interactively.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) call close method of factory only when it is specified
Masatake YAMATO [Fri, 23 Sep 2022 06:33:50 +0000 (15:33 +0900)] 
tests: (mkfds) call close method of factory only when it is specified

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) cosmetic change, deleting empty lines
Masatake YAMATO [Fri, 23 Sep 2022 01:34:31 +0000 (10:34 +0900)] 
tests: (mkfds) cosmetic change, deleting empty lines

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) add boolean, a new parameter type
Masatake YAMATO [Fri, 23 Sep 2022 01:32:56 +0000 (10:32 +0900)] 
tests: (mkfds) add boolean, a new parameter type

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) add a method for printing factory specific data to struct factory
Masatake YAMATO [Thu, 22 Sep 2022 18:42:44 +0000 (03:42 +0900)] 
tests: (mkfds) add a method for printing factory specific data to struct factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) allow a factory to make a factory specific temporarily data
Masatake YAMATO [Thu, 22 Sep 2022 01:51:33 +0000 (10:51 +0900)] 
tests: (mkfds) allow a factory to make a factory specific temporarily data

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) delete unused "child" parameter for factories
Masatake YAMATO [Wed, 21 Sep 2022 18:13:30 +0000 (03:13 +0900)] 
tests: (mkfds) delete unused "child" parameter for factories

Any factory has never used the parameter.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) delete per-factory "fork" field
Masatake YAMATO [Wed, 21 Sep 2022 18:03:58 +0000 (03:03 +0900)] 
tests: (mkfds) delete per-factory "fork" field

Any factory has never used the field.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolibsmartcols: (sample) remove hidden variable [CodeQL scan]
Karel Zak [Wed, 21 Sep 2022 07:42:12 +0000 (09:42 +0200)] 
libsmartcols: (sample) remove hidden variable [CodeQL scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoci: use CodeQL instead of LGTM
Frantisek Sumsal [Wed, 14 Sep 2022 09:33:51 +0000 (11:33 +0200)] 
ci: use CodeQL instead of LGTM

As LGTM is going to be shut down by EOY[0], let's move the code scanning to
CodeQL as recommended. Thanks to GH integration the results from such
scans will be shown both in the respective PR and in the Security ->
Code Scanning tab[1].

[0] https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/
[1] https://github.com/util-linux/util-linux/security/code-scanning

2 years agowrite: (man) fix history section
Karel Zak [Mon, 19 Sep 2022 12:35:24 +0000 (14:35 +0200)] 
write: (man) fix history section

Fixes: https://github.com/util-linux/util-linux/issues/1817
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolsblk: fix endless loop if device specified more than once
Karel Zak [Mon, 19 Sep 2022 12:23:25 +0000 (14:23 +0200)] 
lsblk: fix endless loop if device specified more than once

Fixes: https://github.com/util-linux/util-linux/issues/1814
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolscpu: use topology maps in more robust way
Karel Zak [Mon, 19 Sep 2022 11:30:14 +0000 (13:30 +0200)] 
lscpu: use topology maps in more robust way

Addresses: https://github.com/util-linux/util-linux/issues/1810
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'lsfd-fix-counter-spec' of https://github.com/masatake/util-linux
Karel Zak [Mon, 19 Sep 2022 11:06:43 +0000 (13:06 +0200)] 
Merge branch 'lsfd-fix-counter-spec' of https://github.com/masatake/util-linux

* 'lsfd-fix-counter-spec' of https://github.com/masatake/util-linux:
  lsfd: fix wrong counter expression used in --summary output

2 years agoMerge branch 'ubi/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 19 Sep 2022 10:48:47 +0000 (12:48 +0200)] 
Merge branch 'ubi/checksum' of https://github.com/t-8ch/util-linux

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

2 years agoMerge branch 'zonefs/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 19 Sep 2022 10:47:10 +0000 (12:47 +0200)] 
Merge branch 'zonefs/checksum' of https://github.com/t-8ch/util-linux

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

2 years agoMerge branch 'bcache/cleanup' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 19 Sep 2022 10:38:49 +0000 (12:38 +0200)] 
Merge branch 'bcache/cleanup' of https://github.com/t-8ch/util-linux

* 'bcache/cleanup' of https://github.com/t-8ch/util-linux:
  libblkid: bcache: report wiped area
  libblkid: bcache: remove unused macros

2 years agoMerge branch 'linux_raid/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 19 Sep 2022 10:38:06 +0000 (12:38 +0200)] 
Merge branch 'linux_raid/checksum' of https://github.com/t-8ch/util-linux

* 'linux_raid/checksum' of https://github.com/t-8ch/util-linux:
  libblkid: linux_raid: add checksum support
  libblkid: mdraid: add test for version 1 superblock

2 years agoMerge branch 'f2fs/fixes' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 19 Sep 2022 10:36:16 +0000 (12:36 +0200)] 
Merge branch 'f2fs/fixes' of https://github.com/t-8ch/util-linux

* 'f2fs/fixes' of https://github.com/t-8ch/util-linux:
  libblkid: f2fs: ensure checksum offset is within superblock
  libblkid: f2fs: fix checksum initialization on big-endian

2 years agolibblkid: (erofs) make blocksize use more restrictive
Karel Zak [Mon, 19 Sep 2022 10:04:37 +0000 (12:04 +0200)] 
libblkid: (erofs) make blocksize use more restrictive

* make sure we do not use any huge number when read from the device

* cleanup the code

Addresses: https://github.com/util-linux/util-linux/pull/1799
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoRevert "libblkid: luks: add checksum support"
Karel Zak [Mon, 19 Sep 2022 09:39:09 +0000 (11:39 +0200)] 
Revert "libblkid: luks: add checksum support"

See discussion at https://github.com/util-linux/util-linux/pull/1801

The change is unwanted by LUKS upstream developers, the checksum
functionality is designed for libcryptsetup internal use only.
Issues:

* introduces security issue (allocated buffer is not checked agaisnt
  maximal value) - inserting LUKS2 device with header faking oversized
  header size will cause allocating of huge amount of memory (perhaps
  crash of blkid)
* we support JSON area up to 4MB in size (checksum covers also this part
  that was not intended to be read by blkid) - calculating SHA256 for
  such area is really not fast operation; readin of 4MB of data is waste
  of resources either (that's why there is smaill 4k binary header)
* even if checksum check is disabled, it is calculated (complete waste
  of time here)
* it does not support anything else that SHA256 (we can switch to different
  hash or other algorithm later); blkid should not introduce such limits.
* checksum for the second heder is not calculated at all

This reverts commit eca0d8b8b1360f745131158bf6b5b5c1c04d98c9.

Signed-off-by: Karel Zak <kzak@redhat.com>
Addresses: https://github.com/util-linux/util-linux/pull/1801

2 years agolibblkid: superblocks: add trailing comma to array
Thomas Weißschuh [Wed, 14 Sep 2022 11:10:30 +0000 (13:10 +0200)] 
libblkid: superblocks: add trailing comma to array

This avoids spurious changes for future additions.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: xfs: add checksum support
Thomas Weißschuh [Tue, 13 Sep 2022 09:47:05 +0000 (11:47 +0200)] 
libblkid: xfs: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: f2fs: ensure checksum offset is within superblock
Thomas Weißschuh [Sun, 18 Sep 2022 18:14:47 +0000 (20:14 +0200)] 
libblkid: f2fs: ensure checksum offset is within superblock

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: f2fs: fix checksum initialization on big-endian
Thomas Weißschuh [Sun, 18 Sep 2022 18:12:59 +0000 (20:12 +0200)] 
libblkid: f2fs: fix checksum initialization on big-endian

Fixes #1813

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolsfd: fix wrong counter expression used in --summary output
Masatake YAMATO [Sat, 17 Sep 2022 17:48:44 +0000 (02:48 +0900)] 
lsfd: fix wrong counter expression used in --summary output

In be019f664db6eef7f2df38d31f1627d74a82fe65, I changed the
counter expression used in --summary output unexpectedly.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolibblkid: ubifs: add checksum support
Thomas Weißschuh [Tue, 13 Sep 2022 12:26:37 +0000 (14:26 +0200)] 
libblkid: ubifs: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: zonefs: add checksum support
Thomas Weißschuh [Tue, 13 Sep 2022 11:08:49 +0000 (13:08 +0200)] 
libblkid: zonefs: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: ubi: add checksum support
Thomas Weißschuh [Tue, 13 Sep 2022 12:09:34 +0000 (14:09 +0200)] 
libblkid: ubi: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: xfs: add more superblock fields
Thomas Weißschuh [Tue, 13 Sep 2022 08:43:01 +0000 (10:43 +0200)] 
libblkid: xfs: add more superblock fields

We need sb_crc for checksum support.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: linux_raid: add checksum support
Thomas Weißschuh [Sun, 11 Sep 2022 15:05:09 +0000 (17:05 +0200)] 
libblkid: linux_raid: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: mdraid: add test for version 1 superblock
Thomas Weißschuh [Sun, 11 Sep 2022 14:53:48 +0000 (16:53 +0200)] 
libblkid: mdraid: add test for version 1 superblock

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: bcache: report wiped area
Thomas Weißschuh [Mon, 12 Apr 2021 12:11:15 +0000 (14:11 +0200)] 
libblkid: bcache: report wiped area

make-bcache always clears the first 0x1000 bytes

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: bcache: remove unused macros
Thomas Weißschuh [Mon, 12 Apr 2021 11:56:29 +0000 (13:56 +0200)] 
libblkid: bcache: remove unused macros

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoMerge branch 'luks/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 13 Sep 2022 07:11:58 +0000 (09:11 +0200)] 
Merge branch 'luks/checksum' of https://github.com/t-8ch/util-linux

* 'luks/checksum' of https://github.com/t-8ch/util-linux:
  libblkid: luks: add checksum support
  lib: add sha256 implementation

2 years agoMerge branch 'bcache/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 13 Sep 2022 07:10:00 +0000 (09:10 +0200)] 
Merge branch 'bcache/checksum' of https://github.com/t-8ch/util-linux

* 'bcache/checksum' of https://github.com/t-8ch/util-linux:
  libblkid: bcache: add checksum support
  libblkid: add blkid_probe_get_sb_buffer()
  lib: add crc64 implementation

2 years agoMerge branch 'erofs/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 13 Sep 2022 07:07:33 +0000 (09:07 +0200)] 
Merge branch 'erofs/checksum' of https://github.com/t-8ch/util-linux

* 'erofs/checksum' of https://github.com/t-8ch/util-linux:
  libblkid: erofs: add checksum support
  libblkid: add blkid_probe_get_sb_buffer()

2 years agoMerge branch 'f2fs/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 13 Sep 2022 07:05:46 +0000 (09:05 +0200)] 
Merge branch 'f2fs/checksum' of https://github.com/t-8ch/util-linux

* 'f2fs/checksum' of https://github.com/t-8ch/util-linux:
  blkid: f2fs: update testfile to include checksum
  libblkid: f2fs: add checksum support

2 years agoMerge branch 'exfat/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 13 Sep 2022 07:04:59 +0000 (09:04 +0200)] 
Merge branch 'exfat/checksum' of https://github.com/t-8ch/util-linux

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

2 years agoMerge branch 'btrfs/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 13 Sep 2022 07:04:07 +0000 (09:04 +0200)] 
Merge branch 'btrfs/checksum' of https://github.com/t-8ch/util-linux

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

2 years agoMerge branch 'lsfd-refine-columns' of https://github.com/masatake/util-linux
Karel Zak [Tue, 13 Sep 2022 06:57:49 +0000 (08:57 +0200)] 
Merge branch 'lsfd-refine-columns' of https://github.com/masatake/util-linux

* 'lsfd-refine-columns' of https://github.com/masatake/util-linux:
  lsfd: cosmetic change
  lsfd: (man) write about PIDFD.* columns
  lsfd: show pid, comm, and nspid of pidfd in PIDFD.{PID,COMM,NSPID} columns
  lsfd: (filter): accept '.' used in column names
  tests: (lsfd) fix the potential problems reported by github-code-scan
  tests: (lsfd) put double quote characters around variable expansions
  lsfd: use NAME column to show cooked file names
  lsfd: use TYPE column to show cooked file types
  lsfd: show classes of anonyomous inodes in AINODECLASS column
  lsfd: cosmetic changes
  tests: (mkfds) add a factory for making an inotify fd
  tests: (mkfds) cosmetic change, deleting an empty line

2 years agolibblkid: luks: add checksum support
Thomas Weißschuh [Sun, 11 Sep 2022 13:46:19 +0000 (15:46 +0200)] 
libblkid: luks: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolib: add sha256 implementation
Thomas Weißschuh [Sun, 11 Sep 2022 14:15:18 +0000 (16:15 +0200)] 
lib: add sha256 implementation

Based on src/crypt/crypt_sha256.c from musl  v1.2.3[0]

https://musl.libc.org/releases/musl-1.2.3.tar.gz

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: bcache: add checksum support
Thomas Weißschuh [Sun, 11 Sep 2022 11:44:10 +0000 (13:44 +0200)] 
libblkid: bcache: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: add blkid_probe_get_sb_buffer()
Thomas Weißschuh [Mon, 19 Apr 2021 17:32:00 +0000 (19:32 +0200)] 
libblkid: add blkid_probe_get_sb_buffer()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolib: add crc64 implementation
Thomas Weißschuh [Sun, 11 Sep 2022 11:15:40 +0000 (13:15 +0200)] 
lib: add crc64 implementation

This was lifted from libcrc [0] commit 7719e2112a9a960b1bba130d02bebdf58e8701f1

https://github.com/lammertb/libcrc

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolsfd: cosmetic change
Masatake YAMATO [Fri, 9 Sep 2022 17:11:52 +0000 (02:11 +0900)] 
lsfd: cosmetic change

Sort the elements in "struct colinfo infos" array literal.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: (man) write about PIDFD.* columns
Masatake YAMATO [Fri, 9 Sep 2022 17:09:01 +0000 (02:09 +0900)] 
lsfd: (man) write about PIDFD.* columns

2 years agolsfd: show pid, comm, and nspid of pidfd in PIDFD.{PID,COMM,NSPID} columns
Masatake YAMATO [Fri, 9 Sep 2022 17:03:45 +0000 (02:03 +0900)] 
lsfd: show pid, comm, and nspid of pidfd in PIDFD.{PID,COMM,NSPID} columns

The values shown in the new columns are already shown in NAME column.
Showing these values together in the NAME column helps users
understand the pidfds opened quickly. However, the showing them
together is not suitable for machine processing. The newly introduced
columns are for machine processing.

Below an example output:

    $ ./lsfd -o COMMAND,TYPE,PIDFD.COMM,PIDFD.PID -Q '(TYPE == "pidfd")'
    COMMAND          TYPE PIDFD.COMM  PIDFD.PID
    dbus-broker-lau pidfd dbus-broker      4661
    dbus-broker-lau pidfd dbus-broker      4924

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: (filter): accept '.' used in column names
Masatake YAMATO [Fri, 9 Sep 2022 15:40:19 +0000 (00:40 +0900)] 
lsfd: (filter): accept '.' used in column names

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) fix the potential problems reported by github-code-scan
Masatake YAMATO [Fri, 9 Sep 2022 15:38:37 +0000 (00:38 +0900)] 
tests: (lsfd) fix the potential problems reported by github-code-scan

Use arrays.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) put double quote characters around variable expansions
Masatake YAMATO [Fri, 9 Sep 2022 15:38:37 +0000 (00:38 +0900)] 
tests: (lsfd) put double quote characters around variable expansions

This fixes the potential problems reported by github-code-scan.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use NAME column to show cooked file names
Masatake YAMATO [Mon, 5 Sep 2022 21:27:50 +0000 (06:27 +0900)] 
lsfd: use NAME column to show cooked file names

This change splits the NAME column
into cooked NAME column and raw KNAME column.

KNAME represents the type information extracted from /proc/$pid/fd or
/proc/$pid/map_files. NAME is the same as KNAME but humans friendly
and talkative if a special handler is implemented for the type of the
file.

Currently only pidfd has such a handler.

Below an example output:

    $ ./lsfd -o TYPE,STTYPE,KNAME,NAME -Q '(TYPE == "pidfd")'
     TYPE STTYPE KNAME              NAME
    pidfd   UNKN anon_inode:[pidfd] pid=4661 comm=dbus-broker nspid=4661
    pidfd   UNKN anon_inode:[pidfd] pid=4924 comm=dbus-broker nspid=4924

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolib/timeutils: Require '@' prefix for seconds since the Epoch timestamp
Peter Ujfalusi [Wed, 7 Sep 2022 05:41:41 +0000 (08:41 +0300)] 
lib/timeutils: Require '@' prefix for seconds since the Epoch timestamp

Since the seconds since the Epoch is just a number it might be better to
require special prefix to indicate the intention that the user wants to
interpret the number as seconds since the Epoch.

Use the same '@' character as prefix as used by systemd.time to make it
easier to integrate in scripts intended to be used on systems with or
without systemd.

Fix also the initial support which discarded the seconds from the converted
timestamp.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2 years agoMerge branch '1' of https://github.com/neheb/util-linux
Karel Zak [Mon, 12 Sep 2022 09:46:49 +0000 (11:46 +0200)] 
Merge branch '1' of https://github.com/neheb/util-linux

* '1' of https://github.com/neheb/util-linux:
  meson: enable nls support
  meson: add PACKAGE definition
  meson: use dependency('dl')

2 years agolibblkid: erofs: add checksum support
Thomas Weißschuh [Sun, 11 Sep 2022 10:33:13 +0000 (12:33 +0200)] 
libblkid: erofs: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: add blkid_probe_get_sb_buffer()
Thomas Weißschuh [Mon, 19 Apr 2021 17:32:00 +0000 (19:32 +0200)] 
libblkid: add blkid_probe_get_sb_buffer()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoblkid: f2fs: update testfile to include checksum
Thomas Weißschuh [Sat, 10 Sep 2022 11:09:45 +0000 (13:09 +0200)] 
blkid: f2fs: update testfile to include checksum

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: f2fs: add checksum support
Thomas Weißschuh [Sat, 10 Sep 2022 11:04:10 +0000 (13:04 +0200)] 
libblkid: f2fs: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: exfat: add checksum support
Thomas Weißschuh [Sat, 10 Sep 2022 10:18:14 +0000 (12:18 +0200)] 
libblkid: exfat: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: btrfs: add checksum support
Thomas Weißschuh [Sat, 10 Sep 2022 09:14:31 +0000 (11:14 +0200)] 
libblkid: btrfs: add checksum support

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolsfd: use TYPE column to show cooked file types
Masatake YAMATO [Sat, 3 Sep 2022 15:25:15 +0000 (00:25 +0900)] 
lsfd: use TYPE column to show cooked file types

lsfd has two exclusive requirements:

A. show quickly understandable information in limited display area, and
B. provide primitive raw information for post-process tools.

For the purpose A, summarizing information is nice. However, the
summarized information is not suitable for tools.

To satisfy the both requirements, I plan introducing new fields
with a new convention.

STTYPE represents the type information returned from stat(2).
TYPE is the same as STTYPE but two exceptions; TYPE is filled with
PROTONAME value if the target fd is a socket, or with AINODECLASS
value if the target fd is a anonymous inode.

Below an example output:

    $ ./lsfd -o COMMAND,TYPE,STTYPE,NAME -Q '(TYPE != STTYPE)'  | head
    COMMAND                TYPE STTYPE NAME
    systemd         UNIX-STREAM   SOCK UNIX-STREAM:[25493]
    systemd         UNIX-STREAM   SOCK UNIX-STREAM:[25493]
    systemd                UNIX   SOCK UNIX:[31445]
    systemd           eventpoll   UNKN anon_inode:[eventpoll]
    systemd            signalfd   UNKN anon_inode:[signalfd]
    systemd             inotify   UNKN anon_inode:inotify
    systemd             timerfd   UNKN anon_inode:[timerfd]
    systemd           eventpoll   UNKN anon_inode:[eventpoll]
    systemd             inotify   UNKN anon_inode:inotify

STTYPE, column for tools, is printed only when the column is specified
with -o option.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agomeson: enable nls support
Rosen Penev [Fri, 9 Sep 2022 02:03:49 +0000 (19:03 -0700)] 
meson: enable nls support

This was not implemented in meson, probably because it's a mess to do
before version 0.59.0. Speaking of which, restrict it to that.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agomeson: add PACKAGE definition
Rosen Penev [Fri, 9 Sep 2022 02:12:33 +0000 (19:12 -0700)] 
meson: add PACKAGE definition

In the transition to meson, it seems this was missing. Fixes compilation
when ENABLE_NLS is defined.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agomeson: use dependency('dl')
Rosen Penev [Fri, 9 Sep 2022 01:54:08 +0000 (18:54 -0700)] 
meson: use dependency('dl')

if meson is new enough.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agolsfd: show classes of anonyomous inodes in AINODECLASS column
Masatake YAMATO [Fri, 2 Sep 2022 21:24:03 +0000 (06:24 +0900)] 
lsfd: show classes of anonyomous inodes in AINODECLASS column

Below an example output:

    $ ./lsfd -oCOMMAND,PID,USER,ASSOC,TYPE,AINODECLASS -Q '(SOURCE == "anon_inodefs")' | head
    COMMAND             PID USER ASSOC TYPE AINODECLASS
    systemd            1360  jet     4 UNKN   eventpoll
    systemd            1360  jet     5 UNKN    signalfd
    systemd            1360  jet     6 UNKN     inotify
    systemd            1360  jet     8 UNKN     timerfd
    systemd            1360  jet     9 UNKN   eventpoll
    systemd            1360  jet    11 UNKN     inotify
    systemd            1360  jet    13 UNKN     inotify
    systemd            1360  jet    21 UNKN     timerfd
    gnome-keyring-d    4598  jet     5 UNKN     eventfd

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: cosmetic changes
Masatake YAMATO [Fri, 2 Sep 2022 20:32:12 +0000 (05:32 +0900)] 
lsfd: cosmetic changes

Align the column of members in a structure initializer.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) add a factory for making an inotify fd
Masatake YAMATO [Fri, 2 Sep 2022 20:30:23 +0000 (05:30 +0900)] 
tests: (mkfds) add a factory for making an inotify fd

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) cosmetic change, deleting an empty line
Masatake YAMATO [Fri, 2 Sep 2022 20:26:27 +0000 (05:26 +0900)] 
tests: (mkfds) cosmetic change, deleting an empty line

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agoUse "grep -E" instead of "egrep"
Jakub Wilk [Wed, 7 Sep 2022 15:55:16 +0000 (17:55 +0200)] 
Use "grep -E" instead of "egrep"

The egrep command has been deprecated since GNU grep 2.5.3
(released in 2007). In GNU grep 3.8, it issues an obsolescence warning:
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d4

Use portable "grep -E" instead.

2 years agolib/timeutils: Add %s (seconds since the Epoch) to parse_timestamp()
Peter Ujfalusi [Tue, 6 Sep 2022 07:04:36 +0000 (10:04 +0300)] 
lib/timeutils: Add %s (seconds since the Epoch) to parse_timestamp()

The %s comes handy with for example dmesg with the --since within scripts
to handle log rages.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2 years agorfkill: (man) List options for supported device types
Karel Zak [Mon, 5 Sep 2022 07:14:45 +0000 (09:14 +0200)] 
rfkill: (man) List options for supported device types

Fixes: https://github.com/util-linux/util-linux/issues/1790
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'setterm' of https://github.com/jwilk-forks/util-linux
Karel Zak [Mon, 5 Sep 2022 07:11:22 +0000 (09:11 +0200)] 
Merge branch 'setterm' of https://github.com/jwilk-forks/util-linux

* 'setterm' of https://github.com/jwilk-forks/util-linux:
  setterm: (man) clarify --hbcolor, --ulcolor syntax

2 years agolsblk: add PARTN column
Karel Zak [Mon, 5 Sep 2022 07:01:42 +0000 (09:01 +0200)] 
lsblk: add PARTN column

Add PARTN column, the source for this column is ID_PART_ENTRY_NUMBER
from udev db, the original source of this information comes from
libblkid. There is also another PARTN in udevdb, but it's based on
data from kernel uevent.

Fixes: https://github.com/util-linux/util-linux/issues/1787
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agosetterm: (man) clarify --hbcolor, --ulcolor syntax
Jakub Wilk [Sat, 3 Sep 2022 18:11:48 +0000 (20:11 +0200)] 
setterm: (man) clarify --hbcolor, --ulcolor syntax

Remove superfluous [bright].
Optional "bright" is already part of the definition of "16-color".

2 years agolscpu: Even more Arm part numbers
Jeremy Linton [Thu, 1 Sep 2022 21:52:30 +0000 (16:52 -0500)] 
lscpu: Even more Arm part numbers

Arm has published further MIDR/part numbers on
https://developer.arm.com/ip-products/processors/cortex-a.
Some of the new ones have already been merged, so lets
fill in the gaps with A34, A65AE and X1C.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
2 years agolsblk: add DISK-SEQ (aka /sys/block//diskseq
Karel Zak [Thu, 1 Sep 2022 09:05:20 +0000 (11:05 +0200)] 
lsblk: add DISK-SEQ (aka /sys/block//diskseq

Addreses: https://github.com/util-linux/util-linux/issues/1786
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoasciidoc: fix typo in hwclock.8
Enze Li [Wed, 31 Aug 2022 08:47:43 +0000 (16:47 +0800)] 
asciidoc: fix typo in hwclock.8

The typo here is inferred from the context of the "--delay" option in
the document.

    in same cases -> in some cases
        ^                ^
Signed-off-by: Enze Li <lienze@kylinos.cn>
2 years agounshare: Don't waste an ID when -r is used with --map-auto
Chris Webb [Wed, 24 Aug 2022 11:52:55 +0000 (12:52 +0100)] 
unshare: Don't waste an ID when -r is used with --map-auto

When --map-root-user or --map-current-user are used with --map-auto, one of
the IDs from the first range in /etc/subuid and /etc/subgid is wasted and
left unmapped:

  $ cat /etc/subuid
  1000:65536:100
  $ unshare --map-auto cat /proc/self/uid_map
           0      65536        100
  $ unshare --map-root-user --map-auto cat /proc/self/uid_map
           0       1000          1
           1      65536         99

In the second unshare, only 99 of the 100 UIDs available from /etc/subuid
are actually mapped, whereas in the first unshare, all 100 delegated UIDs
are correctly mapped.

Distinguish auto mappings from manually-specified ones so they can be
handled correctly, while still ensuring explicit --map-users/groups that
overlap with the single mapping are correctly reduced in length because
of the hole that's punched:

  $ unshare --map-auto cat /proc/self/uid_map
           0      65536        100
  $ unshare  --map-root-user --map-auto cat /proc/self/uid_map
           0       1000          1
           1      65536        100

Signed-off-by: Chris Webb <chris@arachsys.com>
2 years agolsblk: use strcoll() to sort
Karel Zak [Thu, 1 Sep 2022 09:05:20 +0000 (11:05 +0200)] 
lsblk: use strcoll() to sort

It's more user-friendly to follow locale.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolsirq: use strcoll() to sort
Karel Zak [Thu, 1 Sep 2022 09:05:20 +0000 (11:05 +0200)] 
lsirq: use strcoll() to sort

It's more user-friendly to follow locale.

Reported-by: Radka Skvarilova <rskvaril@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolslogins: support more password methods
Karel Zak [Wed, 24 Aug 2022 10:20:25 +0000 (12:20 +0200)] 
lslogins: support more password methods

* detect more hashing methods

* don't care about hash size

* follow crypt(5) when check for valid chars

Reported-by: Radka Skvarilova <rskvaril@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomount: (docs) fix typos in bind-mount references
Karel Zak [Wed, 24 Aug 2022 08:32:22 +0000 (10:32 +0200)] 
mount: (docs) fix typos in bind-mount references

Fixes: https://github.com/util-linux/util-linux/issues/1783
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibuuid: check clock value from LIBUUID_CLOCK_FILE
Michael Trapp [Tue, 2 Aug 2022 12:16:43 +0000 (14:16 +0200)] 
libuuid: check clock value from LIBUUID_CLOCK_FILE

The clock value from the LIBUUID_CLOCK_FILE must be checked in
case of an update of libuuid. If clock==CLOCK_SEQ_CONT it must
be set to a new value.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: make pipesz optional
Karel Zak [Fri, 19 Aug 2022 15:42:34 +0000 (17:42 +0200)] 
build-sys: make pipesz optional

Addresses: https://github.com/util-linux/util-linux/pull/1775
Fixes: https://github.com/util-linux/util-linux/issues/1772
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoconfigure.ac: Improve check for magic
Mateusz Marciniec [Fri, 19 Aug 2022 12:47:49 +0000 (14:47 +0200)] 
configure.ac: Improve check for magic

Check whether magic.h header exists before defining HAVE_MAGIC.

Despite library availability there still can be missing header.
Current test doesn't cover that possibility which will lead compilation
to fail in case of separate sysroot.

Signed-off-by: Mateusz Marciniec <mateuszmar2@gmail.com>
Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>