]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
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 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>
2 years agolscpu: Add Kryo 3XX Gold core
ThomasKaiser [Fri, 30 Sep 2022 08:53:25 +0000 (10:53 +0200)] 
lscpu: Add Kryo 3XX Gold core

[kzak@redhat.com: - update patch to use '-' between words in CPU name]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'patch-1' of https://github.com/sashashura/util-linux
Karel Zak [Fri, 30 Sep 2022 08:46:11 +0000 (10:46 +0200)] 
Merge branch 'patch-1' of https://github.com/sashashura/util-linux

* 'patch-1' of https://github.com/sashashura/util-linux:
  build: harden coverity.yml permissions
  build: harden cibuild.yml permissions
  build: harden cifuzz.yml permissions

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 agobuild: harden coverity.yml permissions
Alex [Mon, 26 Sep 2022 22:01:39 +0000 (00:01 +0200)] 
build: harden coverity.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>
2 years agobuild: harden cibuild.yml permissions
Alex [Mon, 26 Sep 2022 22:01:22 +0000 (00:01 +0200)] 
build: harden cibuild.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>
2 years agobuild: harden cifuzz.yml permissions
Alex [Mon, 26 Sep 2022 21:59:29 +0000 (23:59 +0200)] 
build: harden cifuzz.yml permissions

Signed-off-by: Alex <aleksandrosansan@gmail.com>
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>