Karel Zak [Tue, 13 Dec 2022 15:10:08 +0000 (16:10 +0100)]
Merge branch 'shells.c' of https://github.com/t-8ch/util-linux
* 'shells.c' of https://github.com/t-8ch/util-linux:
meson: link shells.c into users of is_known_shell
meson: remove leftover explicit mentions of logindefs.c
Karel Zak [Mon, 5 Dec 2022 11:51:03 +0000 (12:51 +0100)]
tests: add SPDX-License-Identifier to helper
The default util-linux license is GPL-2.0-or-later. The header is
missing in some files or quotation from the license is incomplete. It
seem the best is to use the License-Identifier header to make things
more obvious and readable for code analyzers, etc.
Fixes: https://github.com/util-linux/util-linux/issues/1932 Signed-off-by: Karel Zak <kzak@redhat.com>
Masatake YAMATO [Wed, 30 Nov 2022 05:55:32 +0000 (14:55 +0900)]
lsfd: consider 64bit addresses when scanning /proc/pid/map_files dir
Close #1930.
The original code assumed 48bit addresses. This assumption came
from linux running on x86_64. As reported in #1930, Linux on
sparc64 uses 64bit addresses.
Ian Kent [Thu, 24 Nov 2022 08:54:19 +0000 (16:54 +0800)]
libmount: use autofs mount hint to ignore autofs mount entries
Historically autofs mounts were not included in mount table listings.
This is the case in other SysV autofs implementations and was also
the case with Linux autofs.
But now that /etc/mtab is a symlink to the proc filesystem mount
table the autofs mount entries appear in the mount table on Linux.
Prior to the symlinking of /etc/mtab mount table it was sufficient
to call mount(2) and simply not update /etc/mtab to exclude autofs
mounts from mount listings.
Also, with this symlinking of /etc/mtab we have seen a shift in usage
toward using the proc mount tables directly.
But the autofs mount entries need to be retained when coming from the
proc file system for applications that need them (such as systemd) so
filtering out these entries within the kernel itself can't be done,
it needs be done in user space.
There are three reasons to omit the autofs mount entries.
One is that certain types of auto-mounts have an autofs mount for every
entry in their autofs mount map (autofs direct mounts) and these maps
can be quite large. This leads to mount table listings containing a lot
of unnecessary entries.
Also, this difference in behaviour between autofs implementations can
cause problems for applications that need to use the mount table and
expect autofs entries aren't present.
Lastly, there's very little that user space can do with autofs mount
entries since this must be left to the autofs mount owner, typically
the automount daemon. And it can also lead to attempts to access
automount managed paths resulting in mounts being triggered when they
aren't needed or mounts staying mounted for much longer thay they
need to be.
So the Linux autofs file system has been modified to accept a pseudo
mount option of "ignore" (as is used in other OS implementations) so
that user space utilities can use this as a hint to skip these autofs
entries on reading the mount table.
The Linux autofs automount daemon used getmntent(3) itself and has been
modified to use the proc file system directly so that it isn't affected
by the presence of the "ignore" mount option.
The use of the "ignore" mount option is opt-in by autofs users and a
configuration option has been added which defaults to not use the option
so if there are applications that need these entries, other than autofs
itself, they can be retained. Also, since this filtering is based on an
added mount option earlier versions of Linux autofs and other autofs file
system users will not use the option and so won't be affected by the change.
Changes in v2:
- make naming consistent with util-linux conventions.
- make ignoring autofs mount entries the default since it will only
have an effect if it has been enabled in the autofs configuration.
- drop patch to set ingore autofs mounts for mount(8) since it's now
default.
Karel Zak [Thu, 24 Nov 2022 19:51:32 +0000 (20:51 +0100)]
Merge branch 'lsfd-nsfs' of https://github.com/masatake/util-linux
* 'lsfd-nsfs' of https://github.com/masatake/util-linux:
lsfd: show extra information returned from ioctl(..., NS_GET_NSTYPE)
lsfd: collect namespace files after collecting information about "nodev" fs
lsfd: introduce is_mapped_file macro
lsfd: introduce is_opened_file macro
Masatake YAMATO [Wed, 23 Nov 2022 06:41:57 +0000 (15:41 +0900)]
lsfd: collect namespace files after collecting information about "nodev" fs
In my plan, lsfd will need the information of the backing device for
"nsfs" file system before collecing the information about th namespaces
associated with fds.
Karel Zak [Tue, 22 Nov 2022 13:30:11 +0000 (14:30 +0100)]
Merge branch 'btrfs/checksums' of https://github.com/t-8ch/util-linux
* 'btrfs/checksums' of https://github.com/t-8ch/util-linux:
libblkid: btrfs: add support for xxhash checksums
lib: xxhash: customize for util-linux
lib: add xxhash implementation
libblkid: btrfs: add support for sha256 checksums
libblkid: add function blkid_probe_verify_csum_buf
libblkid: btrfs: prepare for more checksum algorithms
scripts uses either a free-standing "file" argument, or the value
passed as --log-out "file". Additional filenames are ignored.
They are also ignored if --log-in "file" is given, as it turns off
output logging by default (can still be overriden by adding --log-out).
Avoid surprises when passing multiple filenames by writing usage
message instead.
[kzak@redhat.com: - use errtryhelp() rather than usage()]
Signed-off-by: Chris Hofstaedtler <zeha@debian.org> Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1016193 Signed-off-by: Karel Zak <kzak@redhat.com>
to somewhat cover architectures where unaligned access can lead to
crashes and make it possible for OSS-Fuzz to catch issues like
https://github.com/util-linux/util-linux/pull/1906.
With this patch applied the libblkid fuzz target built with the OSS-Fuzz
toolchain triggers "runtime error: load of misaligned address" in `probe_exfat`
so it seems to be working.
Karel Zak [Wed, 16 Nov 2022 07:46:29 +0000 (08:46 +0100)]
Merge branch 'rev0' of https://github.com/t-8ch/util-linux
* 'rev0' of https://github.com/t-8ch/util-linux:
rev: allow zero-byte as separator
rev: make separator configurable
rev: use pointer-size-pairs instead of C-string
Karel Zak [Wed, 16 Nov 2022 07:36:19 +0000 (08:36 +0100)]
Merge branch 'oss-fuzz' of https://github.com/t-8ch/util-linux
* 'oss-fuzz' of https://github.com/t-8ch/util-linux:
libblkid: iso9660: allocate enough space for UTF16 decoding
libblkid: ntfs: avoid UB in signed shift
Thomas Weißschuh [Thu, 10 Nov 2022 18:48:20 +0000 (19:48 +0100)]
libblkid: iso9660: allocate enough space for UTF16 decoding
When merge_utf16be_ascii() encounters high-codepoint surrogate pairs it
emits four bytes of output for one byte of ascii input.
In addition with the remaining ascii characters from the second loop we
need up to 5 * sizeof(input) / 2 bytes as output buffer.
As we decode up to 128 ascii characters with merge_utf16be_ascii() we
need 320 bytes of buffer available.
Furthermore adapt merge_utf16be_ascii() to not write paste the output
buffer end.