]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 months agoMerge pull request #29546 from poettering/run-invoc-id
Lennart Poettering [Mon, 16 Oct 2023 17:00:18 +0000 (19:00 +0200)] 
Merge pull request #29546 from poettering/run-invoc-id

run: output invocation ID when starting service and scope units

7 months agoMerge pull request #29272 from enr0n/coredump-container
Lennart Poettering [Mon, 16 Oct 2023 14:13:16 +0000 (16:13 +0200)] 
Merge pull request #29272 from enr0n/coredump-container

coredump: support forwarding coredumps to containers

7 months agomount-util: use mount beneath to replace previous namespace mount
Luca Boccassi [Fri, 29 Sep 2023 00:50:15 +0000 (01:50 +0100)] 
mount-util: use mount beneath to replace previous namespace mount

Instead of mounting over, do an atomic swap using mount beneath, if
available. This way assets can be mounted again and again (e.g.:
updates) without leaking mounts.

7 months agoMerge pull request #29548 from poettering/sysext-varlink
Lennart Poettering [Mon, 16 Oct 2023 13:10:24 +0000 (15:10 +0200)] 
Merge pull request #29548 from poettering/sysext-varlink

sysext: add a varlink IPC interface

7 months agoMerge pull request #29562 from poettering/namespace-fuckup-fix
Lennart Poettering [Mon, 16 Oct 2023 13:10:08 +0000 (15:10 +0200)] 
Merge pull request #29562 from poettering/namespace-fuckup-fix

namespace: normalize memory management of mount list

7 months agoupdate TODO 29546/head
Lennart Poettering [Mon, 16 Oct 2023 11:48:40 +0000 (13:48 +0200)] 
update TODO

7 months agorun: pin the unit we invoke continously while we are running
Lennart Poettering [Mon, 16 Oct 2023 09:31:38 +0000 (11:31 +0200)] 
run: pin the unit we invoke continously while we are running

We read properties of the unit, hence it shouldn't be GC'ed as long as
we run. Hence, let's just set AddRef unconditionally for the units we
create.

7 months agorun: output invocation ID when starting service and scope units
Lennart Poettering [Thu, 12 Oct 2023 10:03:03 +0000 (12:03 +0200)] 
run: output invocation ID when starting service and scope units

7 months agonamespace: add // FIXME comments on some suplicate logging 29562/head
Lennart Poettering [Mon, 16 Oct 2023 11:16:55 +0000 (13:16 +0200)] 
namespace: add // FIXME comments on some suplicate logging

@bluca thinks duplicate logging as a feature, hence simply mark these
log messages as // FIXME, but don't bother.

7 months ago namespace: downgrade log messages to LOG_DEBUG
Lennart Poettering [Mon, 16 Oct 2023 11:16:40 +0000 (13:16 +0200)] 
 namespace: downgrade log messages to LOG_DEBUG

almost all code in namespace.c only logs at debug level as it is
"library-like" code. But there are some outliers. Adjust them to match
the rest of the code

(Well, there are some left)

7 months agonamespace: don't retry to a mount if we didn't actually manage to create an inode
Lennart Poettering [Mon, 16 Oct 2023 10:42:06 +0000 (12:42 +0200)] 
namespace: don't retry to a mount if we didn't actually manage to create an inode

7 months agonamespace: downgrade log message of error we ignore to LOG_WARNING
Lennart Poettering [Mon, 16 Oct 2023 10:57:16 +0000 (12:57 +0200)] 
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.

7 months agonamespace: convert ProtectHostname= logic to a static table
Lennart Poettering [Mon, 16 Oct 2023 08:36:17 +0000 (10:36 +0200)] 
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.

7 months agonamespace: normalize memory management of mount list
Lennart Poettering [Fri, 13 Oct 2023 16:58:13 +0000 (18:58 +0200)] 
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.

7 months agoupdate TODO 29548/head
Lennart Poettering [Thu, 12 Oct 2023 10:36:11 +0000 (12:36 +0200)] 
update TODO

7 months agosysext: make some calls available via varlink
Lennart Poettering [Mon, 9 Oct 2023 16:57:41 +0000 (18:57 +0200)] 
sysext: make some calls available via varlink

7 months agostub: NULL checks for DeviceHandle and FilePath
Lukas [Sun, 8 Oct 2023 17:45:34 +0000 (19:45 +0200)] 
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
7 months agoMerge pull request #29558 from mrc0mmand/varlinkctl-tests
Daan De Meyer [Mon, 16 Oct 2023 07:49:42 +0000 (09:49 +0200)] 
Merge pull request #29558 from mrc0mmand/varlinkctl-tests

varlink: add a couple of tests + accompanying fixes

7 months agoresolve: fix no mDNS announcement after probing
Vishal Chillara Srinivas [Fri, 13 Oct 2023 09:06:06 +0000 (14:36 +0530)] 
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.

7 months agofuzz: Add fuzzer for efi conf/osrel parsing
Jan Janssen [Sun, 15 Oct 2023 09:43:59 +0000 (11:43 +0200)] 
fuzz: Add fuzzer for efi conf/osrel parsing

7 months agoboot: Fix OOB reads in conf/osrel parsing
Jan Janssen [Sun, 15 Oct 2023 09:32:32 +0000 (11:32 +0200)] 
boot: Fix OOB reads in conf/osrel parsing

7 months agoboot: Move line_get_key_value to efi-string
Jan Janssen [Sun, 15 Oct 2023 08:09:55 +0000 (10:09 +0200)] 
boot: Move line_get_key_value to efi-string

No functional changes.

7 months agoboot: Move parse_boolean to efi-string
Jan Janssen [Sun, 15 Oct 2023 07:31:02 +0000 (09:31 +0200)] 
boot: Move parse_boolean to efi-string

No functional changes.

7 months agotest: Remove unnecessary test prefix
Jan Janssen [Sun, 15 Oct 2023 07:39:50 +0000 (09:39 +0200)] 
test: Remove unnecessary test prefix

7 months agocore: don't downgrade multi-state settings to boolean
Frantisek Sumsal [Sat, 14 Oct 2023 17:25:28 +0000 (19:25 +0200)] 
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

7 months agodocs: update fuzzers docs 29558/head
Frantisek Sumsal [Sat, 14 Oct 2023 15:47:10 +0000 (17:47 +0200)] 
docs: update fuzzers docs

7 months agotest: update Ubuntu CI instructions
Frantisek Sumsal [Thu, 12 Oct 2023 20:09:49 +0000 (22:09 +0200)] 
test: update Ubuntu CI instructions

7 months agovarlink: drop dead code
Frantisek Sumsal [Thu, 12 Oct 2023 15:29:23 +0000 (17:29 +0200)] 
varlink: drop dead code

'#' is never part of either allowed_chars or allowed_delimiters when we
parse structs/enums.

7 months agovarlink: use int for log level
Frantisek Sumsal [Thu, 12 Oct 2023 15:02:16 +0000 (17:02 +0200)] 
varlink: use int for log level

7 months agovarlink: don't panic on malformed method definition
Frantisek Sumsal [Thu, 12 Oct 2023 13:55:12 +0000 (15:55 +0200)] 
varlink: don't panic on malformed method definition

7 months agotest: add a fuzzer for the varlink IDL stuff
Frantisek Sumsal [Thu, 12 Oct 2023 13:44:34 +0000 (15:44 +0200)] 
test: add a fuzzer for the varlink IDL stuff

7 months agotest: add a couple of tests for varlinkctl
Frantisek Sumsal [Thu, 12 Oct 2023 12:21:40 +0000 (14:21 +0200)] 
test: add a couple of tests for varlinkctl

7 months agocore: fix deserialization copypasta
Luca Boccassi [Sat, 14 Oct 2023 09:03:33 +0000 (10:03 +0100)] 
core: fix deserialization copypasta

CID#1522788

7 months agocore/exec-invoke: rename parameters of get_fixed_{user,group}
Mike Yuan [Fri, 13 Oct 2023 21:14:40 +0000 (05:14 +0800)] 
core/exec-invoke: rename parameters of get_fixed_{user,group}

Follow-up for 1c9433559a40982785011aa187e2b34420a67e7e

The user/group passed in could be either the name or the uid/gid.

7 months agoMerge pull request #29569 from YHNdnzj/foreach-array
Luca Boccassi [Sat, 14 Oct 2023 08:08:40 +0000 (09:08 +0100)] 
Merge pull request #29569 from YHNdnzj/foreach-array

core: use FOREACH_ARRAY more and some other minor changes

7 months agoMerge pull request #29525 from poettering/confext-sysext-multimodal
Luca Boccassi [Fri, 13 Oct 2023 23:28:47 +0000 (00:28 +0100)] 
Merge pull request #29525 from poettering/confext-sysext-multimodal

dissect: make sure we can dissect and inspect DDIs that are both confext *and* sysext

7 months agocore: add MemoryKSM and SetLoginEnvironment to exec_context_dump 29569/head
Mike Yuan [Fri, 13 Oct 2023 22:21:35 +0000 (06:21 +0800)] 
core: add MemoryKSM and SetLoginEnvironment to exec_context_dump

7 months agocore/execute: correct alignment
Mike Yuan [Fri, 13 Oct 2023 22:02:17 +0000 (06:02 +0800)] 
core/execute: correct alignment

7 months agocore/execute: use FOREACH_ARRAY more
Mike Yuan [Fri, 13 Oct 2023 22:17:11 +0000 (06:17 +0800)] 
core/execute: use FOREACH_ARRAY more

7 months agocore/execute-serialize: use FOREACH_ARRAY more
Mike Yuan [Fri, 13 Oct 2023 22:01:11 +0000 (06:01 +0800)] 
core/execute-serialize: use FOREACH_ARRAY more

7 months agorun: support --scope on old service managers that lack native PIDFD support
Lennart Poettering [Thu, 12 Oct 2023 10:02:03 +0000 (12:02 +0200)] 
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.

7 months agoupdate TODO
Lennart Poettering [Fri, 13 Oct 2023 22:01:59 +0000 (00:01 +0200)] 
update TODO

7 months agoMerge pull request #27890 from bluca/executor
Luca Boccassi [Fri, 13 Oct 2023 21:01:16 +0000 (22:01 +0100)] 
Merge pull request #27890 from bluca/executor

core: add systemd-executor binary

7 months agotpm: update comment on transient handle GetCapability bug in kernel tpm resource...
Dan Streetman [Fri, 13 Oct 2023 20:07:37 +0000 (16:07 -0400)] 
tpm: update comment on transient handle GetCapability bug in kernel tpm resource manager

Add clarification and link to kernel bug.

7 months agonspawn: set CoredumpReceive=yes on container's scope when --boot is set 29272/head
Nick Rosbrook [Thu, 12 Oct 2023 17:39:56 +0000 (13:39 -0400)] 
nspawn: set CoredumpReceive=yes on container's scope when --boot is set

When --boot is set, and --keep-unit is not, set CoredumpReceive=yes on
the scope allocated for the container. When --keep-unit is set, nspawn
does not allocate the container's unit, so the existing unit needs to
configure this setting itself.

Since systemd-nspawn@.service sets --boot and --keep-unit, add
CoredumpReceives=yes to that unit.

7 months agoman: document CoredumpReceive= setting
Nick Rosbrook [Wed, 11 Oct 2023 14:46:42 +0000 (10:46 -0400)] 
man: document CoredumpReceive= setting

7 months agoman: move NFTSec= entry to "Network Accouting and Control" section
Nick Rosbrook [Tue, 3 Oct 2023 19:31:41 +0000 (15:31 -0400)] 
man: move NFTSec= entry to "Network Accouting and Control" section

Currently it is in the "Memory Pressure and Control" section, which does
not seem accurate.

7 months agotest: add a test for container support in coredump
Nick Rosbrook [Tue, 19 Sep 2023 21:09:58 +0000 (17:09 -0400)] 
test: add a test for container support in coredump

7 months agocoredump: add support for forwarding coredump to containers
Nick Rosbrook [Wed, 6 Sep 2023 15:03:41 +0000 (11:03 -0400)] 
coredump: add support for forwarding coredump to containers

If a process crashes within a container, try and forward the coredump to
that container. To do this, check if the crashing process is in a
different pidns, and if so, find the PID of the namespace leader. We
only proceed with forwarding if that PID belongs to a cgroup that is
descendant of another cgroup with user.delegate=1 and
user.coredump_receive=1 (i.e. Delegate=yes and CoredumpReceive=yes).

If we proceed, attach to the namespaces of the leader, and send the
coredump to systemd-coredump.socket in the container. Before this is
done, we need to translate the PID, UID, and GID, and also re-gather
procfs metadata. Translate the PID, UID, and GID to the perspective of
the container by sending an SCM_CREDENTIALS message over a socket pair
from the original systemd-coredump process, to the process forked in the
container.

If we cannot successfully forward the coredump, fallback to the current
behavior so that there is still a record of the crash on the host.

7 months agoprocess-util: introduce namespace_get_leader helper
Nick Rosbrook [Fri, 8 Sep 2023 21:03:56 +0000 (17:03 -0400)] 
process-util: introduce namespace_get_leader helper

For a given PID and namespace type, this helper function gives the PID
of the leader of the namespace containing the given PID. Use this in
systemd-coredump instead of using the existing get_mount_namespace_leader.

This helper will be used again in a later commit.

7 months agocoredump: store crashing process UID and GID in Context
Nick Rosbrook [Wed, 6 Sep 2023 15:01:33 +0000 (11:01 -0400)] 
coredump: store crashing process UID and GID in Context

For convenience, store the crashing process's UID and GID in Context (as
uid_t and gid_t, respectively), as is currently done for the PID. This
means we can just parse the UID/GID once in save_context(), and use
those values in other places.

This is just re-factoring, and is a preparation commit for container
support.

7 months agocore: add CoredumpReceive= setting
Nick Rosbrook [Fri, 29 Sep 2023 19:39:17 +0000 (15:39 -0400)] 
core: add CoredumpReceive= setting

This setting indicates that the given unit wants to receive coredumps
for processes that crash within the cgroup of this unit. This setting
requires that Delegate= is also true, and therefore is only available
where Delegate= is available.

This will be used by systemd-coredump to support forwarding coredumps to
containers.

7 months agocgroup-util: add cg_is_delegated helper
Nick Rosbrook [Thu, 28 Sep 2023 18:10:59 +0000 (14:10 -0400)] 
cgroup-util: add cg_is_delegated helper

Take is_delegated from cgroup-show.c, and make it a generic helper
function. This new helper will be used again in a later commit.

7 months agocore/varlink: make sure we setup non-serialized varlink sockets
Mike Yuan [Tue, 3 Oct 2023 12:20:55 +0000 (20:20 +0800)] 
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

7 months agosystemd-journal-upload: Increase failure tolerance (#19426, #2877)
Priit Laes [Tue, 10 Oct 2023 08:42:37 +0000 (11:42 +0300)] 
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
```

7 months agoMerge pull request #29551 from poettering/no-empty-structs-in-varlink
Luca Boccassi [Thu, 12 Oct 2023 22:10:20 +0000 (23:10 +0100)] 
Merge pull request #29551 from poettering/no-empty-structs-in-varlink

varlink: properly refuse empty structs/enums in varlink IDL

7 months agovarlinkctl: generate slightly more useful error messages
Lennart Poettering [Thu, 12 Oct 2023 13:07:07 +0000 (15:07 +0200)] 
varlinkctl: generate slightly more useful error messages

7 months agoMerge pull request #29502 from keszybz/sd-boot-config-tweaks
Luca Boccassi [Thu, 12 Oct 2023 22:08:56 +0000 (23:08 +0100)] 
Merge pull request #29502 from keszybz/sd-boot-config-tweaks

Tweaks to sd-boot UX

7 months agopo: Translated using Weblate (French)
Pierre GRASSER [Thu, 12 Oct 2023 16:36:11 +0000 (18:36 +0200)] 
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

7 months agocore: move code from execute.c to exec-invoke.c 27890/head
Luca Boccassi [Fri, 1 Sep 2023 01:24:49 +0000 (02:24 +0100)] 
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.

7 months agocore: add systemd-executor binary
Luca Boccassi [Thu, 1 Jun 2023 18:51:42 +0000 (19:51 +0100)] 
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.

7 months agocore: add serialization/deserialization for CGroupContext
Luca Boccassi [Thu, 31 Aug 2023 23:42:35 +0000 (00:42 +0100)] 
core: add serialization/deserialization for CGroupContext

7 months agocore: add serialization/deserialization for ExecRuntime
Luca Boccassi [Thu, 31 Aug 2023 23:41:59 +0000 (00:41 +0100)] 
core: add serialization/deserialization for ExecRuntime

7 months agocore: add serialization/deserialization for ExecParameters
Luca Boccassi [Thu, 31 Aug 2023 23:40:37 +0000 (00:40 +0100)] 
core: add serialization/deserialization for ExecParameters

7 months agocore: add serialization/deserialization for ExecCommand
Luca Boccassi [Thu, 31 Aug 2023 23:38:01 +0000 (00:38 +0100)] 
core: add serialization/deserialization for ExecCommand

7 months agocore: add serialization/deserialization for ExecContext
Luca Boccassi [Thu, 31 Aug 2023 23:31:26 +0000 (00:31 +0100)] 
core: add serialization/deserialization for ExecContext

7 months agotest: add simple test for two common kind of errors 29551/head
Lennart Poettering [Thu, 12 Oct 2023 13:28:06 +0000 (15:28 +0200)] 
test: add simple test for two common kind of errors

7 months agovarlink: don't generate %m error message if we are synthesizing the error
Lennart Poettering [Thu, 12 Oct 2023 13:23:42 +0000 (15:23 +0200)] 
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.

7 months agovarlink: refuse empty () structs/enums
Lennart Poettering [Thu, 12 Oct 2023 13:21:50 +0000 (15:21 +0200)] 
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.

7 months agoMerge pull request #29544 from yuwata/network-dhcp-bus-command
Yu Watanabe [Thu, 12 Oct 2023 13:06:50 +0000 (22:06 +0900)] 
Merge pull request #29544 from yuwata/network-dhcp-bus-command

network: several fixlets for DBus methods for DHCP client and server

7 months agocore: add cgroup_add_or_update_device_allow()
Luca Boccassi [Tue, 3 Oct 2023 00:06:35 +0000 (01:06 +0100)] 
core: add cgroup_add_or_update_device_allow()

7 months agoserialize: add serialize_image_policy()
Luca Boccassi [Mon, 2 Oct 2023 22:35:26 +0000 (23:35 +0100)] 
serialize: add serialize_image_policy()

7 months agoserialize: add open_serialization_file()
Luca Boccassi [Tue, 19 Sep 2023 00:19:10 +0000 (01:19 +0100)] 
serialize: add open_serialization_file()

7 months agoserialize: add serialize_string_set()
Luca Boccassi [Mon, 18 Sep 2023 21:42:46 +0000 (22:42 +0100)] 
serialize: add serialize_string_set()

7 months agoserialize: add serialize_item_tristate()
Luca Boccassi [Mon, 18 Sep 2023 20:26:12 +0000 (21:26 +0100)] 
serialize: add serialize_item_tristate()

7 months agoserialize: add serialize_item_base64mem()
Luca Boccassi [Mon, 18 Sep 2023 20:15:25 +0000 (21:15 +0100)] 
serialize: add serialize_item_base64mem()

7 months agoserialize: add serialize_item_hexmem()
Luca Boccassi [Mon, 18 Sep 2023 20:05:15 +0000 (21:05 +0100)] 
serialize: add serialize_item_hexmem()

7 months agocore: ensure execute/spawn functions can work without Unit object
Luca Boccassi [Thu, 31 Aug 2023 19:58:22 +0000 (20:58 +0100)] 
core: ensure execute/spawn functions can work without Unit object

When switching to serialization later, the Unit object will not be
serialized, move parameters around instead

7 months agocore: ensure execute/spawn functions can work without manager object
Luca Boccassi [Thu, 31 Aug 2023 20:08:49 +0000 (21:08 +0100)] 
core: ensure execute/spawn functions can work without manager object

When switching to serialization later, the Manager object will not be
serialized, move parameters around instead

7 months agocore: add exec_params_dump helper
Luca Boccassi [Mon, 18 Sep 2023 18:16:02 +0000 (19:16 +0100)] 
core: add exec_params_dump helper

7 months agoprocess-util: add posix_spawn helper
Luca Boccassi [Fri, 2 Jun 2023 15:06:17 +0000 (16:06 +0100)] 
process-util: add posix_spawn helper

This provides CLONE_VM + CLONE_VFORK semantics, so it is useful to
avoid CoW traps and other issues around doing work between fork()
and exec().

7 months agoenv-util: add helper to replace env block
Luca Boccassi [Tue, 19 Sep 2023 23:06:21 +0000 (00:06 +0100)] 
env-util: add helper to replace env block

7 months agotest: add space-separated test for LogFilterPatterns
Luca Boccassi [Mon, 2 Oct 2023 22:30:19 +0000 (23:30 +0100)] 
test: add space-separated test for LogFilterPatterns

7 months agocore: fix checking for extension-releases for ExtensionImages/Directories
Luca Boccassi [Tue, 10 Oct 2023 17:50:36 +0000 (18:50 +0100)] 
core: fix checking for extension-releases for ExtensionImages/Directories

The parsing is done after the image has been opened, not before, as it
cannot be done on an block device. Also fix returning on any error for
ExtensionDirectories, not just ENOENT.

Follow-up for 55ea4ef096543d2bceea9315868d5aca945d7a57

7 months agoupdate TODO
Lennart Poettering [Wed, 11 Oct 2023 21:28:55 +0000 (23:28 +0200)] 
update TODO

7 months agoman/systemd.exec: Update service result table
Reto Schneider [Tue, 10 Oct 2023 12:49:22 +0000 (14:49 +0200)] 
man/systemd.exec: Update service result table

exec-condition and oom-kill were added without updating this table.

7 months agohibernate-resume: remove kernel/image version comparison when resuming
Zbigniew Jędrzejewski-Szmek [Fri, 8 Sep 2023 16:19:36 +0000 (18:19 +0200)] 
hibernate-resume: remove kernel/image version comparison when resuming

We already had a similar check that was removed, see
8340b762e4f597e98a72de1385e74b9be04e521d (*). The kernel supports loading of a
resume image from a different kernel version. This makes sense, because the
goal of "resume" is to replace the running system by a saved memory image, so
it doesn't really matter that the short-lived kernel is different.

By removing the check, we make the process more reliable: for example, the user
may select a different kernel from a list, or not have the previously running
kernel in /boot at all, etc. Requiring the exact same kernel version makes the
process more fragile for no benefit.

Similar reasoning holds for the image version: the image may be updated, and
for example an older kernel+initrd might be used, with an embedded VERSION_ID
that is not the latest. This is fine, and the check is not useful.

I left the check for ID/IMAGE_ID: we probably don't want to use the resume
image if the hibernation was done from a different installation.

(Note: why not check VERSION_ID/IMAGE_VERSION? Because of the following
scenario: a user has an installation of Fedora 35, and they upgrade to Fedora
36, which means that the os-release file on disk gets replaced and now
specifies VERSION_ID=36. But the running kernel is not replaced, and its
package is not removed because the running kernel version is never removed, so
we still have a boot entry that in initrd-release says VERSION_ID=35. Without
rebooting, the user does hibernation. When resuming, we want to resume, no
matter if one of the new entries with VERSION_ID=36 or one of the old entries
with VERSION_ID=35 is picked in the boot loader menu.

If the installation is image-based, i.e. it has IMAGE_ID+IMAGE_VERSION, the
situation is similar: after an upgrade, we may still have an boot entry from
before the upgrade. Using an older kernel+initrd to boot and switch-root into a
newer installation is supported and is rather common.

In fact, it is a rather common situation that the version reported by the boot
entry (or stored internally in the initrd-release in the initrd) does not match
the actual system on disk. Generally, this metadata is saved when the boot menu
entry is written and does not reflect subsequent upgrades. Various
distributions generally keep at least 3 kernels after a upgrade, and during an
upgrade only install one new, which means that after a major upgrade, generally
there will be at least two kernels which have mismatched version information.)

OTOH, I think it is useful to *write* all the details to the EFI var. As
discussed in https://github.com/systemd/systemd/issues/29037, we may want to
show this information in the boot loader. It is also useful for debugging.

(*) Also again discussed and verified in
https://github.com/systemd/systemd/pull/27330#discussion_r1234332080.

", ignored" is dropped, since this failure is likely to cause the following
check to fail. Better not to say anything then to say the misleading thing.

7 months agoRevert "Revert "meson: use c_args in generator scripts (#10289)""
Jordan Williams [Wed, 11 Oct 2023 18:32:49 +0000 (13:32 -0500)] 
Revert "Revert "meson: use c_args in generator scripts (#10289)""

This reverts commit 0e3cc902faec4f18d5fa606396f602b08bc94e27.

Fixes #10288.
I have confirmed that this does now fix cross-compilation.
It appears that changes upstream in Meson, probably mesonbuild/meson#5263, have made the original MR, #10289, work now.

This needs to be tested to ensure that it doesn't break Travis CI like when it was reverted in #10361.

7 months agoefi/boot: rename ConfigEntry to BootEntry 29502/head
Zbigniew Jędrzejewski-Szmek [Tue, 10 Oct 2023 07:52:14 +0000 (09:52 +0200)] 
efi/boot: rename ConfigEntry to BootEntry

Some of the entries are really configured, but we also have a bunch
of automatic entries. Calling them "config entries" is misleading, let's
use the more natural "boot entry".

While at it, rename:
  config_load_entries() → config_load_type1_entries()
  config_entry_add_unified() → config_load_type2_entries()
  config_title_generate() → generate_boot_entry_titles()
  config_entry_add_<type>() → config_add_entry_<type>()

No functional change.

7 months agoefi/boot: adjust grammar and punctuation in comments
Zbigniew Jędrzejewski-Szmek [Mon, 9 Oct 2023 09:14:11 +0000 (11:14 +0200)] 
efi/boot: adjust grammar and punctuation in comments

7 months agoefi/boot: use "else if" instead of explicit "continue"
Zbigniew Jędrzejewski-Szmek [Sun, 8 Oct 2023 11:10:47 +0000 (13:10 +0200)] 
efi/boot: use "else if" instead of explicit "continue"

No functional change.

7 months agoefi/boot: make timeout changes relative to current value
Zbigniew Jędrzejewski-Szmek [Sun, 8 Oct 2023 10:33:43 +0000 (12:33 +0200)] 
efi/boot: make timeout changes relative to current value

When the user pressed + or -, we would set the efivar override, starting
from the default of 0. Instead, set an override that starts at the current
value. This means that when user has e.g. a configured override of 5 s, and
they press +, they get an override of 6 s. I think this is leads to a much
smoother experience for a user, who does not necessarilly need to know that
we have three levels of overrides, they just want to easily configure the
timeout with keys. If they press +, the timeout should increase, and not
jump to some low value.

Also, once an override has been set via the boot menu, i.e. the efivar is set,
do not allow unsetting the efivar from the boot menu. This way we also avoid
an unexpected "jump" to whatever the other sources of configuration specify.
The user can configure any value with the keys that they want, so we don't
need to allow unsetting.

7 months agoefi/boot: split out helper to reduce duplicate formatting code
Zbigniew Jędrzejewski-Szmek [Sun, 8 Oct 2023 10:24:29 +0000 (12:24 +0200)] 
efi/boot: split out helper to reduce duplicate formatting code

No functional change.

7 months agosd-boot: when rebooting or powering off, save config state
Zbigniew Jędrzejewski-Szmek [Sat, 7 Oct 2023 12:00:42 +0000 (14:00 +0200)] 
sd-boot: when rebooting or powering off, save config state

The menu_run() function allows the user to set/unset default entry, or to
increase/decrease menu timeout. After a keypress, status like
  "Menu timeout set to 5 s"
is printed, but there actually isn't any immediate effect. The value is only
written right right before booting a menu entry to avoid unnecessary wear&tear
on the nvram storage. This delayed write is supposed to be invisible to the
user.

Nevertheless, operations like reboot into firmware, reboot, or shutdown were
done immediately. We need to exit the loop first, save the state, and only do
the op afterwards.

Fixup for f6531b11d21931b3952d566ceded672ba21681cc and
e6cab77eca8f6556f381c348b0452b526a752ab7.
Also reverts 498d0cc426afc13fdadb0a385fd16c005645e0cf.

7 months agoman: use consistent label for "Reboot Into Firmware Interface"
Zbigniew Jędrzejewski-Szmek [Fri, 6 Oct 2023 16:46:28 +0000 (18:46 +0200)] 
man: use consistent label for "Reboot Into Firmware Interface"

That is what sd-boot actually displays.

7 months agoefi/boot: use DEFINE_TRIVIAL_CLEANUP_FUNC() in one more place
Zbigniew Jędrzejewski-Szmek [Fri, 6 Oct 2023 16:11:03 +0000 (18:11 +0200)] 
efi/boot: use DEFINE_TRIVIAL_CLEANUP_FUNC() in one more place

No functional change.

7 months agonetwork: do not trigger assertion by forcerenew command 29544/head
Yu Watanabe [Thu, 12 Oct 2023 09:38:01 +0000 (18:38 +0900)] 
network: do not trigger assertion by forcerenew command

When DHCP server is not running, sending force-renew command triggers
assertion.

7 months agosd-dhcp-server: make sd_dhcp_server_is_running() silently work with NULL
Yu Watanabe [Thu, 12 Oct 2023 09:35:55 +0000 (18:35 +0900)] 
sd-dhcp-server: make sd_dhcp_server_is_running() silently work with NULL

We already do in the same way for sd-dhcp-client and friends.

7 months agotest-network: drop unnecessary explicit stop of dnsmasq
Yu Watanabe [Thu, 12 Oct 2023 09:34:20 +0000 (18:34 +0900)] 
test-network: drop unnecessary explicit stop of dnsmasq

7 months agotest-network: add test case for renewing DHCP lease
Yu Watanabe [Thu, 12 Oct 2023 09:33:52 +0000 (18:33 +0900)] 
test-network: add test case for renewing DHCP lease