* 'clock' of https://github.com/t-8ch/util-linux:
lsclocks: new util to interact with system clocks
lib/timeutils: implement timespec formatting
lib/timeutils: implement nanosecond formatting
lib/timeutils: constify some arguments
utmpdump: validate subsecond granularity
* 'lsfd--xmode' of https://github.com/masatake/util-linux:
lsfd: add 'D' flag for representing deleted files to XMODE column
lsfd: introduce XMODE column, extensible variant of MODE
test: (lsfd) add a subcase for testing NAME column for a deleted file
test: (lsfd) add a case for testing DELETED column
test: (mkfds) add "make-regular-file" factory
* 'lsfd--misc-tun' of https://github.com/masatake/util-linux:
tests: (lsfd) add a case testing TUN.IFACE column
tests: (mkfds) add a factor for opening tun device
lsfd: add TUN.IFFACE, a column for interfaces behind tun devices
lsfd: (refactor) move miscdev specific code to cdev_misc_ops
lsfd: (refactor) make the way to handle character devices extensible
lsfd: (refactor) introduce a content data type for char devices
Usecases:
* Compare current monotonic time to timestamps reported by systemd
* Validate time namespace operations
* Inspect clock resolutions
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
The implementation using the new FD based mount kernel API (ie.,
fsconfig/fsopen) uses MNT_ERR_APPLYFLAGS for failed mount_setattr(2)
calls, which involves more mount attributes (eg., MOUNT_ATTR_RDONLY,
MOUNT_ATTR_NOSUID, etc.) in addition to the MS_PROPAGATION flags (eg.,
MS_SHARED, MS_UNBINDABLE, etc.).
Note that mount_setattr(2) is part of the new FD based mount kernel API,
and is not used by the classic mount(2) based version.
Fallout from 987d844cdb
Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
tv_usec is only valid in the range [0, 999999].
If the file contains garbage data replace interpret it as "0" instead.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Florian wrote:
after a successful write, cfdisk remains on the "Write" cursor and
furthermore when navigating to "Quit" will continue to show
"...without writing changes", despite there were writes. This patch
addresses that.
Based on patch from Florian Zimmermann <florian.zimmermann@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Submission to Project: util-linux
Open Incident: #2325 at github.com/util-linux/util-linux/issues/2325
Component: util-linux/sys-utils
File: dmesg.c
Code level patch applied against: 2.39 - latest code pulled from
git.github.com:util-linux/util-linux.git
BUG: The facility field passed to macro from /usr/include/sys/syslog.h
LOG_MAKEPRI(fac, pri) by dmesg -r needs to have fac argument
shifted 3 bit to the left to return a valid raw valid. The lower
3 bits for a raw value are used by the loglevel priority (pri)
field, so the facility bits can only occupy the bits above the
bits used to hold the pri field value.
The dmesg -r command produces the incorrect output for the raw value
for the or'ed combination of the facility | loglevel priority that gets
produced by the LOG_MAKEPRI macro. That macro is defined as:
#define LOG_MAKEPRI(fac, pri) ((fac) | (pri))
which is defined in the current glibc code in /usr/include/sys/syslog.h
and is used only in the dmesg -r (raw output option) command to form the
raw value for facility or'ed with loglevel priority and displayed as:
<#>[#######.######] ...
where the # in <#> contains the output from the LOG_MAKEPRI macro.
The lower 3 bits are reserved for the loglevel priority 0-7
and the bits above that are for the facility value, so the facility
index should be shifted to the left three bits and or'ed with the
loglevel priority.
In the glibc file: /usr/include/sys/syslog.h the macro LOG_MAKEPRI is
defined as:
#define LOG_MAKEPRI(fac, pri) ((fac) | (pri)
and returns the wrong facility and loglevel priority values, ideally it
should be defined as:
#define LOG_MAKEPRI(fac, pri) ((fac << 3) | (pri))
to return the correct raw value.
We checked with glibc developement and the LOG_MAKEPRI macro is correct
as is and can't be changed as it used by *BSD as is so the solution for
dmesg -r is to shift the facility index left by 3 bits as input to the
LOG_MAKEPRI macro. That is what glibc development recommended.
(For reference, see glibc bugzilla Bug 30563)
We can front end the LOG_MAKEPRI macro with a macro that shifts the
facility by the needed 3 bits which we've added to dmesg.c:
#define LOG_RAW_FAC_PRI(fac, pri) LOG_MAKEPRI((fac << 3), (pri))
This has been tested and works correctly to produce the correct raw
mode value for Facility or'ed together with Loglevel priority.
You can verify that this fix works correctly.
We can test by adding several records to /dev/kmsg like this:
echo "<14> Test Message Facility 8 Loglevel 6" >> /dev/kmsg
echo "<15> Test Message Facility 8 Loglevel 7" >> /dev/kmsg
echo "<30> Test Message Facility 24 Loglevel 6" >> /dev/kmsg
echo "<31> Test Message Facility 24 Loglevel 7" >> /dev/kmsg
these commands add 4 records to the dmesg buffer. Then when we print the
records by cat'ing /dev/kmsg or using the dmesg command several ways:
-bash-4.2# cat /dev/kmsg | grep "Test Message Facility"
14,1114,495317239,-; Test Message Facility 8 Loglevel 6
15,1115,503340779,-; Test Message Facility 8 Loglevel 7
30,1116,643374764,-; Test Message Facility 24 Loglevel 6
31,1117,657165117,-; Test Message Facility 24 Loglevel 7
-bash-4.2# dmesg -x | grep "Test Message Facility"
user :info : [ 495.317239] Test Message Facility 8 Loglevel 6
user :debug : [ 503.340779] Test Message Facility 8 Loglevel 7
daemon:info : [ 643.374764] Test Message Facility 24 Loglevel 6
daemon:debug : [ 657.165117] Test Message Facility 24 Loglevel 7
-bash-4.2# dmesg -S -x | grep "Test Message Facility"
user :info : [ 495.317239] Test Message Facility 8 Loglevel 6
user :debug : [ 503.340779] Test Message Facility 8 Loglevel 7
daemon:info : [ 643.374764] Test Message Facility 24 Loglevel 6
daemon:debug : [ 657.165117] Test Message Facility 24 Loglevel 7
-bash-4.2# dmesg -S -r | grep "Test Message Facility"
<14>[ 495.317239] Test Message Facility 8 Loglevel 6
<15>[ 503.340779] Test Message Facility 8 Loglevel 7
<30>[ 643.374764] Test Message Facility 24 Loglevel 6
<31>[ 657.165117] Test Message Facility 24 Loglevel 7
All the above methods agree in their output as expected.
However, running dmesg -r does not agree.
dmesg -r erronously produces:
----------------------------
-bash-4.2# dmesg -r | grep "Test Message Facility"
<7>[ 495.317239] Test Message Facility 8 Loglevel 6
<7>[ 503.340779] Test Message Facility 8 Loglevel 7
<7>[ 643.374764] Test Message Facility 24 Loglevel 6
<7>[ 657.165117] Test Message Facility 24 Loglevel 7
However, if we run the dmesg -r command using the new front end macro
LOG_RAW_FAC_PRI(fac, pri) we do get the correct output:
Here is the corrected dmesg -r output:
-------------------------------------
-bash-4.2# dmesg -r | grep "Test Message Facility"
<14>[ 495.317239] Test Message Facility 8 Loglevel 6
<15>[ 503.340779] Test Message Facility 8 Loglevel 7
<30>[ 643.374764] Test Message Facility 24 Loglevel 6
<31>[ 657.165117] Test Message Facility 24 Loglevel 7
shifting the facility index value by 3 bits in the LOG_RAW_FAC_PRI macro
provides the correct ouput as shown. All the other commands produce the
same output so now they are all in agreement.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
* 'lsfd--fix-separators-for-json-output-cleanup' of https://github.com/masatake/util-linux:
lsfd: fix specifying wrong JSON typs when building the help message
tests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode
* 'PR/libmount-optstr-sync' of github.com:karelzak/util-linux-work:
libmount: add sample to test fs and context relation
libmount: fix sync options between context and fs structs
This makes it easier to run test.sh from the build directory as
everything will work without any parameters irrespective of the build
directories name.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
When this option is used nsenter will fetch the parent user
namespace from any namespace file descriptors available.
It can be combined with existing `--user` option in which case
the parent user namespace will be fetched from the user namespace
and replace it.
The usecase of this option is when a user namespace that owns
the other type namespaces we want to switch to is not actually
bound to any process. Without using ioctl it is impossible to
acquire namespace file descriptor. For example, bubblewrap
`bwrap` command creates unbinded user namespace when `--dev`
option is used.
* 'lsfd--fix-separators-for-json-output' of https://github.com/masatake/util-linux:
lsfd.1.adoc: fix a typo
lsfd: use ARRAY_STRING and ARRAY_NUMBER json types in some columns
lsfd: use \n as the separator in INOTIFY.INODES and INOTIFY.INODES.RAW columns
lsfd: use \n as the separator in EVENTPOLL.TFDS column
lsfd: (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types
Since v2.39 libmount prefers "struct libmnt_optlist" to keep mount options
rather than the original "struct libmnt_fs". This is problem if the
"fs" struct is defined and maintained outside the context.
The library has already a way how to sync "fs" and "optlist", but this
needs to be improved and used more widely. Changes:
* force "fs" from context to always read options from "optlist"
* copy options from "fs" to "optlist" in mnt_context_set_fs()
* internally redirect mnt_fs_* API for options to "optlist" if optlist
defined
* add simple test to make sure options from different sources are
always merged together
Addresses: https://github.com/util-linux/util-linux/issues/2326
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's cancel already running GH Actions jobs when a PR is (force) pushed
to conserve resources and make the CI runs faster thanks to the freed up
queue.
_exit() skips the gcov hooks, so we lose all coverage collected up to
that point. Let's work around this by intercepting _exit() with our
wrapper that calls __gcov_dump() just before _exit().
Implement a way for userspace to query the status of the backup
battery, if supported by the hardware and driver.
The RTC_VL_* bits are a somewhat recent addition (3431ca4837bf, but
really only from b0efe0281234) to the uapi header,
so provide our own definition if the build host's header doesn't.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
We will have operators for array types in the future. Till having
them, we treat the types as STRING. So we can use string operators for
the column having types.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
The original MODE column comes from three letters (rwx) may not be
enough for representing various aspects of file descriptors and memory
mappings. We want to add more items in the future.
However, the description of MODE in lsfd(1) doesn't wrote about its
extensibility. Adding more letters to the column can break
compatibility in someone's use case.
This change introduces XMODE column. Unlike MODE, XMODE is declared as
an extensible column in lsfd(1). Currently, it shows the same items as
the MODE column does.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
The libcommon is a binary archive to keep compilation and maintenance
simple. The library is not linked as shared or so. The unused symbols
are removed from binaries (for example, by "make install-strip").
But it isn't evident for license analyzers (and some humans) that the
library uses GPL and non-GPL stuff simultaneously. Let's avoid doubts
and keep pager.c (with GPL license) out of the archive
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch does not change any license of the affected files. Changes:
* add missing SPDX-License-Identifier lines for LGPL
* copy missing license lines from code (lib/) to header files (include/)
* use the same comment formatting
Signed-off-by: Karel Zak <kzak@redhat.com>
The header file and code uses a different license. Let's use (public
domain) license from code also for the header file.
Signed-off-by: Karel Zak <kzak@redhat.com>
In the description of the context option, the example which shows how to
properly quote is displayed incorrectly on terminals > 80 columns. This
leaves a seemingly needless '\' in the command, e.g.:
mount -t tmpfs none /mnt -o \ 'context="system_u:...'
The intent is to display the command properly on terminals <= 80
columns. Use a literal block to ensure the code is displayed
consistently, regardless of the terminal width.
Connect the blockquote to the previous indented items in the context
option description to ensure it is properly indented.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
The library (on mount) cares about "user", but has to ignore
"user=name". It works as expected, but only for non-root users. We
need to ignore it also root to be compatible with /sbin/mount.cifs
where some people still use "user=" (rather than "username=").
References: fe0b1e793c
Addresses: https://github.com/util-linux/util-linux/issues/2315
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'lsfd--inotify' of https://github.com/masatake/util-linux:
lsfd: use xstrdup instead of xasprintf(...\"%s\"
tests: (lsfd) add a case for testing INOTIFY.INODES.RAW column
tests: (mkfds) add / and /etc/fstab as the monitoring targets to inotify
lsfd: fill NAME column of inotify files with the information about their monitoring targets
lsdf: make the code for filling SOURCE, PARTITION, and MAJMIN reusable
This conditional was never implemented in the meson config. Under
autotools, it is guarded by availability of headers and an option. I
didn't implement the option here.
Fixes#2310.
'!= false' is used because 'x == 1' is rejected by meson if 'x' is
false. OTOH, 'x != false' seems to work if 'x' is 1.
After compiling enosys, the syscalls.h file and the executable enosys are
generated, let's add these two files to the .gitignore file.
Signed-off-by: Enze Li <lienze@kylinos.cn>
* 'lsfd--refactor' of https://github.com/masatake/util-linux:
timeutils: add an inline funciton, is_timespecset()
lsfd: use scols_table_get_column_by_name
* 'lsfd--signalfd' of https://github.com/masatake/util-linux:
tests: (lsfd) add a case for testing signalfd related columns
tests: (mkfds) add a factory to make a signalfd
lsfd.1.adoc: update for signalfds
lsfd: print the masks specified in signalfds
* 'lsfd--misc-fix' of https://github.com/masatake/util-linux:
lsfd: assign a class to the file in new_file()
lsfd: don't check the value returned from new_file()
* 'lsfd--timerfd' of https://github.com/masatake/util-linux:
tests: (lsfd/filter) add a case for comparing floating point numbers
tests: (lsfd) add a case for testing timerfd related columns
tests: add ts_skip_capability
tests: (mkfds) add a factory to make a timerfd
lsfd.1.adoc: write about timerfd
lsfd: print the detail of the timer associated with a timerfd
lsfd: (filter) accept floating point numbers in expressions
lsfd: (filter) support floating point number used in columns
lsfd: (filter) reduce duplicated code in macro definitions
lsfd: (filter) improve error message
lsfd.1.adoc: revise type names for columns
lsfd.1.adoc: fix typos
lsfd: adjust coding style
lsfd: fix a sentence in comment
It seems mount_setattr() is supported on Linux < 5.14, but it's without
MOUNT_ATTR_NOSYMFOLLOW. That's problem for remount where we reset all
VFS flags.
The most simple (but not elegant) is to check for kernel version and
fallback to mount(2) on remount.
Addresses: https://github.com/util-linux/util-linux/issues/2283
Signed-off-by: Karel Zak <kzak@redhat.com>
Fix previous commit 04a0717b0b
to avoid undefined shift if value is exactly 32.
libblkid/src/superblocks/jfs.c:46:39: runtime error:
shift exponent 32 is too large for 32-bit type 'unsigned int'
Reproducer found with OSS-Fuzz (issue 59284) running over
cryptsetup project (blkid is used in header init).
Signed-off-by: Milan Broz <gmazyland@gmail.com>
An example output:
# ./lsfd -p 1 -Q '(TYPE == "timerfd")' -oCOMMAND,PID,ASSOC,TYPE,INODE,NAME
COMMAND PID ASSOC TYPE INODE NAME
systemd 1 22 timerfd 1060 clockid=monotonic remaining=4625.661834645
systemd 1 25 timerfd 1060 clockid=realtime remaining=398.164618943
systemd 1 112 timerfd 1060 clockid=realtime remaining=7537606384.202715161
Added three new columns, TIMERFD.{CLOCKID,TIMERFD.REMAINING,INTERVAL}.
The filter engine works well with them.
An example listing timerfd files expiring within 1.2 seconds.
# ./lsfd -Q '(TIMERFD.REMAINING > 0.0) && (TIMERFD.REMAINING < 1.2)'
COMMAND PID USER ASSOC MODE TYPE SOURCE MNTID INODE NAME
Xorg 17069 jet 26 rw- timerfd anon_inodefs 15 1060 clockid=monotonic remaining=0.061075544
systemd-oomd 2382701 systemd-oom 8 rw- timerfd anon_inodefs 15 1060 clockid=monotonic remaining=0.178126915
Using SCOLS_JSON_NUMBER as the data type for TIMERFD.REMAINING and
TIMERFD.INTERVAL columns is suggested by Thomas Weißschuh
<thomas@t-8ch.de>.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Newer releases of GCC 13 have reigned in the false positives, so use it
for CI now.
The sanitizer builds are sticking to GCC 11 for now.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Older versions of GCC do not know the warning so they warn about the
unknown ignored warning.
As struct blk_zone is only 64 bytes anyway just copy it.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
* 'mount/ntfs-segfault' of https://github.com/t-8ch/util-linux:
mount: (tests) test mount helper with multiple filesystems
libmount: (tests) split helper tests
This splits the test introduced in
commit 06e05eb0f7 ("libmount: don't pass option "defaults" to helper")
into its own subtest.
We will have more subtests.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
In case more filesystems are specified (or when libmount follows
/{etc,proc}/filesystems) then the library may try to use and
initialize the new API because for some filesystems, we need
exec(/sbin/mount.<type>) and for another fsopen().
The hooks that use the API have to smart and detect that the mount
operation was done in external /sbin/mount.<type> helper. And in this
case, the new API file descriptors must be ignored.
The exception is propagation flags, mount(8) can set the flags after
exec(/sbin/mount.<type>), for example, "mount -t ntfs --make-private".
Fixes: https://github.com/util-linux/util-linux/issues/2267
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'enosys/arch-check' of https://github.com/t-8ch/util-linux:
enosys: add support for loongarch
enosys: only build if AUDIT_ARCH_NATIVE is defined
meson: require 0.57
enosys: split audit arch detection into dedicated header
enosys: add support for sparc
* 'lsfd--sysvipc-shmem' of https://github.com/masatake/util-linux:
tests: (lsfd) add a case for testing SOURCE column for SysV shmem mappings
tests: (mkfds) add a factory to make SysV shmem
lsfd: add tmpfs as source of sysvipc to the the nodev_table
lsfd: initialize pagesize in an earlier stage
lsfd: add "nsfs" to the nodev_table to fill SOURCE column for nsfs files
lsfd: add a helper function for adding a nodev to the nodev_table
lsfd: add a whitespace
lsfd: write more about nsfs in comment
* 'meson' of https://github.com/eworm-de/util-linux:
meson: install symlink for vigr man page
meson: include bash-completion for write
meson: include bash-completion for newgrp
* 'lsfd--mqueue' of https://github.com/masatake/util-linux:
tests: (lsfd) add cases for POSIX Mqueue
tests: (mkfds) add mqueue factory
lsfd: fill ENDPOINTS column of POSIX Mqueue
lsfd: add a new type "mqueue", a type for POSIX Mqueue
Static analyzers (e.g., Coverity) have a hard time understanding why
'optarg' is tested for NULL, and later in another place, code assumes
that it's non-NULL. For idmapping, the optarg is required.
Signed-off-by: Karel Zak <kzak@redhat.com>
This is v2.39 regression. The "user" mount option is internally
converted to "user=<name>", but this should not be exported to
the mount helpers.
The mount helper accepts the <name> only if specified in mount options
(cifs uses user=). The real username as generated by libmount is not
relevant in this case.
Signed-off-by: Karel Zak <kzak@redhat.com>
* the order of the new options should not be changed
(for example prepend "a,b,c" to list with "d" has to generate "a,b,c,d", not "c,b,a,d")
* make sure that options map is defined when merging options
Fixes: https://github.com/util-linux/util-linux/issues/2238
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'agetty-creds' of https://github.com/DaanDeMeyer/util-linux:
Document new systemd credentials support for agetty and login
login: Initialize noauth from login.noauth credential
agetty: Load autologin user from agetty.autologin credential
* 'ci/openwrt' of https://github.com/t-8ch/util-linux:
ci: add OpenWrt SDK based CI jobs
enosys: provide a nicer build message for syscalls.h generation
libsmartcols: (samples): fix format truncation warning
test_uuidd: make pthread_t formatting more robust
mkfs.minix: handle 64bit time on 32bit system
enosys: add support for MIPS, PowerPC and ARC
enosys: include sys/syscall.h
* 'lsfd--eventfd' of https://github.com/masatake/util-linux:
test_mkfds: avoid "ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’"
tests: (lsfd) add cases for eventfd
tests: (mkfds) add eventfd factory
tests: (mkfds) provide the way to declare the number of extra printing values
tests: (mkfds) print a whitespace only when the running factory has "report" method
lsfd: fill ENDPOINTS column for eventfd
lsfd: add a helper macro, foreach_endpoint
lsfd: add a helper function, init_endpoint
lsfd: add a helper function, add_endpoint
lsfd: add a helper function, new_ipc
lsfd: add a back pointer as a member of anon_eventfd_data
lsfd: move a local variable to a narrower scope
lsfd: add EVENTFD.ID column
lsfd: delete redundant parentheses surrounding return value
ldfd: delete unnecessary ';'
lsfd: choose anon_ops declarative way
Unifying multiple invocations of kill command and wait command
into two is suggested by Thomas Weißschuh <thomas@t-8ch.de>.
Addresses: https://lore.kernel.org/util-linux/652d32c5-4b33-ce3a-3de7-9ebc064bbdcb@gmail.com/
Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Tested-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
As this is only an example and the needed memory is not much just
hardcode a large enough number.
The previously computed value was wrong anyways.
libsmartcols/samples/continuous.c: In function 'main':
libsmartcols/samples/continuous.c:110:61: error: '%3d' directive output may be truncated writing between 3 and 11 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
110 | snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
| ^~~
libsmartcols/samples/continuous.c:110:25: note: 'snprintf' output between 11 and 333 bytes into a destination of size 12
110 | snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111 | done ? 100 : (int)(diff / (TIME_PERIOD / 100.0)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libsmartcols/samples/continuous.c:110:61: error: '%3d' directive output may be truncated writing 3 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
110 | snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
| ^~~
libsmartcols/samples/continuous.c:110:25: note: 'snprintf' output between 11 and 325 bytes into a destination of size 12
110 | snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111 | done ? 100 : (int)(diff / (TIME_PERIOD / 100.0)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
On musl pthread_t is a pointer. To avoid compiler warnings on 32bit
systems add a cast through intptr_t.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Otherwise there is no guarantee that all syscall numbers detected by
tools/all_syscalls are actually available to enosys.c.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Otherwise there is no guarantee that all syscall numbers detected by
tools/all_syscalls are actually available to enosys.c.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
The data returned from blkid_probe_get_buffer() and friends may or may
not be cached between different calls.
If one copy is modified this may not be visible in other copies.
This issue can be avoided by making any modification illegal.
See also #2165
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
The new pidfd stuff waitpid uses is not compatible with older kernel
headers, but the rest of the util-linux is still perfectly fine, so
allow disabling just the waitpid utility to make the builds happy again.
You can see the memory leak with address sanitizer if util-linux is
compiled with `--with-vendordir=/usr/etc`.
How to reproduce:
1. Prepare a custom shell file as root
```
mkdir -p /etc/shells.d
echo /bin/myshell > /etc/shells.d/custom
```
2. Run chsh as regular user
```
chsh
```
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
First hunk: grammar.
Second hunk: (a) mentioning BSD ptys and not UNIX98 ones is odd,
(b) mentioning /only/ ptys is odder still.
Third hunk: mesg is found in the UNIX Programmer's Manual;
it takes its modern form in V7
(it's unclear to me why V6 specifically is mentioned,
since it's still default-invert + always-report-"was X").
* 'nsenter-keep-caps' of https://github.com/dgibson/util-linux:
Add --keep-caps option to nsenter, similar to the one in unshare
unshare: Move implementation of --keep-caps option to library function
BPF encodes the jump distance in a uint8_t. To avoid overflows of this
value reorganize the generated bytecode to work without long jumps.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Allow an X-mount.idmap option to be specified either from an existing
userns with --map-users=/proc/PID/ns/user or incrementally with a series
of --map-users=INNER:OUTER:COUNT and --map-groups=INNER:OUTER:COUNT
options which compose into a single X-mount.idmap mount option.
Apart from distinguishing absolute namespace paths from literal mappings,
defer validation to libmount when it parses X-mount.idmap.
Signed-off-by: Chris Webb <chris@arachsys.com>
* 'nsenter-keep-caps' of https://github.com/dgibson/util-linux:
Add --keep-caps option to nsenter, similar to the one in unshare
unshare: Move implementation of --keep-caps option to library function
Let's check if we've been passed credentials by systemd and if so,
try to determine whether we need to auth the user to login from
the login.noauth credential.
Let's check if we've been passed credentials by systemd and if so,
try to read the user to autologin from the agetty.autologin
credential.
Partially fixes#2012
When entering a user namespace at the kernel level, whether with clone(2),
unshare(2) or setns(2), a process always gains full capabilities in the
new userns.
unshare(1) allows using that from the shell with the --keep-caps option,
which transfers that full permitted capability set to the ambient set so
it's available to the spawned shell or other process.
nsenter(1) currently has no equivalent option, despite the fact that
setns(2) grants capabilities in just the same way. This patch adds a
--keep-caps to nsenter(1) that works just like the one in unshare(1).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
unshare.c open codes some logic to copy the permitted capability set to the
ambient set in order to implement the --keep-caps option. Move this logic
to lib/caputils.c so that we can reuse it in nsenter.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-03-29 13:36:15 +11:00
303 changed files with 6928 additions and 1173 deletions
@ -20,7 +20,7 @@ fsck - check and repair a Linux filesystem
== DESCRIPTION
*fsck* is used to check and optionally repair one or more Linux filesystems. _filesystem_ can be a device name (e.g., _/dev/hdc1_, _/dev/sdb2_), a mount point (e.g., _/_, _/usr_, _/home_), or an filesystem label or UUID specifier (e.g., UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the *fsck* program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of them.
*fsck* is used to check and optionally repair one or more Linux filesystems. _filesystem_ can be a device name (e.g., _/dev/hdc1_, _/dev/sdb2_), a mount point (e.g., _/_, _/usr_, _/home_), or a filesystem label or UUID specifier (e.g., UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the *fsck* program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of them.
If no filesystems are specified on the command line, and the *-A* option is not specified, *fsck* will default to checking filesystems in _/etc/fstab_ serially. This is equivalent to the *-As* options.
Specify the _ENDIANNESS_ to use, valid arguments are *native*, *little* or *big*. The default is *native*.
*-o*, *--offset* _offset_::
Specify the _offset_ to write the swap area to.
*-v*, *--swapversion 1*::
Specify the swap-space version. (This option is currently pointless, as the old *-v 0* option has become obsolete and now only *-v 1* is supported. The kernel has not supported v0 swap-space format since 2.5.22 (June 2002). The new version v1 is supported since 2.1.117 (August 1998).)
Note that sfdisk completely restores partition types and partition UUIDs. This could potentially become problematic if you duplicate the same layout to different disks, as it may result in duplicate UUIDs within your system.
=== Full binary backup
If you want to do a full binary backup of all sectors where the partition table is stored, then use the *--backup-pt-sectors* command. It writes the sectors to _~/sfdisk-<device>-<offset>.bak_ files. The default name of the backup file can be changed with the *--backup-file* option. The backup files contain only raw data from the _device_. For example: