Julia Kartseva [Fri, 5 Nov 2021 01:52:02 +0000 (18:52 -0700)]
core: fix bpf-foreign cg controller realization
Requiring /sys/fs/bpf path to be a mount point at the moment of cgroup
controllers realization does more harm than good, because:
* Realization happens early on boot, the mount point may not be ready at
the time. That happens if mounts are made by a .mount unit (the issue we
encountered).
* BPF filesystem may be mounted on another point.
Remove the check. Instead verify that path provided by BPFProgram= is
within BPF fs when unit properties are parsed.
Yu Watanabe [Tue, 9 Nov 2021 01:21:23 +0000 (10:21 +0900)]
hostnamed: use /proc/device-tree to get chassis type
From https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw
---
Userspace must not use the /sys/firmware/devicetree/base
path directly, but instead should follow /proc/device-tree
symlink. It is possible that the absolute path will change
in the future, but the symlink is the stable ABI.
---
Addresses the comment https://github.com/systemd/systemd/pull/20731#discussion_r744095262.
docs: invite people to define GPT partition types for all archs now
The discovery partitions spec so far suggested we should define
arch-specific partition type uuids only for archs that have EFI. Let's
change that and invite people to define them for any arch. Why? Even if
GPT is defined as part of the UEFI spec it's quite useful independently
of it, too. Specifically, our image dissection logic makes use of it,
i.e. systemd-nspawn, systemd-gpt-auto-generator, systemd-repart,
RootImage=, portable services, and so on. None of these tools are
related to UEFI in any way.
Anita Zhang [Tue, 9 Nov 2021 23:26:28 +0000 (15:26 -0800)]
core: replace slice dependencies as they get added
Defines a "UNIT_DEPENDENCY_SLICE_PROPERTY" UnitDependencyMask type that
is used when adding slices to the dependencies hashmap. This type is
used to remove slice dependencies when they get overridden by new ones.
nspawn: don't muck with caps if no network setting is used in settings file
Our goal here (as in the previous commits) is to ensure that a settings
file loaded in --settings=override mode is truly a NOP. Previously this
was not the case as we'd drop CAP_NET_ADMIN from the caps if the
settings file didn't enable networking.
With this change we'll drop it only if explicitly turned off in the
settings file, and otherwise let the built-in defaults and cmdline
params reign supreme as documented.
nspawn: use three boolean fields from settings file when actually set
Let's turn these three fields into tristates, so that we can distinguish
whether they are not configured at all from explicitly turned off.
Let#s then use this to ensure that we only copy the settings fields into
our execution environment if they are actually configured.
We already do this for some of the boolean settings, this adds it for
the missing ones.
The goal here is to ensure that an empty settings file used in
--settings=override mode (i.e. the default mode used in the
systemd-nspawn@.service unit) is truly a NOP.
The new helper returns whether the settings file had *any* networking
setting configured at all. We already have a similar helper
settings_private_network() which returns a similar result. The
difference is that the new helper will return true when the private
network was explicitly turned off, while the old one will only return
true if configured and enabled.
We'll reuse the helper a 2nd time later on, but even without it it makes
things a bit more readable.
repart: fix free area calculations for unaligned partitions
To properly detect how much space we have to distribute we need to take
into account that both the partition offset and the partition size
aren't aligned.
repart: don't distribute space after unaligned partitions
If we operate on a disk that has a pre-existing unaligned partition
(i.e. one that doesn't start on multiple of 4K, or doesn't have a size
of multiple 4K), then the amount of space after it to distribute among
partitions isn't a multiple of 4K either. So far we might end up
passing the remaining fraction to any partition that wanted it, which
was usually the first one after it that is newly defined. This then
confused the later placement algorithm, since it assumed all partitions
we newly allocate were properly aligned but by being extended by the
fractional space they wouldn't be anymore.
Let's hence fix that by ensuring we never pass space to later partitions
so that things wouldn't be aligned anymore.
Anything that is left-over then at the very end (i.e. typically exactly
the remaining fraction) is added as padding to the existing, unaligned
partition, so that it can't confuse anyone.
sd-event: don't destroy inotify data structures from inotify event handler
This fixes a bad memory access when we destroy an inotify source handler
from the handler itself, and thus destroy the associated inotify_data
structures.
The image build failed during kernel RPM installation (bug in %post
scriptlet). This has been fixed in the package suse-module-tools 16.0.13
[1]. The fix is in openSUSE Tumbleweed repos so the tests can be enabled
again.
Yu Watanabe [Sat, 6 Nov 2021 05:12:30 +0000 (14:12 +0900)]
ether-addr-util: make hw_addr_is_null() return true also for all zero address
This fixes the following error:
---
systemd-networkd[1449490]: ip6tnl0: Saved hardware address: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
systemd-networkd[1449490]: ip6tnl0: Failed to manage link by its new hardware address, ignoring: File exists
---