Commit Graph
44204 Commits
Author SHA1 Message Date
Daan De Meyer e30c6e913c repart: Always take --offline into account 2023-07-18 18:26:23 +02:00
Zbigniew Jędrzejewski-Szmek 7e90814f0a Deprecate efivar SystemdOptions
As mentioned in the NEWS entry, it seems to see very little use, but adds
complexity in our code. It was added mainly with the goal of making it easier
for people using grub2 to modify their boot configuration, but grub2 is gaining
support for BLS snippets. On the systemd side, we now have credentials. So
let's deprecate this, and if there's no outcry, remove it in a few releases.
2023-07-18 17:30:06 +02:00
Joerg Behrmann c46f5680ca analyze: don't warn about version spec compliant versions
This commits adds version_is_valid_versionspec and uses it in
analyze-compare-version.c.

version_is_valid_versionspec differs from version_is_valid in that it acepts
empty strings and since valid characters in a version spec version are all
ASCII letters and digits as well as "-.~^", but ",_+" allowed by
version_is_valid are not.

Also give a more specific warning message on invalid characters.
2023-07-18 15:57:15 +01:00
Daan De Meyer 106fcf0d06 test-resolved-stream: Use a random port number
Hopefully fixes #28393
2023-07-18 14:48:07 +02:00
Dmitry V. Levin fce846e0ac test: fix use of ERRNO_IS_PRIVILEGE()
Given that ERRNO_IS_PRIVILEGE() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the arguments passed to ERRNO_IS_PRIVILEGE() are the values
returned by read_one_line_file() which can legitimately return positive
values without errno semantics, so fix this by moving ERRNO_IS_PRIVILEGE()
invocations to the branches where the return values are known to be negative.
2023-07-16 10:53:30 +00:00
Dmitry V. Levin 0bdea17c0a resolved: fix use of ERRNO_IS_DISCONNECT()
Given that ERRNO_IS_DISCONNECT() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_DISCONNECT() is the value
returned by manager_recv() which can legitimately return 1 without errno
semantics, so fix this by moving ERRNO_IS_DISCONNECT() invocation to the
branch where the return value is known to be negative.
2023-07-16 10:53:30 +00:00
Dmitry V. Levin bb228f0ebc sd-bus: fix use of ERRNO_IS_DISCONNECT()
Given that ERRNO_IS_DISCONNECT() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_DISCONNECT() is the value
returned by bus_socket_process_watch_bind(), bus_socket_process_opening(),
and bus_socket_process_authenticating() which can legitimately return
positive values without errno semantics, so fix this by moving the
ERRNO_IS_DISCONNECT() invocation to the branch where the return value
is known to be negative.
2023-07-16 10:53:30 +00:00
Dmitry V. Levin d5f8890bbf socket: fix use of ERRNO_IS_DISCONNECT()
Given that ERRNO_IS_DISCONNECT() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_DISCONNECT() is the value
returned by socket_acquire_peer() which can legitimately return 1
without errno semantics, so fix this by moving ERRNO_IS_DISCONNECT()
invocation to the branch where the return value is known to be negative.
2023-07-16 10:53:30 +00:00
Dmitry V. Levin ed3745b51c kbd-util: fix use of ERRNO_IS_RESOURCE()
Given that ERRNO_IS_RESOURCE() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_RESOURCE() is the value
returned by recurse_dir_at() which can legitimately return positive
values without errno semantics, so fix this by moving the ERRNO_IS_RESOURCE()
invocation to the branch where the return value is known to be negative.
2023-07-16 10:53:30 +00:00
Dan Streetman f230572f56 tpm2: add tpm2_get_pin_auth()
Add function to calculate the hash digest for a provided pin, and also verify
that the final byte in the digest is not 0. This is required because the TPM
will always remove all trailing 0's from an auth value before using it.

Fixes: #27716
2023-07-16 01:18:03 +01:00
Luca Boccassi c26a01ac8b sd-gpt: __mips__ is also defined when building __mips64
Follow-up for d75ec33ed2
2023-07-15 14:28:35 +01:00
Luca Boccassi 10ad311e7c gpt: it's __mips64, not __mips64__
But it's __mips__ not __mips, obviously

Follow-up for d75ec33ed2
2023-07-15 14:28:35 +01:00
Luca Boccassi 9027aff9d4 Merge pull request #27867 from keszybz/vconsole-reload-again
Restore ordering between vconsole-setup and firstboot services
2023-07-14 23:06:18 +01:00
Luca Boccassi 2c941b4e07 Merge pull request #28401 from keszybz/set-console-size
Set console size when we reset it
2023-07-14 23:02:41 +01:00
Luca Boccassi 224029fcaa Merge pull request #28097 from goenkam/maanya/dissect-tool-support-for-confext
systemd-confext: image-based systemd-wide config update including dm-verity support​
2023-07-14 23:01:26 +01:00
Luca Boccassi ef32125c65 Merge pull request #28387 from yuwata/network-route-table-name
network: cleanups for route table name
2023-07-14 22:57:31 +01:00
Dan Streetman 730d6ab930 tpm2: handle older tpm enrollments without a saved pcr bank
Older code did not save the pcr bank (i.e. pcr hash algorithm), and instead let
tpm2_unseal() find the best pcr bank to use. In commit
2cd9d57548 we changed tpm2_unseal() to no longer
handle an unset pcr bank. This adds back in the handling of an unset pcr_bank
so older sealed data should continue to work.
2023-07-14 22:55:51 +01:00
Dan Streetman 4916cc4750 test: reduce the number of loops in tpm2 test_tpms_pcr_selection_mask_and_hash()
This test loops through masks, but is a relatively long test due to the
increment size between loops; this slightly increases the increment size (from
3->5) which greatly speeds up the test.
2023-07-14 22:54:58 +01:00
Frantisek Sumsal be492020ec tree-wide: a bunch of Coccinelle-suggested tweaks
rc2 edition
2023-07-14 22:49:01 +01:00
Luca Boccassi a4333be63a Merge pull request #28370 from ldv-alt/cname
resolved: fix canonical names returned by hosts lookups
2023-07-14 22:48:23 +01:00
Luca Boccassi d3634ac46b Merge pull request #28301 from berrange/cvm-lockdown
Avoid using SMBIOS for kernel cmdline injection in sd-stub in confidential VMs
2023-07-14 22:47:37 +01:00
Yu Watanabe 8ced74d76b compare: fix typo 2023-07-15 05:11:30 +09:00
Yu Watanabe e8e91a81ee network: refuse to override predefined route table name 2023-07-15 02:56:25 +09:00
Yu Watanabe f4defbdc5d network: do not append table number in TableString field in json output
The json output already contains table number, hence, it is not
necessary to include number in the string.
2023-07-15 02:56:20 +09:00
Maanya Goenka 484d26dac1 confext: add dissect tool support for confext images
Allow image wide systemd tool support for confext images by adding dissect
tool support for these images
2023-07-14 16:59:34 +00:00
Maanya Goenka 8a324d1648 sysext: change the table lookup string to be more verbose 2023-07-14 16:50:33 +00:00
Luca Boccassi a9273824d8 Merge pull request #28355 from yuwata/unit-skip-battery-check-by-kernel-command-line
unit: skip battery check when systemd.skip-battery-check specified on boot
2023-07-14 15:57:13 +01:00
Yu Watanabe 7cfef4bb48 battery-check: allow to skip by passing systemd.battery-check=0 2023-07-14 15:56:29 +01:00
Daniel P. Berrangé 4b1153cfcc efi: don't pull kernel cmdline from SMBIOS in a confidential VM
In a confidential VM, the SMBIOS data is not trusted, as it is under the
control of the host OS/admin and not covered by attestation of the machine.

Fixes: https://github.com/systemd/systemd/issues/27604
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-07-14 14:18:09 +01:00
Daniel P. Berrangé b354a2cafc efi: add helper API for detecting confidential virtualization
This helper is a simplified version of detect_confidential_virtualization()
that merely returns a boolean status flag reflecting whether we are believed
to be running inside a confidential VM.

This flag can be used for turning off features that are inappropriate to
use from a CVM, but must not be used for releasing sensitive data. The
latter must only be done in response to an attestation for the environment.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-07-14 14:18:09 +01:00
Dmitry V. Levin 1ddc2f7fbc resolved: fix the canonical name returned by hosts lookup by name
In etc_hosts_lookup_by_name(), return the canonical name of the resolved
address instead of the name used to obtain that address.

Resolves: #20158
2023-07-14 13:13:53 +00:00
Luca Boccassi 0865c465ca Merge pull request #26365 from dtardon/multiple-polkit-calls
Allow D-Bus methods to auth. for more than one polkit action
2023-07-14 14:13:53 +01:00
Dmitry V. Levin 0ff8f2a33a resolved: fix the canonical name returned by hosts lookup by address
In etc_hosts_lookup_by_address(), make sure the canonical name of the given
address is returned first in the list of names that address resolves to.

Resolves: #25088
2023-07-14 13:13:53 +00:00
Dmitry V. Levin 1bd76a6217 resolved: keep track of first names listed for each address in /etc/hosts
These names will be used later in responses as canonical names.
2023-07-14 13:13:53 +00:00
Daniel P. Berrangé 129b9e3f42 fundamental: share constants for confidential virt detection
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-07-14 14:06:51 +01:00
Daan De Meyer a061312324 kernel-install: Avoid reopening file descriptor via /proc
kernel-install used to work without /proc mounted before the rewrite
in C. Let's restore that property by making sure we don't reopen
file descriptors via /proc. In this case, parse_env_file_fdv() calls
fdopen_independent() to get a FILE * for the given file descriptor
(which itself calls fd_reopen()). Let's avoid the call to
fdopen_independent() by using chase_and_fopenat_unlocked() which
gives us a FILE * immediately without having to reopen any file
descriptors.
2023-07-14 12:28:26 +02:00
Luca Boccassi 7f92564b38 Merge pull request #28380 from bluca/homed_translate
homed: make all pam_prompt strings translatable
2023-07-14 10:35:58 +01:00
Daan De Meyer 6d4f612c70 Merge pull request #28376 from yuwata/json_append
Use json_append() and json_variant_append_array()
2023-07-14 10:07:48 +02:00
Yu Watanabe dc32de3924 network: check lifetime of address and route before configure
Otherwise, we may configure a route that depends on the existence
of an address or another route, and may fail when lifetime of one
of them are already zero.

Hopefully fixes #28358.
2023-07-14 10:01:20 +02:00
Yu Watanabe 4cbabc195c sd-journal: fix 'the the' 2023-07-14 16:53:41 +09:00
Daan De Meyer 102f36efd1 terminal-util: Document boolean parameter in one more place 2023-07-14 09:12:54 +02:00
Daan De Meyer 29f5a5aef0 tree-wide: Set /dev/console size when we reset it
If a size is configured for /dev/console via the kernel cmdline,
let's make sure we take that into account when resetting /dev/console.
2023-07-14 09:11:29 +02:00
Yu Watanabe 0bf091a626 proc-cmdline: re-implement proc_cmdline_filter_pid1_args() without using getopt_long()
If getopt_long() is called for a list of arguments and it is freed, then
calling getopt_long() for another list will trigger use-after-free.

The function proc_cmdline_filter_pid1_args() may be called before or during
parsing program arguments (typically named as parse_argv()), hence we cannot
use getopt_long() in proc_cmdline_filter_pid1_args().

Fixes #28366.
2023-07-14 13:36:50 +09:00
Yu Watanabe 542f99cc8b test: add more test cases for proc_cmdline_filter_pid1_args() 2023-07-14 13:36:50 +09:00
Yu Watanabe f14f1273d3 Merge pull request #27526 from mrc0mmand/journal-fss
journal: clean up the FSS related code a bit & add a couple of tests
2023-07-14 13:30:30 +09:00
Fuminobu TAKEYAMA ef4300654e core: fix race condition during startup of a service with ExitType=cgroup
This commit allows service_sigchld_event() is executed before
service_dispatch_exec_io(), which might happen when a main process exits
very quickly.

Also do not check PID for service goodness because the main process have
already been exited in this case.

Fix: #27919
2023-07-14 10:51:41 +08:00
Mike Yuan b5fd3956ec fstab-generator: resolve bind mount source when in initrd
We currently prepend /sysroot to mount points for entries
in /sysroot/etc/fstab. But when it comes to bind mounts,
the source needs to canonicalized too.

Fixes #6827
Replaces #7894
2023-07-14 01:29:23 +08:00
Mike Yuan 35df78cd88 fstab-util: add fstab_is_bind 2023-07-14 01:27:02 +08:00
Daan De Meyer d7d36252e5 ukify: Derive public key from private key if not specified 2023-07-13 16:31:05 +01:00
David Tardon b1ebc20137 bus-polkit: avoid extra variable 2023-07-13 16:40:30 +02:00