Commit Graph

46007 Commits

Author SHA1 Message Date
Yu Watanabe
986e182352 network: do not try to set invalid value for IPv6 hop limit 2023-11-06 15:53:25 +09:00
Yu Watanabe
39713b075f network: fix indentation
Follow-up for f141b2c053.
2023-11-06 15:53:01 +09:00
Yu Watanabe
93e583aaba Revert "ndisc: Also set link hoplimit"
This reverts commit 0ba8374bb8.

- link->network->ipv6_hop_limit must not be updated, as it may be used
  by multiple interfaces,
- We may receive multiple RA from multiple routers with different hop
  limit, and we should not make the default hop limit flicking,
- First of all, there is no reason that we need to update the default hop
  limit,
- The original issue should be caused by the hash and compare functions
  for Route object.
2023-11-06 15:33:10 +09:00
Daan De Meyer
4f5278eead kernel-install: Log location that uki is installed in
Let's log where we install a UKI when running in verbose mode.
2023-11-05 15:26:20 +00:00
Luca Boccassi
e5a2d6f7d6 Merge pull request #29862 from mrc0mmand/udevadm-followups
A couple of follow-ups for `udevadm control`
2023-11-04 16:48:48 +00:00
Frantisek Sumsal
30e8c19270 udevadm: actually set the log level
Follow-up to e4080a6d97.
2023-11-04 14:05:04 +01:00
Frantisek Sumsal
a833684d8e udevadm: make sure we don't reset max children on each invocation
Follow-up to e4080a6d97.
2023-11-04 13:58:18 +01:00
Luca Boccassi
00cf9b3b1d Merge pull request #29402 from yuwata/sd-journal-cleanups-for-generic-array-bisect
sd-journal: cleanups for generic_array_bisect()
2023-11-04 10:38:03 +00:00
Luca Boccassi
c7cc6d5859 Merge pull request #29469 from yuwata/sd-journal-pin-object
sd-journal: add a way to 'pin' object to protect from reading another object with the same type
2023-11-04 10:37:43 +00:00
Yu Watanabe
e423b40d35 tree-wide: fix typo 2023-11-04 11:58:12 +09:00
Yu Watanabe
7682aedb4e sd-journal: make generic_array_bisect_plus_one() take data object
Then, rename it to generic_array_bisect_for_data().
No functional change, just refactoring.
2023-11-04 11:48:20 +09:00
Yu Watanabe
a1b8d21fab sd-journal: introduce journal_file_pin_object()
Previously, OBJECT_UNUSED was used for 'pinning' the mmap cache for an
object. But, OBJECT_UNUSED is also used for reading object when type
cannot be determined before read, e.g. when reading the tail object.

Let's introduce another category for pinning mmap cache, and use it when
we want to temporary pin an object.
2023-11-04 11:47:55 +09:00
Yu Watanabe
7a56f6b2b9 mmap-cache: introduce window_matches_by_addr()
It is similar to window_matches(), but checks the mapped address.
Mostly preparation for later commits.
2023-11-04 11:42:19 +09:00
Yu Watanabe
1a25ab663c mmap-cache: introduce enum MMapCacheCategory
Then rename context -> category.

No functional change, just refactoring and modernization.
2023-11-04 11:41:15 +09:00
Yu Watanabe
2ebc9cc867 mmap-cache: drop Context and boolean flags in Window
No functional change, just refactoring.
2023-11-04 11:12:12 +09:00
Yu Watanabe
ab8f553d1e sd-journal: rework generic_array_bisect()
- Rename generic_array_bisect_one() -> generic_array_bisect_step(), as there
  is also generic_array_bisect_plus_one(), so the original name is confusing.
- Make generic_array_bisect_step() return TEST_GOTO_NEXT or TEST_GOTO_PREVIOUS
  when the current array does not contain any matching entries.
- Make generic_array_bisect_step() symmetric with respect to the direction
  we are going to, except for the journal corruption handling.
- Make generic_array_bisect_step() gracefully handle journal corruptions,
  so the corruption handling in the caller side can be mostly dropped.
- Especially, when the last entry in an array is corrupted, previously
  we tried to find a valid entry sequentially from the end of the array,
  but now we anyway bisect the array. That should improve performance of
  reading corrupted journal files.
- Return earlier when no entry linked to the chained array (n == 0).
- Add many comments.

No behavior change unless journal is corrupted.
2023-11-04 11:01:30 +09:00
Yu Watanabe
f6548f053d sd-journal: drop redundant re-reading of entry array object
This effectively reverts e562f13158.

In the loop of the generic_array_bisect(), the offset of the entry array
object is unchanged, the object is read at the beginning of the loop, and
we do not read any other entry array object. Hence, it is not necessary to
re-read the object every time we use the object.
2023-11-04 10:54:43 +09:00
Luca Boccassi
775c005026 Merge pull request #29848 from poettering/base64url-too
hexdecoct: implicitly parse URL-safe base64 format, too
2023-11-03 23:26:33 +00:00
Frantisek Sumsal
b0d446b381 fuzz: limit the interface definition input size to 64K
To avoid timeouts with larger inputs.

Resolves: #29856
2023-11-03 21:35:32 +00:00
Luca Boccassi
82e5dc630d Merge pull request #29839 from goenkam/maanya/portabled_support_for_confext
portable: add support for confext
2023-11-03 20:37:46 +00:00
Lennart Poettering
fd81692f4b test: add test for the combined base64/base64url decoder 2023-11-03 21:35:28 +01:00
Lennart Poettering
a5559e0622 hexdecoct: implicitly parse URL-safe base64 format, too
JSON-I (RFC 7493) suggests to use the URL safe base64 alphabet, rather
than the regular one when encoding binary data in JSON strings. We
generally uses the regular alphabet though.

Let's be tolerant in what we parse however: simply accept both formats
when we parse base64.

This does nothing about base64 generation though, only about parsing.
2023-11-03 21:35:24 +01:00
Luca Boccassi
efadc82a11 Merge pull request #29847 from dtardon/udevadm-control-arg-processing
Streamline `udevadm control` arg. handling
2023-11-03 20:34:53 +00:00
Antonio Alvarez Feijoo
38cce239c1 cryptsetup: do not print (null) if pkcs11 uri not set
The pkcs11 uri is no set if the smart card is not inserted while using
`pkcs11-uri=auto` with libcryptsetup plugins.

```
> systemd-cryptsetup attach cr_data /dev/sda1 - pkcs11-uri=auto
Set cipher aes, mode xts-plain64, key size 512 bits for device /dev/sda1.
Security token (null) not present for unlocking volume Linux filesystem (cr_data), please plug it in.
```
2023-11-03 19:10:55 +00:00
David Tardon
a859f794f9 udev-ctrl: drop the unused maybe_disconnected stuff 2023-11-03 18:44:26 +01:00
David Tardon
3bce9d56fd udevadm-control: return early if --exit is used
All the following commands would just fail with -ENOANO anyway, hence
there's no point in sending them. And it allows us to shave off some
error handling code.
2023-11-03 18:44:26 +01:00
David Tardon
e4080a6d97 udevadm-control: parse all args in advance
This is mostly just refactoring to make the code more manageable and
extendable. It doesn't introduce any semantic changes, but it
"optimizes" the communication with udevd a bit:
* If an option is used multiple times, only one command will be sent. If
  the option takes a value, the value of the final appearance of the
  option is used. The only exception is --property, which is additive by
  nature.
* Options --start-exec-queue and --stop-exec-queue are handled together.
  Only one of START_QUEUE/STOP_QUEUE commands will be sent to udevd even
  if both options appear on the command line.
2023-11-03 18:44:26 +01:00
Maanya Goenka
db776f6935 portable: add support for confext
Support confexts for portable services
2023-11-03 16:59:58 +00:00
Luca Boccassi
f0304df6e4 core: check that extensions have the hierarchies before overlaying
Before confext was added, hierarchies always existed in extensions. Now
they are optional - i.e., a sysext will not contain /etc/. So mixing a
confext and a sysext fails, as we'll try to create an overlay with /etc/
from the base, the confext and the sysext, but the latter doesn't have
the directory.

After the source images are mounted, check that each hierarchy exists in
each source image before creating the overlay, and drop them if they
don't.

Follow-up for 55ea4ef096
2023-11-03 16:59:58 +00:00
Luca Boccassi
a39cba252e strv: add strv_free_many() to be used with CLEANUP_ARRAY() 2023-11-03 16:59:58 +00:00
Lennart Poettering
67248bbdf8 namespace: fix whitespace mixup 2023-11-03 17:27:47 +01:00
Luca Boccassi
8d04721507 Merge pull request #28891 from poettering/pcrlock
new pcrlock tool for generating signed PCR policies for PCR 0, 1, 4, …
2023-11-03 16:07:43 +00:00
Frantisek Sumsal
f742f4176c bsod: restore vt on SIGTERM/SIGINT
Let's install a simple no-op signal handler without SA_RESTART for
SIGINT/SIGTERM, which allows us to interrupt read_one_char() and follow
it up with a proper cleanup, including restoring the vt to the original
state.

Resolves: #29478
2023-11-03 16:06:56 +00:00
Yu Watanabe
7636caf5b3 virt: also check if PID1 is in chroot
In PID1, running_in_chroot() is called by safety_checks(), but without
this change, the check did nothing.
2023-11-03 16:05:52 +00:00
Frantisek Sumsal
d4317fe172 nspawn: allow disabling os-release check
Introduce a new env variable $SYSTEMD_NSPAWN_CHECK_OS_RELEASE, that can
be used to disable the os-release check for bootable OS trees. Useful
when trying to boot a container with empty /etc/ and bind-mounted /usr/.

Resolves: #29185
2023-11-03 16:05:14 +00:00
Luca Boccassi
1af46aecf5 Merge pull request #29508 from CodethinkLabs/systemd-vmspawn-pr
systemd-vmspawn implementation that only supports disk images
2023-11-03 16:04:38 +00:00
Lennart Poettering
2037642930 Merge pull request #29840 from poettering/cryptsetup-tweaks-nore
two cryptsetup bugfixes and some clean-ups
2023-11-03 14:40:15 +01:00
Lennart Poettering
41de458aed nspawn: fix two failure paths
We need to go to "finish" rather than just return.

All our exit paths got this right, except two.
2023-11-03 14:39:46 +01:00
Yu Watanabe
b75b8e1d02 Merge pull request #29836 from poettering/libiptc-dlopen
make libiptc dep a dlopen() one
2023-11-03 21:15:29 +09:00
Lennart Poettering
8e35338d09 pcrlock: add pre-defined pcrlock files
These cover well-known measurements done by the UEFI firmware or
systemd.
2023-11-03 11:24:31 +01:00
Lennart Poettering
404aea7815 tree-wide: hook everything up with pcrlock policy
Make sure cryptenroll and repart can enroll TPM2 policies with pcrlock
logic.

Make sure cryptsetup can unlock TPM2 policies with pcrlock in effect.
2023-11-03 11:24:24 +01:00
Lennart Poettering
a434270139 pcrlock: add new pcrlock tool 2023-11-03 11:23:54 +01:00
Lennart Poettering
b52e950598 tpm2-util: add common array for TPM2 hash algorithms
This is useful to enumerate all hash algorithms we want to predict
measurements for.
2023-11-03 11:23:34 +01:00
Lennart Poettering
40ce73214a tpm2-util: make various marshalling/unmarshalling calls static, as we only use them internally in tpm2-util.c
Note, some of these were just added in this same PR. We only exported
them initially to make sure gcc doesn't complained about unused local
symbols.
2023-11-03 11:23:14 +01:00
Lennart Poettering
ce80da02b8 tpm2-util: add generic helpers for sealing/unsealing data
These helpers tpm2_seal_data()/tpm2_unseal_data() are useful for
sealing/unsealing data without any further semantics around them. This
is different from the existing tpm2_seal()/tpm2_unseal() which seal with
a specific policy and serialize in a specific way, as we use it for disk
encryption.

These new helpers are more generic, they do not serialize in a specific
way or imply policy, they are just the core of the sealing/unsealing.

(We should look into porting tpm2_seal()/tpm2_unseal() onto these new
helpers, but this isn#t trivial, since the classic serialization we use
uses a merged marshalling of private/public key, which we'd have to
change in one way or another)
2023-11-03 11:22:55 +01:00
Lennart Poettering
48d060564a tpm2-util: add helper for creating/removing/updating NV index with stored policy
This is the primary core of what pcrlock is supposed to do eventually:
maintain a TPM2 policy hash inside an NV index which we then can
reference via a PolicyAuthorizeNV expression to lock other objects
against it.
2023-11-03 11:22:35 +01:00
Lennart Poettering
2cd8f75316 tpm2-util: add calls for calculating/submitting PolicyAuthorizeNV + PolicyOR TPM2 policies 2023-11-03 11:22:16 +01:00
Lennart Poettering
34657b1f0b tpm2-util: add helper that calculates name of NV index 2023-11-03 11:21:55 +01:00
Lennart Poettering
f7be7a245e tpm2-util: add helper for setting TPM2B_AUTH in binary 2023-11-03 11:21:35 +01:00
Lennart Poettering
360062095d tpm2-util: add helpers for marshalling NV index public areas 2023-11-03 11:21:16 +01:00