Commit Graph
67956 Commits
Author SHA1 Message Date
Lennart Poettering 283eb4fdd1 namespace: don't retry to a mount if we didn't actually manage to create an inode 2023-10-16 13:18:03 +02:00
Lennart Poettering 3c36f7636c namespace: downgrade log message of error we ignore to LOG_WARNING
frankly, the log message shouldn't be there at all, but the error path
be propagated up, with a recognizable error code. But apparently this is
important to @bluca.
2023-10-16 13:17:59 +02:00
Lennart Poettering 3d1b999b53 namespace: convert ProtectHostname= logic to a static table
Let's simplify things, and make them more alike handling more similar to
the other ProtectXYZ= settings.
2023-10-16 13:12:48 +02:00
Lennart Poettering 063c977a79 namespace: normalize memory management of mount list
So far we calculated exactly how many mounts we will generate, which is
a bit fragile, and easy to get wrong.

Let's normalize this, and grow the array of mounts as we need.

Various other modernizations while we are at it, such as FOREACH_ARRAY
usage, or `_cleanup_` usage.
2023-10-16 12:17:56 +02:00
Lukas c7fda70716 stub: NULL checks for DeviceHandle and FilePath
UKIs may be loaded in a way, that there can not be a device handle to
the filesystem, that contains the image, for example when using a
bootloader to load the image from a partition with a file system that is
not supported by the firmware.

With the current systemd stub, this causes a failed assertion, because
stub gets passed a NULL DeviceHandle and FilePath. Inserting two
explicit checks enables proper boot even in this case.

Fixes: #29331
2023-10-16 10:44:03 +02:00
Daan De Meyer 36d87065f2 Merge pull request #29558 from mrc0mmand/varlinkctl-tests
varlink: add a couple of tests + accompanying fixes
2023-10-16 09:49:42 +02:00
Vishal Chillara Srinivas 57cf92f741 resolve: fix no mDNS announcement after probing
According to RFC 6762 section 8, an mDNS responder is supposed to announce its
records after probing.
Currently, there is a check in dns_scope_announce which returns if there are any
pending transactions. This prevents announcements from being sent out even if there
are pending non-probe transactions.

To fix this, return only if there are active probe transactions.
2023-10-16 09:21:51 +02:00
Jan Janssen e9e40862de fuzz: Add fuzzer for efi conf/osrel parsing 2023-10-15 17:41:25 +02:00
Jan Janssen 5ce851ab99 boot: Fix OOB reads in conf/osrel parsing 2023-10-15 17:41:25 +02:00
Jan Janssen f17670a0c3 boot: Move line_get_key_value to efi-string
No functional changes.
2023-10-15 17:41:25 +02:00
Jan Janssen 539d000740 boot: Move parse_boolean to efi-string
No functional changes.
2023-10-15 17:41:25 +02:00
Jan Janssen ec9d3fc51c test: Remove unnecessary test prefix 2023-10-15 12:10:37 +01:00
Frantisek Sumsal abcf59970d core: don't downgrade multi-state settings to boolean
Protect{Home,System,Proc,Subset}= are not booleans, so make sure we use
the intended value instead of just true/false.

See: https://github.com/systemd/systemd/pull/29552
Follow-up to: 79d956d
2023-10-15 14:04:28 +08:00
Frantisek Sumsal d04af6aaca docs: update fuzzers docs 2023-10-14 17:55:29 +02:00
Frantisek Sumsal 78ea6a549f test: update Ubuntu CI instructions 2023-10-14 17:40:07 +02:00
Frantisek Sumsal e97f2dfde4 varlink: drop dead code
'#' is never part of either allowed_chars or allowed_delimiters when we
parse structs/enums.
2023-10-14 17:40:07 +02:00
Frantisek Sumsal a972870ea2 varlink: use int for log level 2023-10-14 17:40:07 +02:00
Frantisek Sumsal 779e7b4410 varlink: don't panic on malformed method definition 2023-10-14 17:40:07 +02:00
Frantisek Sumsal 13de7c7e66 test: add a fuzzer for the varlink IDL stuff 2023-10-14 17:40:07 +02:00
Frantisek Sumsal 4b2391c4e3 test: add a couple of tests for varlinkctl 2023-10-14 17:40:07 +02:00
Luca Boccassi da638eb4c9 core: fix deserialization copypasta
CID#1522788
2023-10-14 11:26:57 +01:00
Mike Yuan 8d85efae91 core/exec-invoke: rename parameters of get_fixed_{user,group}
Follow-up for 1c9433559a

The user/group passed in could be either the name or the uid/gid.
2023-10-14 09:09:32 +01:00
Luca Boccassi edc85a02ec Merge pull request #29569 from YHNdnzj/foreach-array
core: use FOREACH_ARRAY more and some other minor changes
2023-10-14 09:08:40 +01:00
Luca Boccassi 0e3986bc1c Merge pull request #29525 from poettering/confext-sysext-multimodal
dissect: make sure we can dissect and inspect DDIs that are both confext *and* sysext
2023-10-14 00:28:47 +01:00
Mike Yuan 06120a1575 core: add MemoryKSM and SetLoginEnvironment to exec_context_dump 2023-10-14 06:41:02 +08:00
Mike Yuan 4520681da1 core/execute: correct alignment 2023-10-14 06:41:01 +08:00
Mike Yuan f7df8adb0c core/execute: use FOREACH_ARRAY more 2023-10-14 06:41:01 +08:00
Mike Yuan 1c2d424e45 core/execute-serialize: use FOREACH_ARRAY more 2023-10-14 06:35:23 +08:00
Lennart Poettering f2c96f0fd3 run: support --scope on old service managers that lack native PIDFD support
Before this we'd fail with a complaint that PIDFDs is not supported by
the service manager. Add some compat support by falling back to classic
numeric PIDs in that case.
2023-10-13 23:16:52 +01:00
Lennart Poettering 0e9f229769 update TODO 2023-10-14 00:01:59 +02:00
Luca Boccassi ccba67f494 Merge pull request #27890 from bluca/executor
core: add systemd-executor binary
2023-10-13 22:01:16 +01:00
Dan Streetman 0f1cb04f9a tpm: update comment on transient handle GetCapability bug in kernel tpm resource manager
Add clarification and link to kernel bug.
2023-10-13 22:17:18 +02:00
Mike Yuan 6906c028e8 core/varlink: make sure we setup non-serialized varlink sockets
Before this PR, if m->varlink_server is not yet set up during
deserialization, we call manager_setup_varlink_server rather than
manager_varlink_init, the former of which doesn't setup varlink
addresses, but only binds to methods. This results in that
newly-added varlink addresses not getting created if deserialization
takes place.

Therefore, let's switch to manager_varlink_init, and add some
sanity checks to it in order to prevent listening on the same
address twice.

Fixes #29373

Replaces #29421
2023-10-12 23:11:56 +01:00
Priit Laes c08bec1587 systemd-journal-upload: Increase failure tolerance (#19426, #2877)
As systemd-journal-upload deals mostly with remote servers, add
some failsafes to its unit to restart on failures.

```
[Service]
Restart=on-failure
RestartSteps=10
RestartMaxDelaySec=60
```
2023-10-12 23:10:59 +01:00
Luca Boccassi f8be60c6d9 Merge pull request #29551 from poettering/no-empty-structs-in-varlink
varlink: properly refuse empty structs/enums in varlink IDL
2023-10-12 23:10:20 +01:00
Lennart Poettering 76641edfa2 varlinkctl: generate slightly more useful error messages 2023-10-12 23:09:30 +01:00
Luca Boccassi 5986e3f4db Merge pull request #29502 from keszybz/sd-boot-config-tweaks
Tweaks to sd-boot UX
2023-10-12 23:08:56 +01:00
Pierre GRASSER 7a0605b3a2 po: Translated using Weblate (French)
Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Pierre GRASSER <pierre.grasser@proton.me>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fr/
Translation: systemd/main
2023-10-12 17:42:22 +01:00
Luca Boccassi 75689fb2d4 core: move code from execute.c to exec-invoke.c
No functional changes, only moving code that is only needed in
exec_invoke, and adding new dependencies for seccomp/selinux/apparmor/pam
in meson for the sd-executor binary.
2023-10-12 15:01:51 +01:00
Luca Boccassi bb5232b6a3 core: add systemd-executor binary
Currently we spawn services by forking a child process, doing a bunch
of work, and then exec'ing the service executable.

There are some advantages to this approach:

- quick: we immediately have access to all the enourmous amount of
  state simply by virtue of sharing the memory with the parent
- easy to refactor and add features
- part of the same binary, will never be out of sync

There are however significant drawbacks:

- doing work after fork and before exec is against glibc's supported
  case for several APIs we call
- copy-on-write trap: anytime any memory is touched in either parent
  or child, a copy of that page will be triggered
- memory footprint of the child process will be memory footprint of
  PID1, but using the cgroup memory limits of the unit

The last issue is especially problematic on resource constrained
systems where hard memory caps are enforced and swap is not allowed.
As soon as PID1 is under load, with no page out due to no swap, and a
service with a low MemoryMax= tries to start, hilarity ensues.

Add a new systemd-executor binary, that is able to receive all the
required state via memfd, deserialize it, prepare the appropriate
data structures and call exec_child.

Use posix_spawn which uses CLONE_VM + CLONE_VFORK, to ensure there is
no copy-on-write (same address space will be used, and parent process
will be frozen, until exec).
The sd-executor binary is pinned by FD on startup, so that we can
guarantee there will be no incompatibilities during upgrades.
2023-10-12 15:01:51 +01:00
Luca Boccassi 56df7a461f core: add serialization/deserialization for CGroupContext 2023-10-12 14:57:38 +01:00
Luca Boccassi 73c12fac1b core: add serialization/deserialization for ExecRuntime 2023-10-12 14:57:38 +01:00
Luca Boccassi beb4ae8755 core: add serialization/deserialization for ExecParameters 2023-10-12 14:57:38 +01:00
Luca Boccassi b806a5d35e core: add serialization/deserialization for ExecCommand 2023-10-12 14:56:25 +01:00
Luca Boccassi 5699a1689b core: add serialization/deserialization for ExecContext 2023-10-12 14:56:23 +01:00
Lennart Poettering 5d2ea9b5cf test: add simple test for two common kind of errors 2023-10-12 15:28:06 +02:00
Lennart Poettering efe511e910 varlink: don't generate %m error message if we are synthesizing the error
We are outputting a more useful log message anyway, the "Bad message"
error string is just confusing.
2023-10-12 15:26:27 +02:00
Lennart Poettering 6fa09278b8 varlink: refuse empty () structs/enums
If we encounter an empty struct in the varlink IDL it could also be an
empty enum. Refuse this to avoid the ambiguity.

The spec doesn't cover this case clearly, hence let's better be on the
safe side and refuse it rather than making a decision what it means.
2023-10-12 15:25:16 +02:00
Yu Watanabe 558dc668f6 Merge pull request #29544 from yuwata/network-dhcp-bus-command
network: several fixlets for DBus methods for DHCP client and server
2023-10-12 22:06:50 +09:00
Luca Boccassi c3166b25e2 core: add cgroup_add_or_update_device_allow() 2023-10-12 13:37:22 +01:00