Commit Graph

2867 Commits

Author SHA1 Message Date
Karel Zak a8c4f2f9a9 Merge branch 'verity_sig_extension' of https://github.com/bluca/util-linux
* 'verity_sig_extension' of https://github.com/bluca/util-linux:
  mount: fix roothash signature extension in manpage
2021-07-14 12:20:30 +02:00
Luca Boccassi ce02babfa6 verity: add support for corruption action flag
Add verity.oncorruption= to let users override the default kernel
behaviour, using libcrypsetup's relevant flags.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-07-11 18:12:06 +01:00
Luca Boccassi c9c5933a38 mount: fix roothash signature extension in manpage
The PKCS7 RFC recommends to use .p7s for detached signatures file extensions,
so use that in the example.

https://datatracker.ietf.org/doc/html/rfc5751#section-3.2.1
2021-07-03 12:16:34 +01:00
Karel Zak c2ca2837a2 lscpu: don't use DMI if executed with --sysroot
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-02 13:13:01 +02:00
Karel Zak 8678085900 fstrim: clean return code on --quiet-unsupported
This feature is already supported for -a and -A. Let's support it also
when FS specified on command line.

Addresses: https://github.com/systemd/mkosi/pull/721
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-01 17:23:43 +02:00
Huang Shijie 81d6de9166 lscpu: remove the old code
The file "/sys/firmware/dmi/tables/DMI" always exists.

The dmi_decode_cputype() can provide more information then arm_smbios_decode().
So remove it to tidy the code.

Before this patch, we can get the output from Centos 7.9 who has
"/sys/firmware/dmi/entries/4-0/raw" and "/sys/firmware/dmi/tables/DMI":
  ----------------------------------------------------
  BIOS Vendor ID:                  Ampere(TM)
  Model name:                     Neoverse-N1
    BIOS Model name:               Ampere(TM) Altra(TM) Processor
  ----------------------------------------------------

 After this patch which uses "/sys/firmware/dmi/tables/DMI", in Centos 7.9, we get:
  ----------------------------------------------------
  BIOS Vendor ID:                  Ampere(TM)
  Model name:                     Neoverse-N1
    BIOS Model name:               Ampere(TM) Altra(TM) Processor Q00-00 CPU @ 2.8GHz
    BIOS CPU family:               257
  ----------------------------------------------------

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
2021-06-30 11:27:26 +02:00
Karel Zak 35a9b0d577 Merge branch 'fix_mount_fscontext' of https://github.com/tweksteen/util-linux
* 'fix_mount_fscontext' of https://github.com/tweksteen/util-linux:
  mount.8.adoc: Remove context options exclusion
2021-06-25 11:47:06 +02:00
Karel Zak 1d5c14ae1a misc: improve string to number conversions
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-24 16:42:53 +02:00
Karel Zak 24c17c6294 lscpu: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:20:49 +02:00
Karel Zak cfc0d463b4 swapon: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:04:24 +02:00
Karel Zak 70bce9b32f ipcs: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:04:24 +02:00
Karel Zak a1b3e2ec9d eject: do not use atoi()
* remove unnecessary strtok() use
* remove atoi use()

Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:04:24 +02:00
Karel Zak 3e5e56eb0a readprofile: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:37:48 +02:00
Karel Zak fe4e122ab3 lsmem: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:29:33 +02:00
Karel Zak 35d458708e lscpu: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:22:04 +02:00
Karel Zak 9bf8088f25 hwclock: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:21:11 +02:00
Karel Zak c9eea1b354 ipcs: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:20:20 +02:00
Thiébaud Weksteen da277d4eff mount.8.adoc: Remove context options exclusion
The exclusivity between the {fscontext, defcontext} and context options
was removed in kernel 2.6.25[1]. No specific verification on these
options is done in mount(8)[2].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c9180a57a9ab2d5525faf8815a332364ee9e89b7
[2] https://github.com/karelzak/util-linux/blob/master/libmount/src/context_mount.c#L202
2021-06-21 14:16:39 +02:00
Karel Zak 1293b0f65d misc: consolidate stat() error message
Let's use the same error message everywhere to reduce number of
strings for translators.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 12:40:41 +02:00
Karel Zak 17fc8693cd include/c: add drop_permissions(), consolidate UID/GID reset
Fixes: https://github.com/karelzak/util-linux/issues/1354
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 12:25:31 +02:00
Karel Zak 0272f2ef98 dmesg: remove condition [lgtm scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 17:57:13 +02:00
Huang Shijie b366e69b82 lscpu: add more sanity checks for dmi_decode_cputype()
After tested on different platforms, we found dmi_string() may return NULL
in some case.

So add more sanity checks for dmi_decode_cputype().

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
2021-06-18 17:51:11 +02:00
Karel Zak c7da267442 ldattach: add __format__ attribute
Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 16:52:26 +02:00
Karel Zak 365e006a36 hwclock: fix ul_path_scanf() use
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 16:50:58 +02:00
Karel Zak ddadf4748d eject: add __format__ attribute
Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 16:49:28 +02:00
Karel Zak 0197bdb2d0 mount.8: fix overlayfs nfs_export= indention
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 14:37:28 +02:00
Karel Zak 627fb946d5 Merge branch 'man-mount-overlayfs' of https://github.com/iam-TJ/util-linux
* 'man-mount-overlayfs' of https://github.com/iam-TJ/util-linux:
  mount: man-page; add all overlayfs options
2021-06-18 12:33:10 +02:00
Christian Bartolomäus 89456be777
Fix some brackets in synopses 2021-06-17 22:27:17 +02:00
Tj 9fd75ae758 mount: man-page; add all overlayfs options
The section in man (8) mount for overlay is missing nine options which
aren't documented elsewhere either and are useful features to be aware
of and use.

Fixes #1350.
2021-06-17 13:20:36 +01:00
Huang Shijie 4cae2104ec lscpu: add bios_family
In the arm platform, we do not have the "CPU family" as X86.
In the linux kernel, it is hardcode to set the "CPU architecuture:8"
which should be changed for arm v9 in future.

This patch adds "bios_family" field, which we can get from the DMI table.
In the ampere Altra platform, we can get the new lscpu output:
    ----------------------------------------------------------------
	Architecture:                    aarch64
	CPU op-mode(s):                  32-bit, 64-bit
	Byte Order:                      Little Endian
	CPU(s):                          160
	On-line CPU(s) list:             0-159
	Vendor ID:                       ARM
	BIOS Vendor ID:                  Ampere(R)
	Model name:                      Neoverse-N1
	BIOS Model name:                 Ampere(R) Altra(R) Processor Q00-00 CPU @ 3.0GHz
	BIOS CPU family:                 257
	Model:                           1
	Thread(s) per core:              1
    ----------------------------------------------------------------

[kzak@redhat.com: - s/sprintf/snprintf/]

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-16 11:12:14 +02:00
Huang Shijie a772d7c493 lscpu: get the processor information by DMI
The patch :367c85c47286 ("lscpu: use SMBIOS tables on ARM for lscpu")
relies on the existence of "/sys/firmware/dmi/entries/4-0/raw",
which may not exist in standard linux kernel.

But "/sys/firmware/dmi/tables/DMI" should exist and can provide the required
processor information.

This patch uses "/sys/firmware/dmi/tables/DMI"
to get the processor information:

Before this patch, in Ampere Altra platform, the lscpu output is:
   ---------------------------------------------
	Architecture:                    aarch64
	CPU op-mode(s):                  32-bit, 64-bit
	Byte Order:                      Little Endian
	CPU(s):                          160
	On-line CPU(s) list:             0-159
	Vendor ID:                       ARM
	Model name:                      Neoverse-N1
	Model:                           1
	Thread(s) per core:              1
	Core(s) per socket:              80
	Socket(s):                       2
    ........................................
   ---------------------------------------------

After this patch, we can use get the lscpu output
in Ampere Altra platform:
   ---------------------------------------------
	Architecture:                    aarch64
	CPU op-mode(s):                  32-bit, 64-bit
	Byte Order:                      Little Endian
	CPU(s):                          160
	On-line CPU(s) list:             0-159
	Vendor ID:                       ARM
	BIOS Vendor ID:                  Ampere(R)
	Model name:                      Neoverse-N1
	BIOS Model name:                 Ampere(R) Altra(R) Processor Q00-00 CPU @ 3.0GHz
	Model:                           1
	Thread(s) per core:              1
	Core(s) per socket:              80
	Socket(s):                       2
    ........................................
   ---------------------------------------------

[kzak@redhat.com: - s/sprintf/snprintf/]

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-16 11:09:19 +02:00
Karel Zak 3e03cb6806 lib/loopdev: perform retry on EAGAIN
Suggested-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-15 10:34:46 +02:00
Karel Zak 38b9be784b Merge branch 'document-selinux-nosuid' of https://github.com/topimiettinen/util-linux
* 'document-selinux-nosuid' of https://github.com/topimiettinen/util-linux:
  mount.8.adoc: document SELinux use of nosuid mount flag
2021-06-14 12:48:08 +02:00
Topi Miettinen 9a06cc233c
mount.8.adoc: document SELinux use of nosuid mount flag
Using mount flag `nosuid` also affects SELinux domain transitions but
this has not been documented well.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2021-06-12 11:37:51 +03:00
Platon Pronko 8153ca8eee dmesg: fix indentation in man page
Double-semicolon at the end of the option line results in description
being indented extra tab to the right. Replacing them with double-colons
allows all options to be displayed at the same indent level.
2021-06-11 21:23:59 +03:00
Karel Zak 3fdb178370 hwclock: close adjtime on write error [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-11 15:17:42 +02:00
Karel Zak fb9ed3b409 dmesg: fix possible memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-10 13:44:25 +02:00
Nicolai Dagestad 63e523a151 rfkill: Set scols table name to make the json output valid
[kzak@redhat.com: - s/rfkill/rfkilldevices/]

Fixes: https://github.com/karelzak/util-linux/issues/1339
Signed-off-by: Nicolai Dagestad <nicolai@dagestad.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-07 10:42:02 +02:00
Georgy Yakovlev 45cd3aa4de
lscpu: fix build on powerpc
fails with error: label at end of compound statement
and fix typo as bonus.

Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
2021-06-02 13:59:26 -07:00
Karel Zak 0e54ac3980 lscpu: remove extra blank lines
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 13:09:28 +02:00
Karel Zak 79884c5dd1 Merge branch 'lscpu-json-types' of https://github.com/t-8ch/util-linux
* 'lscpu-json-types' of https://github.com/t-8ch/util-linux:
  lscpu: use optional json values
  libsmartcols: add support for optional boolean values
  lscpu: use json types
2021-06-02 13:06:10 +02:00
Karel Zak ac55a4130f Merge branch 'next'
* next: (26 commits)
  build-sys: add script to compare config.h from meson and autotools
  meson: add missing header files check
  docs: update TODO
  tests: update lscpu outputs
  lscpu: read MHZ from /sys/.../cpufreq/scaling_cur_freq
  lscpu: use locale-independent strtod() when read from kernel
  lib/c_strtod; add locale independent strtod()
  tests: update lscpu output
  lscpu: use MHZ as number to be locale sensitive
  lscpu: add SCALMHZ% and "CPU scaling MHz:"
  sulogin: fix whitespace error
  sulogin: ignore none-existing console devices
  lsns: fix old error message
  lsns: fix copy & past in man page
  lsns: fill UID and USER columns for interpolated namespaces
  fixup! lsns: interpolate missing namespaces for converting forests to a tree
  lsns: interpolate missing namespaces for converting forests to a tree
  lsns: reorganize members specifying other namespaces in lsns_namespace
  lsns: make namespace having no process printable
  libblkid: support zone reset for wipefs
  ...
2021-06-02 12:33:07 +02:00
Karel Zak 902d216412 mount: use mnt_fs_is_regularfs()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 12:19:06 +02:00
Ville Skyttä ecec8f1f90 lscpu: fix NVIDIA ARM hw implementer spelling case
Ref respective vendor sites.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-31 12:15:48 +02:00
Ville Skyttä d44a83c1f9 lscpu: recognize more ARM implementers
Add just the implementer string, no parts yet.

Refs https://developer.arm.com/documentation/ddi0595/2021-03/AArch64-Registers/MIDR-EL1--Main-ID-Register
Refs b90e90f40b/arch/arm64/include/asm/cputype.h (L54)

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2021-05-31 12:14:34 +02:00
Thomas Weißschuh 87579a96b2 lscpu: use optional json values
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2021-05-30 23:17:23 +02:00
Thomas Weißschuh 17353ee0cd lscpu: use json types
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2021-05-30 23:17:17 +02:00
Karel Zak b97e2145fa po: add xgettext hint for non-c-format string
Reported-by: Petr Pisar <petr.pisar@atlas.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-27 10:39:58 +02:00
Karel Zak 0a0af6161b lscpu: cleanup tab vs. space
Do not mix tab and space in structs initializations.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-26 11:54:47 +02:00
Bader Zaidan f2aadc1160 lscpu: Replace space with tabs
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-26 11:47:33 +02:00