Commit graph

74381 commits

Author SHA1 Message Date
Daan De Meyer e74a994ebf mkosi: Disable add-determinism on Fedora
This was added for reproducible builds which we don't really care
about when building rpms in mkosi, so disable it from running as it's
broken and breaks our rpm builds.
2024-05-30 22:17:29 +02:00
Daan De Meyer 3b046883ad mkosi: Skip debuginfo workaround on newer rpm
The corresponding bug was fixed in rpm 4.20 (of which the alpha is in
rawhide as rpm 4.19.91) so skip the workaround when we detect a newer
rpm version.
2024-05-30 22:16:13 +02:00
Daan De Meyer 8c335463d9 mkosi: Don't install wireguard-tools on Debian
Package was removed from testing. This can be reverted next week once
it's added back to testing.
2024-05-30 20:54:06 +02:00
Daan De Meyer ba592dc715 mkosi: Replace submodules with our own thing
Unfortunately, git submodules break in all sorts of ways:

- Various github workflows (dependabot, github pages) try to do a shallow
clone of git submodules which does not work at all when the git repository
is hosted on pagure (https://pagure.io/pagure/issue/5453,
https://github.com/dependabot/dependabot-core/issues/9391).
- If the git forge hosting the git repository uses SHA256, then it breaks our
usage of it as a submodule as SHA256 repositories cannot be used as submodules
in SHA1 repositories (src.opensuse.org moved to SHA256 which broke our usage of
opensuse's systemd spec as a submodule).
- git submodules completely break usage of git worktrees.
- ...

Let's avoid all these issues by just doing our own home grown implementation of
git submodules. We lose the automatic dependabot updates this way but since dependabot
fails to run more often that not with submodules we don't really lose anything.
2024-05-30 19:31:32 +02:00
Luca Boccassi 0630069f0b
Merge pull request #33081 from keszybz/networkctl-formatting
Fix formatting of speeds in networkctl
2024-05-30 16:33:38 +02:00
Mike Yuan 1d617b35fe
bus-unit-util: extend the bus call timeout for UnitFreezer
Might fix #33083

There's another report available on Mastodon:
https://m.otter.homes/@kaixin/112510783502516607
https://m.otter.homes/@kaixin/112510803023469180
2024-05-30 21:51:48 +08:00
Mike Yuan 61fbc58c46
sleep,home: clean up logs for session freezer a bit 2024-05-30 21:51:48 +08:00
Mike Yuan 12904d5387
bus-unit-util: rework UnitFreezer, explicitly thaw unit
Currently, we don't explicitly call unit_freezer_thaw(),
but rely on the destructor to thaw the frozen unit on
return. This has several problems though, one of them
being that we ignore the return value of ThawUnit(),
which is something we really shouldn't do here,
since such failure can easily leave the whole system
in unusable state. Moreover, the logging is kinda messy,
e.g. homed might log "Everything completed" yet immediately
followed by "Failed to thaw unit". Instead, we should log
consistently and at higher level, to make things more
debuggable.

Therefore, let's step away from the practice. Plus,
make UnitFreezer object heap-allocated, to match
with existing unit_freezer_new() and allow us to
use NULL to denote that the freezer is disabled.
2024-05-30 21:51:48 +08:00
Mike Yuan 759ac0dec3
core/dbus-unit: modernize bus_unit_method_freezer_generic a bit 2024-05-30 21:51:48 +08:00
Mike Yuan 47266ea224
core/dbus-manager: only allow Freeze/ThawUnit() if loaded 2024-05-30 21:51:47 +08:00
Luca Boccassi 6ecdd5ebd1
Merge pull request #33101 from DaanDeMeyer/revert
Revert accidentally merged commits
2024-05-30 14:51:07 +02:00
Lennart Poettering 43ad199802 homed: drop caches harder
echoing "2" is apparently not enough to erase inodes/dentrys from
memory, hence use "3", which seems to work.

Fixes: #32596
2024-05-30 14:50:40 +02:00
Daan De Meyer 074ac66e88 Revert "mkosi: Sanitizer improvements"
This reverts commit aef13ad029.
2024-05-30 14:50:21 +02:00
Daan De Meyer d54d6197d5 Revert "ci: Build with sanitizers in mkosi"
This reverts commit 639403f9a8.
2024-05-30 14:50:10 +02:00
Daan De Meyer 381918edc9
Merge pull request #32866 from DaanDeMeyer/sanitizers
mkosi: Sanitizers
2024-05-30 14:49:13 +02:00
Daan De Meyer 465d302d48 mkosi: Preserve environment when running integration tests with sudo
Otherwise we won't detect we're running in Github Actions and will
show the wrong command to fetch the journal.
2024-05-30 13:50:27 +02:00
Daan De Meyer 0916532e4b
Merge pull request #33090 from poettering/tpm12-efi-check
efi-api: tighten check for TPM2 systems
2024-05-30 13:32:41 +02:00
Lain "Fearyncess" Yang 0230235b57 hwdb: add a vmbus id for HyperV Video device 2024-05-30 12:55:44 +02:00
Daan De Meyer 5837d0dced
Merge pull request #33084 from DaanDeMeyer/cgroup-log
cgroup-util: Don't try to open pidfd for pids from cgroup.threads
2024-05-30 12:49:37 +02:00
Daan De Meyer 639403f9a8 ci: Build with sanitizers in mkosi 2024-05-30 12:47:45 +02:00
Daan De Meyer aef13ad029 mkosi: Sanitizer improvements
- Let's set the environment on the kernel command line so it applies
to initrd and main system.
- Let's add the necessary wrappers that are also added in test-functions.
Unlike test-functions we don't use gcc/clang to get the library path as
that requires installing gcc/clang in the initrd.
- Let's drop the hack to get journald writing to the console and have
it write to kmsg instead. We'll get the output either way.
- Stop removing libstdc++ and sanitizer libraries from Arch Linux
initrds and other images as it's required by the sanitizer libraries.
- Add a workaround for specifying extra meson options for opensuse
- Add a leak sanitizer suppression file as a workaround for a false
positive leak in verify_selinuxmnt() in libselinux. We do a soname match
because the stacktrace can't be properly symbolized on Debian.
2024-05-30 12:47:45 +02:00
Daan De Meyer 6b572e88a3 test-network: Add dirs_exist_ok=True to cp_r()
Let's not fail if directories already exist in cp_r().
2024-05-30 12:47:45 +02:00
Daan De Meyer f824a33a79 test-execute: Load systemd-asan-env environment file if available
When DynamicUser= is enabled, we need LD_PRELOAD to be configured
correctly as the tests will load systemd's nss module which will complain
when built with sanitizers if the sanitizer libraries were not loaded
first.
2024-05-30 12:47:45 +02:00
Daan De Meyer 51e26d2366 test-execute: Skip system call filter tests when sanitizers are used
System call filtering is incompatible with sanitizers so let's skip
these tests when we're built with sanitizers.
2024-05-30 12:47:45 +02:00
Daan De Meyer 4dc76eb770 test-execute: Skip test_exec_mount_apivfs() when running with sanitizers
The test fails when running under sanitizers due to missing sanitizer
libraries. For now, let's skip the test until we can make the necessary
changes to run it under sanitizers.
2024-05-30 12:47:45 +02:00
Daan De Meyer 9029f20b35 TEST-02-UNITTESTS: Pass asan environment to units if it is available
Some tests (e.g. test-udev.py) might trigger one of our NSS modules
which means LD_PRELOAD has to be configured properly.
2024-05-30 12:47:45 +02:00
Daan De Meyer aae2990907 TEST-79-MEMPRESS: Load systemd-asan-env if available
Required since we run with DynamicUser=1.
2024-05-30 12:47:45 +02:00
Daan De Meyer 0cd488617c TEST-36-NUMAPOLICY: Skip when running with sanitizers
The test does not work under sanitizers as strace is used. Until the
test is fixed to not use strace let's skip it when running with
sanitizers.
2024-05-30 12:47:43 +02:00
Zbigniew Jędrzejewski-Szmek 415bf4e01e sd-event: use consistent style for '*' in signatures 2024-05-30 12:15:11 +02:00
Zbigniew Jędrzejewski-Szmek 8ca77ee645 sd-event: emit a debug line if disabling unreffed source fails
We can only do a debug log from the library, so let's add that. Callers
probably want to provide some hint when that happens, but it's very unlikely so
not worth coding in every caller.

And drop the now-unnecessary handling in unit_dequeue_rewatch_pids().
2024-05-30 12:15:11 +02:00
Zbigniew Jędrzejewski-Szmek a3ada90a37 various: remove unnecessary check before sd_event_source_set_enabled()
sd_event_source_set_enabled() does the same check internally.
2024-05-30 12:11:58 +02:00
Zbigniew Jędrzejewski-Szmek 613b698eb4 basic/fd-util: drop report from fd_cloexec_many
fd_cloexec_many promised to report if work was done, but that code was
not effective, because it always reported true if any fds were open.
But no callers care about the return value, so let's just drop this.
2024-05-30 12:07:57 +02:00
Zbigniew Jędrzejewski-Szmek 4199866ac5 basic/fd-util: drop unnecessary {} 2024-05-30 12:07:57 +02:00
Zbigniew Jędrzejewski-Szmek 12080b1f7d shared/format-table: print BPS with part after point
Fixes https://github.com/systemd/systemd/issues/33076.
"2Gbps" → "2.5Gbps".
2024-05-30 11:38:30 +02:00
Zbigniew Jędrzejewski-Szmek 11226bf19b shared/format-table: do not print '.0'
This makes output a bit shorter and nicer. For us, shorter output is generally
better.

Also, drop unnecessary UINT64_C macros. The left operand is always uint64_t,
and C upcasting rules mean that it doesn't matter if the right operand is
narrower or signed, the operation is always done on the wider unsigned type.
2024-05-30 11:38:30 +02:00
Mike Yuan a6117106e4 blockdev-util: update comment for blockdev_partscan_enabled
Follow-up for aa6fe772e1

Also, the 'partscan' sysattr has been backported to v6.6.
2024-05-30 10:57:30 +02:00
Daan De Meyer 8783355fd9 cgroup-util: Don't try to open pidfd for pids from cgroup.threads
Opening pidfds for non thread group leaders only works from 6.9 onwards with PIDFD_THREAD. On
older kernels or without PIDFD_THREAD pidfd_open() fails with EINVAL. Since we might read non
thread group leader IDs from cgroup.threads, we introduce and set CGROUP_NO_PIDFD to avoid
trying open pidfd's for them and instead use the pid as is.
2024-05-30 10:30:36 +02:00
Yu Watanabe d24ceef937 man: mention that IPMasquerade= and IPv6SendRA= implies IPv4Forwarding=/IPv6Forwarding=
It has been mentioned in IPv4Forwarding= and IPv6Forwarding=,
but let's also explain in the settings who imply these settings.

Follow-up for 3976c43092 and
485f5148b3.
2024-05-30 10:20:33 +02:00
Lennart Poettering 5005522412 pcrlock: tweak error messages when we are not looking at a TPM2 event log
If we are looking at a TPM1.2 event log the first log record will not be
the "EfiSpecIdEvent" but something else. Let's improve the log messages
about this, and say explicitly that this is likely not a TPM2.0 event
log.
2024-05-30 10:13:39 +02:00
Lennart Poettering aeaac9a289 efi-api: check /sys/class/tpm/tpm0/tpm_version_major, too
If the ceck for the ACPI TPM2 table did not work we currently check if
the EFI TPM table exists to check if the firmware supports TPM2.
Specifically we check if
/sys/kernel/security/tpm0/binary_bios_measurements exists. But that's
not enough, since that also exists on TPM1.2 systems. Hence, let's also
check /sys/class/tpm/tpm0/tpm_version_major which should exist under
similar conditions and tells us the kernel's idea of the TPM version in
use.

I originally intended to read the signature of the
/sys/kernel/security/tpm0/binary_bios_measurements contents for this,
but this is not ideal since that file has tight access mode, and our TPM
availability check would thus not work anymore if invoked unpriv.

Follow-up for 4b33911581

Fixes: #33077
2024-05-30 10:13:39 +02:00
Daan De Meyer 8acb02f395 TEST-02-UNITTESTS: Fix exit code checks 2024-05-30 09:59:30 +02:00
Daan De Meyer 412e2a6487 TEST-05-RLIMITS: Bump memory limits
When running with sanitizers we need more memory otherwise the unit
gets OOM killed.
2024-05-30 09:59:30 +02:00
Daan De Meyer fe2a793b2d mkosi: Stop installing dbus-broker on OpenSUSE
dbus-broker and dbus-daemon have not been made interchangable on
OpenSUSE so we currently end up with dbus-broker used for the system
bus and dbus-daemon for the session bus. Let's stick to dbus-daemon
on OpenSUSE until they switch to dbus-broker.
2024-05-30 09:59:30 +02:00
Daan De Meyer 9b112737fa mkosi: Install bpftrace 2024-05-30 09:59:30 +02:00
Luca Boccassi 214013be83
Merge pull request #33079 from poettering/watchdog-no-disarm
watchdog: don't disarm on shutdown
2024-05-29 22:18:08 +02:00
Luca Boccassi 1af8b31e67
Merge pull request #33072 from poettering/generator-fixes
various fixes to generator execution
2024-05-29 22:17:13 +02:00
Daan De Meyer 9ac8450e7f basic: Add debug logging for pidref_set_pid() 2024-05-29 21:04:13 +02:00
Daan De Meyer 330ecca853 cgroup-util: Add debug logging for cg_kill_recursive() 2024-05-29 21:04:09 +02:00
Lennart Poettering d46aab1374 main: add comment explaining parameter to watchdog_close 2024-05-29 17:42:02 +02:00
Lennart Poettering 79645d7376 shutdown: explicitly close watchdog with disarm=false before we destroy watchdog resources
Otherwise we'll close the device disarming it as side-effect of
watchdog_free_device(), which is not intended. Hence, let's close the fd
first explicitly leaving it armed.

Fixes: #33075
2024-05-29 17:42:02 +02:00