Commit graph

74133 commits

Author SHA1 Message Date
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 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
Lennart Poettering bbd3832e6b watchdog: reset last ping timestamp when opening watchdog
When we open a watchdog fresh we have never pinged it, hence reset the
ping timestamp explicitly, so that it is not only reset the first time
we open the device, but all times.
2024-05-29 17:42:02 +02:00
Lennart Poettering e7f0053787 watchdog: normalize how we name watchdog related calls
Let's put the "watchdog" always as prefix in the name, and not as suffix
or the middle. Just for reasons of naming hygiene
2024-05-29 17:42:02 +02:00
Zbigniew Jędrzejewski-Szmek 134bdba832 test-format-table: add test for TABLE_BPS formatting 2024-05-29 17:36:01 +02:00
Daan De Meyer c15747e4ab
Merge pull request #33062 from DaanDeMeyer/virtio-scsi
mkosi: Switch back to cloud/KVM kernel packages
2024-05-29 16:27:07 +02:00
Daan De Meyer 556659adfe mkosi: Switch back to cloud/KVM kernel packages
Now that we don't need megasas2 anymore, let's switch back to the
KVM/cloud kernel images to save on image size, build times and boot
times.
2024-05-29 15:24:03 +02:00
Daan De Meyer eb47645e21 test: Use virtio-scsi for keydev drive
Otherwise qemu defaults to ide for which the module isn't always
available (e.g. it's missing in the debian linux cloud images).
2024-05-29 15:24:03 +02:00
Daan De Meyer ac09c21d45 TEST-64-UDEV-STORAGE: Replace megasas2 controller with virtio scsi controller
The virtio-scsi driver is available in the KVM/cloud kernel
packages provided by distributions whereas the megasas2 driver is
not. Let's switch to virtio-scsi so we can switch back to the KVM/cloud
kernel packages.
2024-05-29 15:24:03 +02:00
Daan De Meyer aa6178058b
Merge pull request #33065 from DaanDeMeyer/nspawn
test: Run tests that don't need a vm in systemd-nspawn
2024-05-29 15:23:48 +02:00
Lennart Poettering a25acf70fe exec-util: make sure to close all fds for invoked generators
We should really have set O_CLOEXEC for all our fds, but better be safe
than sorry.
2024-05-29 14:43:40 +02:00
Lennart Poettering 6b90b04d3a exec-util: use the stdio array of safe_fork_full() where appropriate 2024-05-29 14:43:40 +02:00
Daan De Meyer d12fedd25e mkosi: Run integration tests as root
This allows running integration tests that support it in nspawn
instead of qemu. This both gives extra coverage and speeds things up.
2024-05-29 14:10:50 +02:00
Daan De Meyer 1e5a1bbe02 test: Run tests that don't need a vm in systemd-nspawn
If we're not running the test as root, stick to using a virtual
machine, as mkosi can't do rootless nspawn yet.
2024-05-29 14:10:50 +02:00
Daan De Meyer 14aea4a9f5 mkosi: Disable iscsi service and socket
We'll always start these on demand in integration tests that need
them. No need to start them by default.
2024-05-29 14:10:50 +02:00
Daan De Meyer 3c367df7c6 mkosi: Switch from btrfs to ext4
Mounting multiple btrfs filesystems with the same fsid only works
properly from kernel 6.7 onwards. Let's switch to ext4 for now which
does support this.
2024-05-29 14:10:50 +02:00
Daan De Meyer 09466b2a0e mkosi: update to latest 2024-05-29 14:10:47 +02:00
Lennart Poettering 8971313336 generator-setup: use RET_GATHER() 2024-05-29 11:52:40 +02:00
Daan De Meyer 6448993a4b mkosi: Set EXTRA_CFLAGS on opensuse
The opensuse spec doesn't unconditionally set FORTIFY_SOURCE=2 anymore
so let's drop our workaround.
2024-05-29 11:26:06 +02:00
Daan De Meyer a635b33214
Merge pull request #32562 from Werkov/test-cgroup-opensuse
Revert "TEST-19-CGROUP: Skip on opensuse"
2024-05-29 11:01:00 +02:00
Luca Boccassi 8e495bf0b7 bpf: add helper to translate kernel error codes from libbpf
libbpf returns error codes from the kernel unmodified, and we don't understand
them so non-fatal ones are handled as hard errors.
Add a translation helper, and start by translating 524 to EOPNOTSUPP, which is
returned when nsresourced tries to use LSM BPF hooks that are not
implemented on a given arch (in this case, arm64 is misssing trampolines).

Fixes https://github.com/systemd/systemd/issues/32170
2024-05-29 08:29:47 +02:00
Yu Watanabe 45af01d311 test-network: update comment about status of kernel regression 2024-05-29 09:07:48 +09:00
Luca Boccassi cbac9a3835
Merge pull request #33066 from YHNdnzj/logind-linger
logind-user: check linger file in user_wants_service_manager too
2024-05-28 22:41:57 +02:00
Christian Göttsche a424e4af6d tmpfiles: improve warning message and use O_NOCTTY
Mention in the warning message for a failed open on a to be removed file
why systemd-tmpfiles tried to open it.

Also open the file with the O_NOCTTY flag, since it should never become
the controlling terminal.
2024-05-28 21:58:30 +02:00
Mike Yuan e417415996
logind-user: check linger file in user_wants_service_manager too
Follow-up for 5099a50d43

Fixes #33005
2024-05-29 00:50:07 +08:00
Mike Yuan 194dba5ef5
logind-user: add missing assertion for user_check_linger_file
Also make the function take const User*
2024-05-29 00:50:07 +08:00
Yu Watanabe acddb3cb79 test-network: tun/tap fd may be owned by tentative worker processes
PID1 may invoke a helper process, e.g. sd-close, during the test.
So, processes other than networkd and PID1 may be shown.
```
testtap99: tap pi multi_queue vnet_hdr persist filter
        Attached to processes:systemd-network(2852)(sd-close)(2863)systemd(1)
```

Closes #33055.
2024-05-28 16:39:51 +02:00
Luca Boccassi aa6fe772e1
Merge pull request #33057 from poettering/partscan-no-part
blockdev-util: for partition block devices partition scanning is always off
2024-05-28 16:39:15 +02:00
Zbigniew Jędrzejewski-Szmek b95914f4b0 man: capsule support was added in v256
The version info added directly to --capsule. If we add the
same switch in other places in the future, we will have to move
this.

Closes https://github.com/systemd/systemd/issues/33048.
2024-05-28 16:30:54 +02:00
Luca Boccassi 78247be91d
Merge pull request #33063 from keszybz/wiki-links
Update wiki links
2024-05-28 16:21:45 +02:00
Zbigniew Jędrzejewski-Szmek 95a248c56f
Merge pull request #33008 from fbuihuu/optionally-link-ssh-dropins
Optionally link ssh dropins
2024-05-28 16:02:40 +02:00
Yu Watanabe 47e881ee65 test: lock device when sfdisk or mkfs
Or, trigger devices after the command incase the device is dm or md.

Fixes #33056.
2024-05-28 15:43:55 +02:00
Mike Yuan 1e1df05296 socket-util: use GREEDY_REALLOC_APPEND where appropriate
Also, previously GREEDY_REALLOC was used improperly,
causing the fds_array to be leaked when realloc() fails.
2024-05-28 15:42:14 +02:00