Commit Graph
36053 Commits
Author SHA1 Message Date
Franck Bui e94f9e720c watchdog: no need to ping the device twice in watchdog_ping() if the device has just been opened 2021-09-15 11:32:21 +02:00
Franck Bui 564096795e watchdog: update watchdog_timeout with the closest timeout found by the driver
Store the actual timeout value found by the driver in watchdog_timeout since
this value is more accurate for calculating the next time for pinging the
device.
2021-09-15 11:32:10 +02:00
Franck Bui 2628b98f0c core: watchdog_set_timeout() doesn't need to return the timeout value used by the HW
The manager currently doesn't need it and if it does in the future an helper
should probably be introduced instead.
2021-09-15 10:56:26 +02:00
Franck Bui ae4a0ec45c core: call watchdog_ping() unconditionally
This basically reverts commit 61927b9f11 and
relies on the fact that watchdog_ping() will open and setup the watchdog for us
in case the device appears later on.

Also unlike what is said in comment
https://github.com/systemd/systemd/pull/17460#pullrequestreview-517434377, both
m->watchdog[] and m->overriden_watchdog[] are not supposed to store the actual
timeout used by the watchdog device but stores the value defined by the user.

If the HW timeout value is really needed by the manager then it's probably
better to read it via an helper defined in watchdog.c instead. However the HW
timeout value is currently only needed by the watchdog code itself mainly when
it calculates the time for the next ping.
2021-09-15 10:54:24 +02:00
Franck Bui 5bbf2db1e4 watchdog: make watchdog_ping() a NOP when the watchdog is disabled or closed
This patch allows watchdog_ping() to be used unconditionally regardless of
whether watchdog_set_timeout() or watchdog_close() has been previously called
or not and in both cases watchdog_ping() does nothing.

shutdown.c has been updated to cope with this change.
2021-09-15 10:54:19 +02:00
Jan Janssen 134144abc8 sd-boot: Simplify setting console mode 2021-09-15 10:48:19 +02:00
Peter Morrow 31d3a52029 cgroup: add support for StartupAllowedCPUs and StartupAllowedMemoryNodes
Add new settings which can be used to control cpuset based cpu affinity
during the startup phase only.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
2021-09-15 09:30:12 +01:00
Yu Watanabe 89fa013349 network: use NetworkConfigSource/State to manage nexthops
This also changes the logic when Id= is not specified.
Previously, kernel picks the lowest unused ID, but now networkd picks
the lowest unused ID.
2021-09-15 16:50:23 +09:00
Yu Watanabe eb72fa3ad2 network: use NetworkConfigSource/State to manage routing policy rules
This also changes the logic when Priority= is not specified.
Previously, we request without FRA_PRIORITY attribute and kernel picks
the highest unused priority for the rule.
This makes networkd picks the highest unused priority and always request
FRA_PRIORITY attribute.
2021-09-15 16:50:23 +09:00
Yu Watanabe 193c4af94b network: use NetworkConfigSource/State to manage neighbors 2021-09-15 16:50:23 +09:00
Yu Watanabe a093533c33 network: introduce NetworkConfigSource and NetworkConfigState
These will be used in later commits.
2021-09-15 16:50:23 +09:00
Kai Wohlfahrt 679de14112 Respect install_sysconfdir
This was lost e11a25cadb and c900d89faa while adding jinja2
templating. Breaks builds on NixOS.
2021-09-15 09:04:12 +02:00
Daan De Meyer 27bf0ab76e sd-journal: Don't compare hashes from different journal files
In sd_journal_enumerate_fields(), we check if we've already handled
a field by checking if we can find it in any of the already processed
journal files. We do this by calling
journal_file_find_field_object_with_hash(), which compares the size,
payload and hash of the given field against all fields in a journal file,
trying to find a match. However, since we now use per file hash functions,
hashes for the same fields will differ between different journal files,
meaning we'll never find an actual match.

To fix the issue(), let's use journal_file_find_field_object() when one
or more of the files we're comparing is using per file keyed hashes.
journal_file_find_field_object() only takes the field payload and size
as arguments and calculates the hash itself using the hash function from
the journal file we're searching in.
2021-09-15 11:00:49 +09:00
Marcus Harrison 2709d02906 Fix error building repart with no libcryptsetup (#20739) 2021-09-15 10:55:07 +09:00
Franck Bui 12663295ca core: watchdog_runtimeout_wait() already returns USEC_INFINITY when the watchdog is disabled or closed 2021-09-14 21:39:21 +02:00
Franck Bui 3178d23ddd main: use timestamp_is_set() in become_shutdown() 2021-09-14 21:39:21 +02:00
Yu Watanabe 77bf5c31de ethtool-util: add more network device features
Then, we can easily add new settings to configure features in .link
file.
2021-09-15 02:12:02 +09:00
Yu Watanabe 7a4f203547 ethtool-util: apply tx-checksum-* features at last
NET_DEV_FEAT_TX matches multiple features. In the next commit, all
features whose strings start with "tx-checksum-" will be added.
To make them take precedence over NET_DEV_FEAT_TX, it will be applied
only when each explicit feature is not applied.
2021-09-15 02:07:15 +09:00
Yu Watanabe 008d3a370c ethtool: do not set unavailable or never_changed bits 2021-09-15 01:56:19 +09:00
Yu Watanabe 4253dab576 ethtool-util: shorten code a bit
Also fixes a error code in debugging log.
2021-09-15 01:41:19 +09:00
Yu Watanabe 6d9a72f3b9 ethtool-util: use sizeof() 2021-09-15 01:32:35 +09:00
Yu Watanabe 9d01399d44 network: replace config_parse_address_filter() with config_parse_in_addr_prefixes() 2021-09-14 20:31:17 +09:00
Yu Watanabe 84ebe6f013 core: replace IPAddressAccessItem with struct in_addr_prefix
Previously, if a unit file which contains n IPAddressAllow/Deny= lines,
then the computational order of parsing the file was O(n^3), as
ip_address_access_reduce(), whose order is O(n^2), is called for each line.

By replacing in_addr_prefix related functions, now the computational
order is O(n log n).

Fixes #20680.
2021-09-14 20:30:09 +09:00
Yu Watanabe 60da07ecc7 core/cgroup: set bitfield to reduce struct size 2021-09-14 20:30:09 +09:00
Yu Watanabe 0856e78df0 test: add tests for in-addr-prefix-util.c 2021-09-14 20:30:09 +09:00
Yu Watanabe 0bc311bbe9 test: slightly modernize test-in-addr-util.c 2021-09-14 20:30:09 +09:00
Yu Watanabe bffaa49ec4 in-addr-prefix-util: introduce several utilities for address prefix 2021-09-14 20:30:09 +09:00
Yu Watanabe c4f06a75ea Merge pull request #20700 from yuwata/network-dhcp-cleanups
network: several DHCP related cleanups
2021-09-14 20:29:27 +09:00
Yu Watanabe e47bcb7d0b network: do not use RouteTable= in [DHCPv4] section for DHCPv6 routes
We forgot to add RouteTable= in [DHCPv6] section when we split [DHCP]
into two.
2021-09-14 17:51:19 +09:00
Lennart Poettering b83bbbac87 Merge pull request #20713 from yuwata/udev-watch-retry
udev-watch: retry to save watch handle on error
2021-09-14 09:40:23 +02:00
Yu Watanabe 967e6a6403 network: use ltype to distinguish DHCPv4 and DHCPv6 2021-09-14 15:21:10 +09:00
Yu Watanabe 471e332d50 network: dhcp4: use free_and_strdup_warn() 2021-09-14 15:21:10 +09:00
Yu Watanabe ec84bb2a2b network: dhcp4: log server address 2021-09-14 15:21:10 +09:00
Yu Watanabe 3596fb3600 network: dhcp4: return earlier on failure 2021-09-14 15:21:10 +09:00
Yu Watanabe 429dc05a72 network: move common route settings to {dhcp4,ndisc}_request_route() 2021-09-14 15:21:10 +09:00
Lennart Poettering 99db797bc6 escape: improve logging when escaping paths that are slightly non-conforming
Fixes: #20663
2021-09-14 03:04:57 +09:00
Benjamin Herrenschmidt f90eea7d18 virt: Improve detection of EC2 metal instances
The current detection code relies on /sys/firmware/dmi/entries/0-0/raw
to disambiguate Amazon EC2 virtualized from metal instances.

Unfortunately this file is root only. Thus on a c6g.metal instance
(aarch64), we observe something like this:

$ systemd-detect-virt
amazon
$ sudo systemd-detect-virt
none

Only the latter is correct.

The right long term fix is to extend the kernel to expose the SMBIOS BIOS
Characteristics properly via /sys/class/dmi, but until this happens (and
for backwards compatibility when it does), we need a plan B.

This change implements such a workaround by falling back to using the
instance type from DMI and looking at the ".metal" string present on
metal instances.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2021-09-14 01:44:20 +09:00
Lennart Poettering d38466bae6 tpm2: log about invalid PCRs on each unsealing
Let's log every time we use uninitialized PCRs when unsealing a secret
via TPM2. This indicates a firmware issue usually, and is something we
shouldn't just show when enrolling but also show every time we unseal,
so that the fact that the selected PCR policy is pretty much pointless
is repeatedly shown.
2021-09-13 15:02:53 +02:00
Lennart Poettering 321a9d9ee5 tpm2: check if PCR values make sense before using them
Fixes: #20684
2021-09-13 15:02:53 +02:00
Lennart Poettering 2b92a67261 tpm2: support RSA primary keys as fallback if TPM2 devices don't support ECC
Previously, we hardcoded use of ECC as primary keys, since they are much
faster (i.e. saving multiple seconds) to do TPM2 operations with. Alas,
not all TPM2 chips appear to support ECC. Bummer.

Let's hence add a fallback logic: if we can't create an ECC primary key,
use an RSA key, and store that fact away.

AFIU the security guarantees should be roughly the same, it's just that
RSA primary keys is so much slower to work with than ECC.

The primary key algorithm is used is stored in the JSON header of LUKS
disks, in a new field. If the field is absent we assume to use ECC, to
provide full compatibility with old systemd versions.

The primary key algorithm is stored in a new field in the credentials
file format (in fact, a previously unused zero space is used), too.

Hopefully, this should ensure that TPM2 support will "just work" on more
systems.

Fixes: #20361
2021-09-13 14:48:23 +02:00
Lennart Poettering 3f9992d82e memory-util: replace memeqzero() by a more generic memeqbyte()
The new helper can check for any byte, no just zeroes. The old name is
then converted into a macro that wraps our new version of the helper.
2021-09-13 12:48:27 +02:00
Luca Boccassi 503994bada Merge pull request #20701 from yuwata/network-address-cleanups
network: several address_update() related cleanups
2021-09-13 11:12:43 +01:00
Yu Watanabe 2d3af41f0e udev-watch: retry to save watch handle with random delay
Also, remove the watch handle if we cannot save it.
2021-09-13 18:53:00 +09:00
Yu Watanabe 20ec7d9ed5 sd-device: do not recreate the same symlinks which store watch handle 2021-09-13 11:54:56 +09:00
Yu Watanabe d7950621d2 Merge pull request #20715 from yuwata/udev-node-follow-ups
udev-node: several follow-ups
2021-09-13 11:51:55 +09:00
Luca Boccassi 54966b7cee Merge pull request #20705 from yuwata/test-oomd-util
test: skip oomd test on a unified container on a hybrid host
2021-09-12 12:56:46 +01:00
Yu Watanabe 0706cdf4ec udev-node: do not ignore unexpected errors on removing symlink in stack directory
Only acceptable error here is -ENOENT.
2021-09-12 16:14:44 +09:00
Yu Watanabe 3df566a667 udev-node: simplify the example of race 2021-09-12 16:05:51 +09:00
Yu Watanabe 8b2e22579a test-oomd-util: skip tests if cgroup memory controller is not available
Fixes #20593 and #20655.
2021-09-12 10:29:25 +09:00
Yu Watanabe 28fb998615 oomd: refuse to start if cgroup memory controller is not available 2021-09-12 10:28:24 +09:00