Commit Graph

15120 Commits

Author SHA1 Message Date
Qais Yousef 860112cb21 uclampset: Plumb in bash-completion
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
2021-02-02 10:56:26 +00:00
Qais Yousef f59654bb06 uclampset: Plump into the build system
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
2021-02-02 10:56:26 +00:00
Qais Yousef 9dd95bea42 uclampset: Add man page
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
2021-02-02 10:56:26 +00:00
Qais Yousef 5407f89782 Add uclampset schedutil
Utilization clamping is a new kernel feature that got merged in 5.3. It
allows controlling the performance of a process by manipulating the
utilization such that the task appears bigger or smaller than what it
really is.

There's a system-wide control to to restrict what maximum values the
process are allowed to use.

Man page added in a later patch attempts to explain the usage in more
detail.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
2021-02-02 10:56:26 +00:00
Ivan Mironov 5df455dbbc agetty: Allow --init-string on a virtual console
This option has valid use cases on virtual consoles. Example:
enabling screen blanking in the same way as `setterm --blank ...`
does.

Signed-off-by: Ivan Mironov <mironov.ivan@gmail.com>
2021-02-02 00:29:25 +05:00
Karel Zak d687a6b4b0 eject: cleanup before successful exit
Fixes: https://github.com/karelzak/util-linux/issues/1239
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-01 12:21:18 +01:00
Frantisek Sumsal f30ec3eee6 ci: run the build test for each pull request 2021-02-01 12:00:30 +01:00
Frantisek Sumsal eed6393d14 ci: build both w/ and w/o sanitizers on GH Actions 2021-02-01 12:00:30 +01:00
Frantisek Sumsal b17a386004 ci: code cleanup 2021-02-01 12:00:30 +01:00
Frantisek Sumsal 81edf9f0da ci: deal with uninstrumented binaries using instrumented libs
All `eject` tests were failing under ASan, since they call /bin/mount,
which is uninstrumented, but it picks up the instrumented `libblkid`
library, causing ASan to complain:

gcc:
ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
eject: unmount of `/home/runner/work/util-linux/util-linux/tests/output/eject/umount-by-disk-mounted-mnt' failed

clang:
/bin/umount: symbol lookup error: /home/runner/work/util-linux/util-linux/.libs/libblkid.so.1: undefined symbol: __sancov_lowest_stack
eject: unmount of `/home/runner/work/util-linux/util-linux/tests/output/eject/umount-by-disk-mounted-mnt' failed

Subsequently, all tests which require the `scsi_debug` module get skipped,
since it's still in use due to the failed umount:

fdisk: align 512/4K                   ... SKIPPED (cannot remove scsi_debug module (rmmod))
fdisk: align 512/4K +alignment_offset ... SKIPPED (cannot remove scsi_debug module (rmmod))
fdisk: align 512/4K +MD               ... SKIPPED (cannot remove scsi_debug module (rmmod))

In case of gcc this can be easily resolved by setting $LD_PRELOAD to the
respective ASan library. clang makes this a bit more difficult, since it
compiles the ASan library statically, so firstly we need to force dynamic
linking (via -shared-asan), and then add the runtime DSO path to the
linker cache, since it's in a non-standard path.
2021-02-01 12:00:30 +01:00
Frantisek Sumsal c40b3cd03d text-utils: correctly detect ASan under clang
__SANITIZE_ADDRESS__ is not defined when compiling with clang, so cover
both use cases with a special set of macros
2021-02-01 11:59:47 +01:00
Frantisek Sumsal 0388289e3a ci: use the correct compiler version 2021-02-01 11:54:31 +01:00
Frantisek Sumsal 4076d51e2e ci: 'downgrade' Ubuntu version to Bionic
Since the current Ubuntu Focal image in GH Actions is missing the
`kernel-modules-extra` package with the `scsi_debug` module[0], let's
change the distro flag from `ubuntu-20.04` (Focal) to `ubuntu-latest`
(currently Bionic, as Focal is still in the beta phase).

[0] https://github.community/t/missing-scsi-debug-linux-kernel-module-on-gh-actions/157698
2021-01-30 19:11:23 +01:00
Qais Yousef ee3f4a3dfc Move sched_attr struct and syscall definitions into header file
So that we can re-use them in other files.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
2021-01-30 17:13:17 +00:00
ToddRK deba6720fb fsck.cramfs: fix fsck.cramfs crashes on blocksizes > 4K
fsck.cramfs crashes when extracting a cramfs image with a 16KB blocksize.
The read_buffer is hardcoded for a 4KB blocksize.  When using a blocksize
larger than 4KB, the program's code uses indexes that go past the end of the
allocated space for the read_buffer and this causes the crash.

The following changes fix the problem for me in the latest 2.36.1 release of
fsck.cramfs.c.  However there are hardcoded values of 4096 in the code that
might cause problems under other circumstances and I have not attempted to
fix those.

[kzak@redhat.com: - some coding style changes to code]

Fixes: https://github.com/karelzak/util-linux/issues/1232
Signed-off-by: ToddRK <ToddRK@example.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-28 12:46:49 +01:00
Karel Zak 867df2617c lib: use ul_prefix for close_all_fds() and mkdir_p()
The names are too generic and it makes problems in static libraries.

Addresses: https://gitlab.com/cryptsetup/cryptsetup/-/issues/623
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-28 10:27:21 +01:00
Karel Zak 67f2918a6b github: enable ci-build for all basic branches
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 15:52:41 +01:00
Karel Zak ba8fbf21ef docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 15:51:26 +01:00
Karel Zak b94c187069 travis: remove old ubuntu
Ubuntu 12.04 LTS (Precise Pangolin) -- from April 2012 to April 2017.

It's more and more difficult to keep code and tests in all details
compatible with it 4 years dead distro.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 15:25:54 +01:00
Karel Zak bf32069382 github: make sure compiler is defined
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 12:39:22 +01:00
Karel Zak cf82a233eb github: CC fix export
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 12:09:01 +01:00
Karel Zak 025c43dfe1 github: export CC and CXX
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 11:56:33 +01:00
Karel Zak e589e25f19 tests: skip hwclock/systohc on GH Actions
It seems the delay on GH is too large to get proper result for this
tests. We already ignore it on Travis.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 11:54:38 +01:00
Karel Zak f9d7ed5517 tests: mark ul/basic as KNOWN_FAIL
It works locally and on Travis, but fail on Github Actions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 11:39:10 +01:00
Karel Zak 8839d98089 tests: migrate from ext3 to ext2
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 11:11:14 +01:00
Karel Zak bf7e7d5c84 tests: dump more information about CFS and block devices
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 10:30:01 +01:00
Karel Zak 8b6019e65a github: remove distcheck
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-26 09:44:44 +01:00
Karel Zak 830a871e16 github: cleanup cibuild.sh
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-25 17:32:17 +01:00
Karel Zak 48575df6e8 github: fix btrfs package name
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-25 17:13:51 +01:00
Karel Zak 263db7f6bf github: fix cibuild typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-25 16:57:06 +01:00
Karel Zak 84cccd3eb5 github: add build workflow
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-25 16:54:38 +01:00
Karel Zak 7b78b571b7 libmount: allow --read-only for not-root users
The command "mount -r" was supported for non-root users in very old
mount(8) versions. Unfortunately, in this case libmount replaces all
mount options from command line by options from fstab. We need
exception for MS_RDONLY.

Fixes: https://github.com/karelzak/util-linux/issues/1235
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-25 11:11:05 +01:00
Karel Zak 34a58c05a7 travis: use verbose mode (V=1) for make
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-25 09:23:16 +01:00
Karel Zak 7397f2c1f9 build-sys: add restrict keyword fallback
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-22 13:28:02 +01:00
Karel Zak 33b09aebf5 libuuid: improve "restrict" keyword use
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 on travis-ci returns:

 libuuid/src/unparse.c:42:67: error: ‘restrict’ undeclared here (not in a function)
 libuuid/src/unparse.c: In function ‘uuid_fmt’:

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-22 10:44:01 +01:00
Karel Zak 798608c842 Merge branch 'fix-vms' of https://github.com/Govelius/util-linux 2021-01-21 12:01:19 +01:00
Karel Zak 31862cde0a fix compiler warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-21 10:26:25 +01:00
Shahid Laher 2c2ff04fe9 libmount: add vboxsf, virtiofs to pseudo filesystems
Filesystems provided by a hypervisor for guest kernels:
* vboxsf: Linux 5.6
* virtiofs: Linux 5.4

Signed-off-by: Shahid Laher <govellius@gmail.com>
2021-01-20 18:04:33 +00:00
Karel Zak df0836dc90 wipefs: fix compiler warning
misc-utils/wipefs.c: In function ‘main’:
misc-utils/wipefs.c:838:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
misc-utils/wipefs.c:838:3: note: use option -std=c99 or -std=gnu99 to compile your code

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-20 09:20:54 +01:00
Karel Zak 734678205a tests: improve u64 use in ipcs test
UINT64_MAX is 18446744073709551615, but 2^64 is 18446744073709551616.
We also need to use kbytes in all calculation in the test than bytes
as ipcs by default do not use bytes anymore.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-19 16:25:33 +01:00
Karel Zak 8399fe089b lsblk: fix filesystem array allocation
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-19 14:59:01 +01:00
Karel Zak c52d16098c ipcs: fallback for overflow
The previous commit 7a08784ab0 reduced
number of situation when we need fallback when kbytes calculated for
shmall pages, but there is still possible to see overflows.

This patch add fallback also for kbytes.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-18 16:04:18 +01:00
Karel Zak a992cc0d98 tests: set shmmni to 32k
Linux kernel since 6730e6580177d13f4612767873cb5a533ad63c61 checks for
limits and kernel ipc/utils.h defines

 #define IPCMNI_SHIFT         15
 #define IPCMNI               (1 << IPCMNI_SHIFT)

it means 32768 (aka shortint max). Let's use it in our tests too to
avoid "Invalid argument" when write to /proc/sys/kernel/shmmni.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-18 13:22:26 +01:00
Vasilis Liaskovitis 7a08784ab0 ipcs: Avoid shmall overflows
Avoid computing the number of bytes in shmall, by only
computing and printing the number of Kbytes. This avoids
some overflows, e.g.

$ echo "4503599627370496" > /proc/sys/kernel/shmall
$ ipcs -l | grep 'max total shared memory'
Before:
max total shared memory (kbytes) = 18014398509481980
After:
max total shared memory (kbytes) = 18014398509481984

$ echo "99993599627370500" > /proc/sys/kernel/shmall
99993599627370500
$ ipcs -l | grep 'max total shared memory'
Before:
max total shared memory (kbytes) = 18014398509481980
After:
max total shared memory (kbytes) = 399974398509482000

v1->v2:
  Print the non-overflow KB value only for IPC_UNIT_KB and
IPC_UNIT_DEFAULT.
  This way --bytes and --human options will still get an expected
output
  (but not avoiding the overflow).

Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-18 11:38:58 +01:00
Roberto Bergantinos Corpas ff21f476f8 findmnt: add option to list all fs-independent flags
It might be useful for security auditing purposes list all possible
mount flags/options including default set which are normally not listed.

This patch adds "--vfs-all" option to list all fs-independent flags
on VFS-OPTIONS column, as well as libmount funcionality to accomplish
it.

i.e.:

$ findmnt -o VFS-OPTIONS
VFS-OPTIONS
rw,relatime
rw,nosuid,nodev,noexec,relatime
rw,nosuid,nodev,noexec,relatime
ro,nosuid,nodev,noexec
...

$ findmnt --vfs-all -o VFS-OPTIONS
VFS-OPTIONS
rw,exec,suid,dev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
rw,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
rw,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
ro,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,norelatime,nostrictatime,nolazytime,symfollow
...

[kzak@redhat.com: - cleanup coding style and comments]

Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-15 17:51:07 +01:00
Karel Zak 372ce5b74e libmount: do not canonicalize ZFS source dataset
Fixes: https://github.com/karelzak/util-linux/issues/1231
Addresses: https://github.com/systemd/systemd/issues/18188
Addresses: https://github.com/openzfs/zfs/pull/11295
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-14 13:45:20 +01:00
Karel Zak 0735d0efe1 lib/selinux-utils: tiny cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-13 15:04:02 +01:00
Karel Zak b105446e69 mkswap: remove deprecated SELinux matchpathcon()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-13 14:58:43 +01:00
Karel Zak e1de70b3c3 chfs-chfn: remove deprecated selinux_check_passwd_access()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-13 14:27:15 +01:00
Karel Zak b5debf7105 lib/selinux-utils: cleanup function names
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-13 13:33:41 +01:00