Commit Graph
52186 Commits
Author SHA1 Message Date
Daan De Meyer 900ac3a76a ci: Implement coverage on top of mkosi (#35407) 2024-12-05 10:47:45 +01:00
Daan De Meyer 561a3786b7 test-execute: Don't make rootfs read-only if we're collecting coverage
The test needs to be able to write coverage data to the rootfs so don't
make / read-only.
2024-12-04 14:04:24 +01:00
Daan De Meyer eb11048744 creds-util: Improve one log message 2024-12-04 11:12:50 +01:00
Daan De Meyer 157198d9ec test-creds: Migrate to new assertion macros 2024-12-04 11:12:50 +01:00
Zbigniew Jędrzejewski-Szmek 116eab8e7a test-format-table: add test for unsetting table name
This should extend coverage to another part that previously wasn't covered.
2024-12-03 15:00:26 +01:00
Zbigniew Jędrzejewski-Szmek e0be4dc563 test-format-table: add smoke test for int/uint formatting
When looking at coverage data, I noticed that some types of ints have no
coverage whatsoever.
2024-12-03 15:00:26 +01:00
Zbigniew Jędrzejewski-Szmek 5c74c26db9 test-format-table: convert to ASSERT_* macros 2024-12-03 14:57:01 +01:00
Zbigniew Jędrzejewski-Szmek 444e9ba660 shared/tests: adjust error messages
Grammar is improved a bit and some messages are shortened.
2024-12-03 14:30:01 +01:00
Luca Boccassi 80ea227191 pid1: assume user namespaces are unavailable if we get -EINVAL from clone (#35440) 2024-12-02 22:03:52 +00:00
Zbigniew Jędrzejewski-Szmek 544df97b41 ukify: ellipsize CN to not exceed maximum length
Currently the generation of the certificate fails if len(fqdn) >= 43.
Ellipsize the fqdn to let the tests pass in all cases.

Fixes https://github.com/systemd/systemd/issues/34581.
2024-12-02 16:55:57 +00:00
Zbigniew Jędrzejewski-Szmek 22996a3393 basic/namespace-util: fix double logging after fork failure
[   10.056930] (journald)[104]: Failed to fork off '(sd-mkuserns)': Invalid argument
[   10.063727] systemd[1]: systemd-modules-load.service: About to execute: /usr/lib/systemd/systemd-modules-load
[   10.071148] (journald)[104]: Failed to fork process (sd-mkuserns): Invalid argument

safe_fork_full() already logs at debug level, so the caller shouldn't.
2024-12-02 11:51:23 +01:00
Zbigniew Jędrzejewski-Szmek afb368951c pid1: assume user namespaces are unavailable if we get -EINVAL from clone()
As reported in https://github.com/systemd/systemd/issues/35400,
on riscv64, with Linux version 6.6.51-linux4microchip+fpga-2024.09, we get:

[   10.063727] systemd[1]: systemd-modules-load.service: About to execute: /usr/lib/systemd/systemd-modules-load
[   10.071148] (journald)[104]: Failed to fork process (sd-mkuserns): Invalid argument

Fixes https://github.com/systemd/systemd/issues/35400.

'r' is used to make the repeated checks shorter. Without that, the long variable
name is distracting.
2024-12-02 11:30:06 +01:00
Mike Yuan 703b1b7f24 core/service: preserve RuntimeDirectory= even if oneshot service exits
Follow-up for c26948c6da

We only want to get rid of cred mount here, and RuntimeDirectory=
is documented to be retained for SERVICE_EXITED state.

Fixes #35427
2024-12-02 10:57:45 +01:00
Luca Boccassi 0747e3b60e kernel-install: remove .extra.d/ directory too
When a UKI is removed, the per-UKI .extra.d/ directory (addons,
extensions, etc) is left behind.
2024-12-01 14:05:45 +09:00
Yu Watanabe a1417e5563 systemctl: skip checking inhibitors when dbus.service is not running
Fixes a bug introduced by 804874d26a.

Fixes #35416.
2024-12-01 14:00:55 +09:00
David Tardon c3dc460b6c execute: free syscall_log hashmap when done
Fixes #35394
2024-11-28 16:45:02 +01:00
Yu Watanabe d9d784ebe0 sysupdate: add missing full stop to the polkit message
Follow-up for e55e7a5a61.
2024-11-28 18:13:51 +09:00
Luca Boccassi 723069188d nsresourced: log about correct errno (#35386)
Split out from #35242
2024-11-27 19:26:41 +00:00
Yu Watanabe 1d96f18bd8 network/queue: do not increase reference counter when remove request is not queued
Fixes a bug introduced by ef45f5c8d0.
Fixes #35164.
2024-11-27 19:24:50 +00:00
Mike Yuan 67b9a72c60 nsresourced: log about correct errno in userns_destroy_cgroup() 2024-11-27 18:38:01 +01:00
Mike Yuan 4da9f38de1 cgroup-util: use RET_NERRNO where appropriate 2024-11-27 18:38:00 +01:00
Lennart Poettering 62f3e2f84a nspawn: make sure --private-users-ownership=no and =off work the same way
We usually want to use "extended booleans" for cases like this, i.e.
that "off", "no" and "0" can be used interchangably for turning
something off.
2024-11-28 00:47:14 +09:00
Lennart Poettering 92338a63ff sysext: coding style fixes & fix a memory leak
Follow-up for: bbec1c87d3
2024-11-28 00:46:33 +09:00
Yu Watanabe 288b9acf1c Minor follow-ups for recent PRs (#35381) 2024-11-28 00:16:29 +09:00
Lennart Poettering fbb159b789 service: don't second guess invocation mode again
let's just check the debug invocation boolean, and not recheck the
restart mode again. It's mostly redundant (because the boolean should
not have been become true if the restart mode was not set accordingly).

Moreover, i think we might want to eventually allow a manual way to
enable debug invocation mode, and hence this pointless checking would
become a problem.

Also, we never check the restart mode again in other cases, hence we
shouldn't here either.
2024-11-28 00:14:55 +09:00
Lennart Poettering d79ba8574b nspawn: improve error message when we cannot look into a container tree due to perms 2024-11-28 00:14:04 +09:00
Lennart Poettering 0790f4e45f nspawn: don't try to unregister a machine we never registered
When registering we condition this on "arg_register". Let's do the same
when unregistering, otherwise we might end up trying to unregister a
machine we never registered.
2024-11-28 00:12:57 +09:00
Mike Yuan 9a1276e0a2 shared/bootspec: mark _to_string funcs as _const_
Addresses https://github.com/systemd/systemd/pull/34959#discussion_r1860451777
2024-11-27 14:49:09 +01:00
Mike Yuan 992852e24c shared/bootspec: use FOREACH_ELEMENT where appropriate, avoid unneeded memzero() 2024-11-27 14:49:08 +01:00
Mike Yuan 7d93fa7099 shared/bootspec: move boot_entry_addons_done() up, drop separate prototype
Follow-up for e2501a851e
2024-11-27 14:49:04 +01:00
Mike Yuan 7a719510c8 basic/fileio: minor coding style cleanup
Follow-up for bbec1c87d3
2024-11-27 14:33:23 +01:00
Luca Boccassi 0abaa5be10 bootspec fixups (#34959) 2024-11-27 10:55:32 +00:00
Zbigniew Jędrzejewski-Szmek ef20d06da6 ukify: Switch to JSON HWID description format (#35208)
Fixes #35176
2024-11-27 09:50:41 +01:00
Adrian Vovk f2751d757f bootspec: Look at /loader/addons in XBOOTLDR
The bootspec util-lib's handling of global addons didn't previously
match the behavior of sd-stub, and this commit corrects that.

First, bootspec didn't load global addons from the XBOOTLDR dir, but the
stub does. So, bootspec now enumerates addons in XBOOTLDR, not just ESP

Second, the stub only loads resources (including addons) from the
partition that it was found on. Thus, we must keep track of which
partition the global addons come from, and which partition each boot
entry comes from. In other words: global addons found on the ESP will
NOT apply to UKIs found in XBOOTLDR, and bootspec now reflects that.
2024-11-26 22:25:29 -05:00
Adrian Vovk ef370a3c30 bootspec: Fixup loading of local addons for UKIs
Follow-up for 59b3df9
2024-11-26 16:33:11 -05:00
Adrian Vovk e2501a851e bootspec: Fixup memory leak
This would previously leak memory: the array was deleted but contents
inside of the array were not
2024-11-26 16:33:10 -05:00
Adrian Vovk 5a10a9a3bb sd-stub: Fixup typo & measurement order
A previous commit accidentally reversed the measurement order of the
confext initrds and sysext initrds via a minor typo. This commit fixes
the typo and restores the original measurement order

Follow-up: ac32323
2024-11-26 16:33:09 -05:00
gerblesh bbec1c87d3 sysext: set SELinux context for hierarchies and workdir 2024-11-26 17:47:32 +00:00
Lennart Poettering 7b4b3a8f7b sd-varlink: fix bug when enqueuing messages with fds asynchronously
When determining the poll events to wait for we need to take the queue
of pending messages that carry fds into account. Otherwise we might end
up not waking up if such an fd-carrying message is enqueued
asynchronously (i.e. not from a dispatch callback).
2024-11-26 16:06:53 +00:00
Luca Boccassi c4d7a13c06 cryptsetup: convert pkcs11/fido2 to iovec for key handling
key-data might be NULL. Fixes crash:

0  0x0000559c62120530 in attach_luks_or_plain_or_bitlk (cd=0x559c6b192830, name=0x7ffd57981dc4 "root", token_type=TOKEN_FIDO2, key_file=0x0, key_data=0x0, passwords=0x0, flags=524296, until=0)
    at ../src/cryptsetup/cryptsetup.c:2234
        pass_volume_key = false
        r = 1469577760
        __func__ = '\000' <repeats 29 times>
1  0x0000559c6212279c in run (argc=6, argv=0x7ffd5797fe98) at ../src/cryptsetup/cryptsetup.c:2597
        discovered_key_data = {iov_base = 0x0, iov_len = 0}
        key_data = 0x0
        token_type = TOKEN_FIDO2
        destroy_key_file = 0x0
        flags = 524296
        until = 0
        passphrase_type = PASSPHRASE_NONE
        volume = 0x7ffd57981dc4 "root"
        source = 0x7ffd57981dc9 "/dev/disk/by-uuid/8372fb39-9ba4-461a-a618-07dcaae66280"
        status = CRYPT_INACTIVE
        tries = 0
        key_file = 0x0
        config = 0x7ffd57981e05 "luks,discard,fido2-device=auto,x-initrd.attach"
        use_cached_passphrase = true
        try_discover_key = true
        discovered_key_fn = 0x7ffd5797fa70 "root.key"
        passwords = 0x0
        cd = 0x559c6b192830
        verb = 0x7ffd57981dbd "attach"
        r = 0
        __func__ = "\000\000\000"
2  0x0000559c621231e6 in main (argc=6, argv=0x7ffd5797fe98) at ../src/cryptsetup/cryptsetup.c:2674
        r = 32553
        __func__ = "\000\000\000\000"

Follow-up for 53b6c99018
2024-11-26 22:04:24 +09:00
Abderrahim Kitouni 0ae6f4843e updatectl: fix DBus method signature for SetFeatureEnabled
The signature was changed to 'sit' in sysupdated during review, but updatectl
kept using 'sbt'
2024-11-26 22:03:41 +09:00
Zbigniew Jędrzejewski-Szmek 766d74fd8b core/device: ignore ID_PROCESSING udev property on enumerate (#35332)
Fixes #35329.
2024-11-25 14:21:36 +01:00
Zbigniew Jędrzejewski-Szmek d293fade24 Check inode number to see if we are in init namespace (#35306)
This is a more comprehensive fix compared to #35273. Also adds a minimal
test only.

Based on Luca's #35273 but generalizes the code a bit.

In v258 we really should get rid of the old heuristics around userns and
cgroupns detection, but given we are late in the v257 cycle this keeps
them in.
2024-11-25 14:13:36 +01:00
Yu Watanabe c4fc22c4de core/device: ignore ID_PROCESSING udev property on enumerate
This partially reverts the commit 405be62f05
"tree-wide: refuse enumerated device with ID_PROCESSING=1".

Otherwise, when systemd-udev-trigger.service is (re)started just before
daemon-reexec, which can be easily happen on systemd package update, then
udev database files for many devices may have ID_PROCESSING=1 property,
thus devices may not be enumerated on daemon-reexec. That causes many
units especially mount units being deactivated after daemon-reexec.

Fixes #35329.
2024-11-25 15:33:48 +09:00
Daan De Meyer d6047d9fb5 ukify: Fix typing error 2024-11-24 16:47:20 +01:00
Daan De Meyer a2aacbfad5 Move mypy.ini and ruff.toml to top level
This allows reusing them for integration-test-wrapper.py as well.
2024-11-24 16:47:20 +01:00
Yu Watanabe 5b2926d941 curl-util: do not configure new io event source when the event loop is already dead
Similar to c5ecf09494, but for io event source.

Fixes #35322.
2024-11-23 22:49:57 +01:00
Ani Sinha 4b356c90dc measure: add 'dtbauto' option in help message
'dtbauto' command line was missing from the help string. Add it.
2024-11-23 12:43:34 +00:00
Lennart Poettering 95116bdfd5 nspawn: improve log message on bad incoming sd_notify() message
It's the PID that is wrong, not the UID/GID, be precise.
2024-11-23 17:33:17 +09:00
Lennart Poettering 2bd290ca02 nspawn: fix userns_mkdir() invocation
The wrong error code was logged.

But actually given that userns_mkdir() is fine with existing dirs, let's
drop the redundant conditionalization.

Follow-up for: a1fcaa1549
2024-11-23 17:33:06 +09:00