]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 months agosystemd-analyze: stop printing Ex transient settings 38083/head
Zbigniew Jędrzejewski-Szmek [Sat, 5 Jul 2025 11:01:18 +0000 (13:01 +0200)] 
systemd-analyze: stop printing Ex transient settings

The test will fail if we ever add one again in the future by mistake.

4 months agoshared/bus-unit-util: fix PrivateTmp=/PrivateUsers=/ProtectControlGroups= and Ex...
Zbigniew Jędrzejewski-Szmek [Sat, 5 Jul 2025 07:22:16 +0000 (09:22 +0200)] 
shared/bus-unit-util: fix PrivateTmp=/PrivateUsers=/ProtectControlGroups= and Ex variants

For some fields, we perform careful parsing and verification on the sender
side. For other fields, we accept any string or strv. I think that actually
this is fine: we should optimize for the correct case, i.e. the user runs a
command that is valid. The server must perform parsing in all cases, so doing
the verification on the sender side doesn't add value. When doing parsing
locally, in case of invalid or unsupported input, we would generate the error
message locally, so we would avoid the D-Bus call, but the message itself is
not better and from the user's point of view, the result is the same. And by
doing the parsing only on the server side, we deal better with the case where
the sender has an older version of the software. By not doing verification, we
implicitly "support" new values. And when the sender has a newer version that
supports additional fields, that does not help as long as the server uses an
older version. So in case of version mismatches, parsing on the server side is
as good or better.

Resolves https://github.com/systemd/systemd/issues/37174.

4 months agoshared/bus-unit-util: tweak bus_append_exec_command to use Ex prop only if necessary
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jul 2025 17:32:51 +0000 (19:32 +0200)] 
shared/bus-unit-util: tweak bus_append_exec_command to use Ex prop only if necessary

This changes little in behaviour, the conceptual part is more important. The
non-Ex variant is the actual name on the command line, and we should use the
non-Ex D-Bus property too, if it works. This increases compatibility with old
versions. But the code was mostly doing the right thing. Even the tests tested
the right thing.

Follow-up for b3d593673c5b8b0b7d781fd26ab2062ca6e7dbdb and
898fc00e794d714e2f01409bef440d910c22502a.

The test is simplified by taking advantage of the fact that both names
on the commandline are supposed to behave identically.

Partially resolves https://github.com/systemd/systemd/issues/37174.

4 months agoshared/bus-unit-util: rework error messages for NFTSet=
Zbigniew Jędrzejewski-Szmek [Sat, 5 Jul 2025 11:26:07 +0000 (13:26 +0200)] 
shared/bus-unit-util: rework error messages for NFTSet=

Let's be nice to the user and print the exact reason why we won't accept
a setting.

4 months agoshared/bus-unit-util: rework error messages
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jul 2025 15:18:16 +0000 (17:18 +0200)] 
shared/bus-unit-util: rework error messages

We generally want to have error messages with a fixed structure that convey the
important information, i.e. field name, error value, and the offending text for
options that take short values. (The text is not printed for strings encoded with
base64 and hexmem or for credentials.)

Let's use a helper that prints the message in a fixed format in the majority of
cases. In the few places where a custom message is useful, the helper is not
used. The helper:
- prints the field name, value, and error info,
- quotes the value,
- handles -ENOMEM, so we don't need to handle it separately everywhere.

When this code was originally written, parse functions would return -1
as error. Nowadays day all return a good errno, so it is fine if we print
the corresponding strerror.

4 months agoshared/bus-unit-util: tweak error handling in bus_append_exec_command
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jul 2025 12:06:52 +0000 (14:06 +0200)] 
shared/bus-unit-util: tweak error handling in bus_append_exec_command

exec_command_flags_to_strv() should not fail, unless we screwed up, so assert
instead of returning an error. Also, no need to strdup constant _PATH_BSHELL;
drop that so that we can get rid of the oom error handling. Finally, rename
l → cmdline for clarity.

4 months agoshared/bus-unit-util: also send empty array for LogFilterPatterns=
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jul 2025 10:07:13 +0000 (12:07 +0200)] 
shared/bus-unit-util: also send empty array for LogFilterPatterns=

Before, for empty input, we'd send an array with one item with an empty
pattern. Use the helper which sends an empty array instead.
bus_exec_context_set_transient_property() ignores items with an empty
pattern, so the result should be the same.

Request in review:
https://github.com/systemd/systemd/pull/37665#discussion_r2182375988.

4 months agotest-bus-unit-util: add a test that attempts to serialize all know transient settings
Zbigniew Jędrzejewski-Szmek [Thu, 3 Jul 2025 16:52:26 +0000 (18:52 +0200)] 
test-bus-unit-util: add a test that attempts to serialize all know transient settings

The samples were partially generated using claude.ai. Those examples are
usually fairly boring. I tried to remove obvious repetitions and add some more
interesting examples, but certainly more edge cases could be added.

In some cases, we are quite lenient and do almost no verification on the sender
side.

4 months agoshared/bus-unit-util: check errors before other conditions
Zbigniew Jędrzejewski-Szmek [Fri, 4 Jul 2025 05:04:09 +0000 (07:04 +0200)] 
shared/bus-unit-util: check errors before other conditions

As requested in post-merge review in
https://github.com/systemd/systemd/pull/37665#discussion_r2183755909.

4 months agoci: enable arm64 runner for build/unit jobs
Luca Boccassi [Fri, 4 Jul 2025 00:54:02 +0000 (01:54 +0100)] 
ci: enable arm64 runner for build/unit jobs

Enable only a couple of jobs, to avoid running down capacity too much

4 months agoukify: when decompressing kernel before signing, call verify on decompressed file
Luca Boccassi [Fri, 4 Jul 2025 00:06:54 +0000 (01:06 +0100)] 
ukify: when decompressing kernel before signing, call verify on decompressed file

Otherwise it will fail as it's an archive, not a PE file:

Invalid DOS header magic
Can't open image /boot/vmlinuz.old
/boot/vmlinuz.old is compressed and cannot be loaded by UEFI, decompressing
+ sbverify --list /boot/vmlinuz.old
=========================== short test summary info ============================
FAILED ../src/ukify/test/test_ukify.py::test_efi_signing_sbsign[3650] - subprocess.CalledProcessError: Command '['sbverify', '--list', PosixPath('/boot/vmlinuz.old')]' returned non-zero exit status 1.
FAILED ../src/ukify/test/test_ukify.py::test_efi_signing_sbsign[None] - subprocess.CalledProcessError: Command '['sbverify', '--list', PosixPath('/boot/vmlinuz.old')]' returned non-zero exit status 1.
FAILED ../src/ukify/test/test_ukify.py::test_inspect - subprocess.CalledProcessError: Command '['sbverify', '--list', PosixPath('/boot/vmlinuz.old')]' returned non-zero exit status 1.

Follow-up for 0dd03215f1e402092f6c6da213708045e445a9ed

4 months agoAdd systemd-analyze verb to list runtime unit properties (#37665)
Yu Watanabe [Fri, 4 Jul 2025 02:47:38 +0000 (11:47 +0900)] 
Add systemd-analyze verb to list runtime unit properties (#37665)

4 months agoci: restrict x86-only packages to x86 configs (#38056)
Luca Boccassi [Fri, 4 Jul 2025 00:26:22 +0000 (01:26 +0100)] 
ci: restrict x86-only packages to x86 configs (#38056)

Prepare the ground for non-x86 CI jobs. Still work in progress, but
these preparatory steps work and can be already included.

4 months agopcrlock: process components outside of location window properly
Lennart Poettering [Thu, 3 Jul 2025 11:50:46 +0000 (13:50 +0200)] 
pcrlock: process components outside of location window properly

So far, when we tried to match a component to eent log entries we
skipped those components if they were outside of our location window.
That however is too aggressive, since it means any components that are
already in the logs, but outside of the location window will be
considered unrecognized in the logs, and thus removed from the PCR
policy.

Change things around: always try to match up all components, regardless
if inside the location window or outside, but then make it non-fatal we
can't find a component outside of the location window.

Fixes: #36079
4 months agoci: also install llvm-<version> 38056/head
Luca Boccassi [Thu, 3 Jul 2025 21:58:25 +0000 (22:58 +0100)] 
ci: also install llvm-<version>

On some architectures that's not pulled in by default, it ships llvm-ar
which is needed by meson

4 months agoci: install packages available only on x86_64/arm64 on those arches only
Luca Boccassi [Thu, 3 Jul 2025 21:57:46 +0000 (22:57 +0100)] 
ci: install packages available only on x86_64/arm64 on those arches only

4 months agomkosi: libclang-rt-dev is not available on s390x
Luca Boccassi [Wed, 2 Jul 2025 23:40:51 +0000 (00:40 +0100)] 
mkosi: libclang-rt-dev is not available on s390x

Doesn't seem intentional, so use a regex for now:
https://bugs.debian.org/1108683

4 months agomkosi: move efi packages to conditional drop-in
Luca Boccassi [Wed, 2 Jul 2025 20:56:27 +0000 (21:56 +0100)] 
mkosi: move efi packages to conditional drop-in

4 months agomkosi: drop workaround for opensuse systemd-stub tmpfiles
Luca Boccassi [Wed, 2 Jul 2025 20:57:36 +0000 (21:57 +0100)] 
mkosi: drop workaround for opensuse systemd-stub tmpfiles

It was moved back to the main package

4 months agosd-event struct typedefs and comments (#37790)
Luca Boccassi [Thu, 3 Jul 2025 21:22:40 +0000 (22:22 +0100)] 
sd-event struct typedefs and comments (#37790)

4 months agochase: when chasing paths, trigger automounts
Lennart Poettering [Thu, 3 Jul 2025 09:49:44 +0000 (11:49 +0200)] 
chase: when chasing paths, trigger automounts

As it turns out open() with O_PATH does *not* trigger autofs, you get a
reference to the autofs inode, if not triggered.

But there's a way out: open_tree() (when specified without
OPEN_TREE_CLONE) is actually fully equivalent to open() with O_PATH –
with the exception of one thing: it *does* trigger automounts.

Thanks for Christian Brauner for pointing me to this and saving my day.

Fixes: #33155
4 months agoopenssl-util: allow to build with openssl without UI support (#38041)
Luca Boccassi [Thu, 3 Jul 2025 21:11:02 +0000 (22:11 +0100)] 
openssl-util: allow to build with openssl without UI support (#38041)

This makes it possible to build systemd with
-Dc_args='-DOPENSSL_NO_UI_CONSOLE=1'. Hopefully, now systemd can be
built with other openssl implementations, like BoringSSL, which deos not
support UIs.

Closes #38024.

4 months agofd-util: Move RAW_O_LARGEFILE and O_ACCMODE_STRICT definitions to fd-util.h (#38051)
Mike Yuan [Thu, 3 Jul 2025 20:27:39 +0000 (22:27 +0200)] 
fd-util: Move RAW_O_LARGEFILE and O_ACCMODE_STRICT definitions to fd-util.h (#38051)

4 months agoshared/bus-unit-util: stop unsing strndupa 37665/head
Zbigniew Jędrzejewski-Szmek [Tue, 1 Jul 2025 07:51:00 +0000 (09:51 +0200)] 
shared/bus-unit-util: stop unsing strndupa

Those are user-controlled strings, so let's use heap allocations in the usual
fashion. (Though, with strndupa_safe, the allocations were bounded anyway, so
ultimately this doesn't matter.)

4 months agoshell-completions: add systemd-analyze transient-settings
Zbigniew Jędrzejewski-Szmek [Mon, 2 Jun 2025 18:42:54 +0000 (20:42 +0200)] 
shell-completions: add systemd-analyze transient-settings

The zsh completions only complete one type argument, even though multiple
args are allowed. But the same issue occurs with other completions, e.g.
for options. I don't know how to solve this.

4 months agodocs/TRANSIENT-SETTINGS: update lists
Zbigniew Jędrzejewski-Szmek [Mon, 2 Jun 2025 13:15:38 +0000 (15:15 +0200)] 
docs/TRANSIENT-SETTINGS: update lists

Those lists were partially wrong and partially outdated. We should generate
this document automatically, but let's revisit this topic after the conversion
to sphinx. For now, as a stop-gap solution, I generated the lists from
the new 'systemd-analyze transient-settings' command.

4 months agoanalyze: add transient-settings verb
Zbigniew Jędrzejewski-Szmek [Fri, 30 May 2025 10:15:13 +0000 (12:15 +0200)] 
analyze: add transient-settings verb

Related to https://github.com/systemd/systemd/pull/37641.

The name "transient settings" was used in docs/TRANSIENT-SETTINGS.md.
Using "setting" helps distinguish this from D-Bus "properties", which are
a much larger set, partially overlapping.

4 months agoshared/bus-unit-util: add bus_dump_transient_settings() helper
Zbigniew Jędrzejewski-Szmek [Thu, 29 May 2025 12:37:30 +0000 (14:37 +0200)] 
shared/bus-unit-util: add bus_dump_transient_settings() helper

bus_append_unit_property() and associated functions accept a long list of
properties. But the specific names are only available through code. But it is
useful to be able to know the specific list of properties that is supported, in
particular for shell completions. Thus, add a way to list the properties that
are supported by the code.

In the future we could also turn this into a test for the documentation. For
various reasons, the list of properties listed in the docs is a partially
overlapping set. E.g. for service type, the pull request
https://github.com/systemd/systemd/pull/37661 creates a list with 212 entries,
and this code generates 7 entries less and 184 more. I didn't check all the
differences, but in the few cases I did, the list generated here was actually
correctly supported by 'systemd-run -p'.

A smoke test is added.

4 months agoshared/bus-unit-util: convert to a table
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 17:29:51 +0000 (19:29 +0200)] 
shared/bus-unit-util: convert to a table

4 months agoshared/bus-unit-util: add helper for TimeoutSec=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 16:11:57 +0000 (18:11 +0200)] 
shared/bus-unit-util: add helper for TimeoutSec=

4 months agoshared/bus-unit-util: add define to shorten common append pattern
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 15:18:28 +0000 (17:18 +0200)] 
shared/bus-unit-util: add define to shorten common append pattern

4 months agoshared/bus-unit-util: add helper for AppArmorProfile=/SmackProcessLabel=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:46:32 +0000 (16:46 +0200)] 
shared/bus-unit-util: add helper for AppArmorProfile=/SmackProcessLabel=

4 months agoshared/bus-unit-util: add helper for CPUQuotaPeriodSec=ManagedOOMMemoryPressureDurati...
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:44:01 +0000 (16:44 +0200)] 
shared/bus-unit-util: add helper for CPUQuotaPeriodSec=ManagedOOMMemoryPressureDurationSec=

4 months agoshared/bus-unit-util: add helper for unit deps
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:41:29 +0000 (16:41 +0200)] 
shared/bus-unit-util: add helper for unit deps

4 months agoshared/bus-unit-util: define helper for conditions and asserts
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:37:24 +0000 (16:37 +0200)] 
shared/bus-unit-util: define helper for conditions and asserts

The function has "try" in the name because it dynamically checks
if the field name matches.

4 months agoshared/bus-unit-util: define helper for SuccessActionExitStatus= and friend
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:23:31 +0000 (16:23 +0200)] 
shared/bus-unit-util: define helper for SuccessActionExitStatus= and friend

4 months agoshared/bus-unit-util: add helper for TimersCalendar property
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:16:04 +0000 (16:16 +0200)] 
shared/bus-unit-util: add helper for TimersCalendar property

4 months agoshared/bus-unit-util: add helper for TimersMonotonic property
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:14:44 +0000 (16:14 +0200)] 
shared/bus-unit-util: add helper for TimersMonotonic property

4 months agoshared/bus-unit-util: add helper for Listen property
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:13:03 +0000 (16:13 +0200)] 
shared/bus-unit-util: add helper for Listen property

4 months agoshared/bus-unit-util: use common helper for various strv properties
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:10:30 +0000 (16:10 +0200)] 
shared/bus-unit-util: use common helper for various strv properties

4 months agoshared/bus-unit-util: define helper for SuccessExitStatus= and friends
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:08:52 +0000 (16:08 +0200)] 
shared/bus-unit-util: define helper for SuccessExitStatus= and friends

4 months agoshared/bus-unit-util: define helper for Paths property
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 14:05:33 +0000 (16:05 +0200)] 
shared/bus-unit-util: define helper for Paths property

4 months agotest: drop ProtectHostnameEx, add one test for ProtectHostnameEx
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 11:38:29 +0000 (13:38 +0200)] 
test: drop ProtectHostnameEx, add one test for ProtectHostnameEx

This is a separate commit because the parent commit is supposed to be
backward compatible, i.e. the tests must pass with both the bogus ProtectHostnameEx
name and ProtectHostname.

A test is added for ProtectHostnameEx to verify that it is still accepted
for backward compat.

4 months agoshared/bus-unit-util: add helper for ProtectHostnameEx and fix naming confusion
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 15:58:02 +0000 (17:58 +0200)] 
shared/bus-unit-util: add helper for ProtectHostnameEx and fix naming confusion

As with grandparent commit for ImportCredentialEx=, the whole series of commits
that extended ProtectHostname was confused (6746f288548a240148c7c9643e14996bfe960017,
cf48bde7aea52b18ac3fa218d3f60fd3d533ef66e76fcd0e40a6910f4818a374c6a8d854d644ff93),
because it added ProtectHostnameEx in places where parsing of ProtectHostname
should be have been extended.

Accept ProtectHostname=… with the new extended syntax, keep accepting
ProtectHostnameEx=… for compat with release v257. Prefer sending ProtectHostname.

Partially resolves https://github.com/systemd/systemd/issues/37174.

4 months agoshared/bus-unit-util: add a helper function for directory args
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 15:56:02 +0000 (17:56 +0200)] 
shared/bus-unit-util: add a helper function for directory args

4 months agoshared/bus-unit-util: define helper for ExtensionImages=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:23:26 +0000 (14:23 +0200)] 
shared/bus-unit-util: define helper for ExtensionImages=

4 months agoshared/bus-unit-util: define helper for MountImages=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:23:10 +0000 (14:23 +0200)] 
shared/bus-unit-util: define helper for MountImages=

4 months agoshared/bus-unit-util: define helper for RootImageOptions=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:21:43 +0000 (14:21 +0200)] 
shared/bus-unit-util: define helper for RootImageOptions=

4 months agoshared/bus-unit-util: define helper for RootHashSignature=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:20:51 +0000 (14:20 +0200)] 
shared/bus-unit-util: define helper for RootHashSignature=

4 months agoshared/bus-unit-util: define helper for RootHash=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:19:29 +0000 (14:19 +0200)] 
shared/bus-unit-util: define helper for RootHash=

4 months agoshared/bus-unit-util: define helper for TemporaryFileSystem=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:18:31 +0000 (14:18 +0200)] 
shared/bus-unit-util: define helper for TemporaryFileSystem=

4 months agoshared/bus-unit-util: define helper for BindPaths=/BindReadOnlyPaths=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:17:34 +0000 (14:17 +0200)] 
shared/bus-unit-util: define helper for BindPaths=/BindReadOnlyPaths=

4 months agoshared/bus-unit-util: define helper for RestrictNamespaces=/DelegateNamespaces=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:15:46 +0000 (14:15 +0200)] 
shared/bus-unit-util: define helper for RestrictNamespaces=/DelegateNamespaces=

4 months agoshared/bus-unit-util: add helper for filter lists
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 15:54:06 +0000 (17:54 +0200)] 
shared/bus-unit-util: add helper for filter lists

4 months agoshared/bus-unit-util: add helper for NUMAMask=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 15:32:20 +0000 (17:32 +0200)] 
shared/bus-unit-util: add helper for NUMAMask=

4 months agoshared/bus-unit-util: use common helper for NUMAPolicy=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 15:26:54 +0000 (17:26 +0200)] 
shared/bus-unit-util: use common helper for NUMAPolicy=

4 months agoshared/bus-unit-util: define helper for CPUAffinity=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:07:50 +0000 (14:07 +0200)] 
shared/bus-unit-util: define helper for CPUAffinity=

4 months agotree-wide: Add more socket units (#37991)
Lennart Poettering [Thu, 3 Jul 2025 15:43:20 +0000 (17:43 +0200)] 
tree-wide: Add more socket units (#37991)

4 months agotree-wide: Add initrd presets
DaanDeMeyer [Wed, 2 Jul 2025 07:43:30 +0000 (09:43 +0200)] 
tree-wide: Add initrd presets

Currently, when running "systemctl preset-all --root=xxx" in mkosi
to enable/disable units for initrds, the system presets are used.
The problem with this approach is that the system presets are written
for the system, and that is not necessarily ideal for an initrd, but we
still want to use the same packages in the initrd that we install in the
system, so let's introduce a separate directory for initrd presets which
is used to pick up preset files from when we detect that we're configuring
an initrd (by looking for /etc/initrd-release).

We also introduce a systemd preset file for the initrd, which is based on
the system one, except with all the stuff unnecessary for the initrd removed.

4 months agoconf-files: if CONF_FILES_REGULAR|CONF_FILES_DIRECTORY is used together allow either...
Lennart Poettering [Thu, 3 Jul 2025 10:10:55 +0000 (12:10 +0200)] 
conf-files: if CONF_FILES_REGULAR|CONF_FILES_DIRECTORY is used together allow either file or dir

This fixes a a bug introduced by
50c81130b69d04288f50217bede709bac6ca2b1a.

4 months agosd-event: extend comment about a flex member 37790/head
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jun 2025 14:11:17 +0000 (16:11 +0200)] 
sd-event: extend comment about a flex member

Follow-up for dbef4dd4f23517abfc73b35f0bdf004d2f8f4805. Everything that that
commit says is true, but — at least for me — it wasn't obvious why the code is
correct and we can do fixed-size allocations like new(struct inotify_data, 1).

4 months agosd-event: typedef struct inotify_data to InotifyData
Zbigniew Jędrzejewski-Szmek [Sun, 8 Jun 2025 12:01:16 +0000 (14:01 +0200)] 
sd-event: typedef struct inotify_data to InotifyData

4 months agosd-event: typedef struct inode_data to InodeData
Zbigniew Jędrzejewski-Szmek [Sun, 8 Jun 2025 11:52:59 +0000 (13:52 +0200)] 
sd-event: typedef struct inode_data to InodeData

This is an internal definition, so use the usual CamelCase typedef.

4 months agosd-event: make some more bools non-bitfield
Zbigniew Jędrzejewski-Szmek [Sun, 8 Jun 2025 11:41:31 +0000 (13:41 +0200)] 
sd-event: make some more bools non-bitfield

In sd_event_source.child, we have 5 bools. If we make them each take one byte,
the structure size increases. So let's do that for the three of them, and leave
the other two (less frequently used) squished into the last byte. This allows
more efficient code to be generated, without changing the size of the struct:

$ diff -u <(objdump -S build/src/shared/libsystemd-shared-258.so.0|awk '/^static void source_io_unregister/,/^\}/') \
          <(objdump -S build/src/shared/libsystemd-shared-258.so|awk '/^static void source_io_unregister/,/^\}/')

         s->io.registered = false;
-  34d46f:      48 8b 45 d8             mov    -0x28(%rbp),%rax
-  34d473:      0f b6 90 a4 00 00 00    movzbl 0xa4(%rax),%edx
-  34d47a:      83 e2 fe                and    $0xfffffffe,%edx
-  34d47d:      88 90 a4 00 00 00       mov    %dl,0xa4(%rax)
-  34d483:      eb 04                   jmp    34d489 <source_io_unregister+0x1ca>
+  34bffe:      48 8b 45 d8             mov    -0x28(%rbp),%rax
+  34c002:      c6 80 a4 00 00 00 00    movb   $0x0,0xa4(%rax)
+  34c009:      eb 04                   jmp    34c00f <source_io_unregister+0x1be>
                 return;

4 months agosd-event: drop some bitfield specifiers from struct sd_event_source
Zbigniew Jędrzejewski-Szmek [Sun, 8 Jun 2025 11:21:28 +0000 (13:21 +0200)] 
sd-event: drop some bitfield specifiers from struct sd_event_source

This does not change the size of the structure, because the size is determined
by .child, which has a 128-byte siginfo_t field. But by dropping the specifiers
we let the compiler generate code that operates on full bytes instead of having
to play with bitmasks, see second diff below.

Also move the bools in .memory_pressure into a gap to save a few bytes on
initialization.

$ diff -U100 <(pahole build/src/shared/libsystemd-shared-258.so.0 | awk '/struct sd_event_source/,/^}/') \
             <(pahole build/src/shared/libsystemd-shared-258.so | awk '/struct sd_event_source/,/^}/')
--- /proc/self/fd/11 2025-06-08 13:16:55.614738334 +0200
+++ /proc/self/fd/12 2025-06-08 13:16:55.615738386 +0200
@@ -1,109 +1,109 @@
 struct sd_event_source {
  WakeupType                 wakeup;               /*     0     4 */
  unsigned int               n_ref;                /*     4     4 */
  sd_event *                 event;                /*     8     8 */
  void *                     userdata;             /*    16     8 */
  sd_event_handler_t         prepare;              /*    24     8 */
  char *                     description;          /*    32     8 */
  EventSourceType            type;                 /*    40     4 */
        signed int                 enabled:3;            /*    44: 0  4 */
  _Bool                      pending:1;            /*    44: 3  1 */
  _Bool                      dispatching:1;        /*    44: 4  1 */
  _Bool                      floating:1;           /*    44: 5  1 */
  _Bool                      exit_on_failure:1;    /*    44: 6  1 */
  _Bool                      ratelimited:1;        /*    44: 7  1 */

  /* XXX 24 bits hole, try to pack */

  int64_t                    priority;             /*    48     8 */
  unsigned int               pending_index;        /*    56     4 */
  unsigned int               prepare_index;        /*    60     4 */
  /* --- cacheline 1 boundary (64 bytes) --- */
  uint64_t                   pending_iteration;    /*    64     8 */
  uint64_t                   prepare_iteration;    /*    72     8 */
  sd_event_destroy_t         destroy_callback;     /*    80     8 */
  sd_event_handler_t         ratelimit_expire_callback; /*    88     8 */
  sd_event_source *          sources_next;         /*    96     8 */
  sd_event_source *          sources_prev;         /*   104     8 */
  RateLimit                  rate_limit;           /*   112    24 */
  /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
  unsigned int               earliest_index;       /*   136     4 */
  unsigned int               latest_index;         /*   140     4 */
  union {
  struct {
  sd_event_io_handler_t callback;  /*   144     8 */
  int        fd;                   /*   152     4 */
  uint32_t   events;               /*   156     4 */
  uint32_t   revents;              /*   160     4 */
- _Bool      registered:1;         /*   164: 0  1 */
- _Bool      owned:1;              /*   164: 1  1 */
+ _Bool      registered;           /*   164     1 */
+ _Bool      owned;                /*   165     1 */
  } io;                                    /*   144    24 */
  struct {
  sd_event_time_handler_t callback; /*   144     8 */
  usec_t     next;                 /*   152     8 */
  usec_t     accuracy;             /*   160     8 */
  } time;                                  /*   144    24 */
  struct {
  sd_event_signal_handler_t callback; /*   144     8 */
  struct signalfd_siginfo siginfo; /*   152   128 */
  /* --- cacheline 4 boundary (256 bytes) was 24 bytes ago --- */
  int        sig;                  /*   280     4 */
  _Bool      unblock;              /*   284     1 */
  } signal;                                /*   144   144 */
  struct {
  sd_event_child_handler_t callback; /*   144     8 */
  siginfo_t  siginfo;              /*   152   128 */
  /* --- cacheline 4 boundary (256 bytes) was 24 bytes ago --- */
  pid_t      pid;                  /*   280     4 */
  int        options;              /*   284     4 */
  int        pidfd;                /*   288     4 */
  _Bool      registered:1;         /*   292: 0  1 */
  _Bool      pidfd_owned:1;        /*   292: 1  1 */
  _Bool      process_owned:1;      /*   292: 2  1 */
  _Bool      exited:1;             /*   292: 3  1 */
  _Bool      waited:1;             /*   292: 4  1 */
  } child;                                 /*   144   152 */
  struct {
  sd_event_handler_t callback;     /*   144     8 */
  } defer;                                 /*   144     8 */
  struct {
  sd_event_handler_t callback;     /*   144     8 */
  } post;                                  /*   144     8 */
  struct {
  sd_event_handler_t callback;     /*   144     8 */
  unsigned int prioq_index;        /*   152     4 */
  } exit;                                  /*   144    16 */
  struct {
  sd_event_inotify_handler_t callback; /*   144     8 */
  uint32_t   mask;                 /*   152     4 */

  /* XXX 4 bytes hole, try to pack */

  struct inode_data * inode_data;  /*   160     8 */
  sd_event_source * by_inode_data_next; /*   168     8 */
  sd_event_source * by_inode_data_prev; /*   176     8 */
  } inotify;                               /*   144    40 */
  struct {
  int        fd;                   /*   144     4 */
+ _Bool      registered;           /*   148     1 */
+ _Bool      locked;               /*   149     1 */
+ _Bool      in_write_list;        /*   150     1 */

- /* XXX 4 bytes hole, try to pack */
+ /* XXX 1 byte hole, try to pack */

  sd_event_handler_t callback;     /*   152     8 */
  void *     write_buffer;         /*   160     8 */
  size_t     write_buffer_size;    /*   168     8 */
  uint32_t   events;               /*   176     4 */
  uint32_t   revents;              /*   180     4 */
  sd_event_source * write_list_next; /*   184     8 */
  /* --- cacheline 3 boundary (192 bytes) --- */
  sd_event_source * write_list_prev; /*   192     8 */
- _Bool      registered:1;         /*   200: 0  1 */
- _Bool      locked:1;             /*   200: 1  1 */
- _Bool      in_write_list:1;      /*   200: 2  1 */
- } memory_pressure;                       /*   144    64 */
+ } memory_pressure;                       /*   144    56 */
  };                                               /*   144   152 */

  /* size: 296, cachelines: 5, members: 26 */
  /* sum members: 292 */
  /* sum bitfield members: 8 bits, bit holes: 1, sum bit holes: 24 bits */
  /* last cacheline: 40 bytes */
 };

Example diff in assembly:

$ diff -u <(objdump -S build/src/shared/libsystemd-shared-258.so.0|awk '/^static void event_source_time_prioq_reshuffle/,/^\}/') \
          <(objdump -S build/src/shared/libsystemd-shared-258.so|awk '/^static void event_source_time_prioq_reshuffle/,/^\}/')

         d->needs_rearm = true;
-  34d80e:      48 8b 45 f8             mov    -0x8(%rbp),%rax
-  34d812:      0f b6 50 20             movzbl 0x20(%rax),%edx
-  34d816:      83 ca 01                or     $0x1,%edx
-  34d819:      88 50 20                mov    %dl,0x20(%rax)
-  34d81c:      eb 01                   jmp    34d81f <event_source_time_prioq_reshuffle+0x12c>
+  34d7c3:      48 8b 45 f8             mov    -0x8(%rbp),%rax
+  34d7c7:      c6 40 20 01             movb   $0x1,0x20(%rax)
+  34d7cb:      eb 01                   jmp    34d7ce <event_source_time_prioq_reshuffle+0x126>
                 return; /* no-op for an event source which is neither a timer nor ratelimited. */
-  34d81e:      90                      nop
+  34d7cd:      90                      nop

4 months agoci: add test case for building without OpenSSL UI support 38041/head
Yu Watanabe [Thu, 3 Jul 2025 05:39:40 +0000 (14:39 +0900)] 
ci: add test case for building without OpenSSL UI support

4 months agoopenssl-util: allow to build with openssl without UI support
Yu Watanabe [Thu, 3 Jul 2025 01:26:41 +0000 (10:26 +0900)] 
openssl-util: allow to build with openssl without UI support

When OpenSSL is built without UI support, OPENSSL_NO_UI_CONSOLE is
defined. Or, even openssl is built with UI support, people may want to
build systemd without using OpenSSL's UI feature by specifying
-Dc_args='-DOPENSSL_NO_UI_CONSOLE=1'. This adds support for such cases.

Not tested, but hopefully, now systemd can be built with other ssl library,
like BoringSSL, which deos not support UIs.

Closes #38024.

4 months agofd-util: Move O_ACCMODE_STRICT to fd-util.h 38051/head
DaanDeMeyer [Thu, 3 Jul 2025 12:23:16 +0000 (14:23 +0200)] 
fd-util: Move O_ACCMODE_STRICT to fd-util.h

We're still discussing whether we want to remove this or not, but
regardless of whether we end up removing it or not, it's something
we add ourselves and as such should not live in our headers that
override glibc headers, so let's move it to fd-util.h.

4 months agofd-util: Move RAW_O_LARGEFILE definition to fd-util.h
DaanDeMeyer [Thu, 3 Jul 2025 12:17:31 +0000 (14:17 +0200)] 
fd-util: Move RAW_O_LARGEFILE definition to fd-util.h

This is not something that comes from glibc, but which we invent
ourselves. As such, it should not be part of our overrides of glibc
headers, but instead should be part of one of our own headers, so
let's move it to fd-util.h.

Follow up for 194a690181c4857542a094d19f5808f8f4032ed9

4 months agoMove missing_xyz.h for glibc headers to src/basic/include/ (#37960)
Daan De Meyer [Thu, 3 Jul 2025 11:47:46 +0000 (13:47 +0200)] 
Move missing_xyz.h for glibc headers to src/basic/include/ (#37960)

4 months agoresolve: add converters for sshfp key types and algs
Zbigniew Jędrzejewski-Szmek [Thu, 3 Jul 2025 08:11:03 +0000 (10:11 +0200)] 
resolve: add converters for sshfp key types and algs

With the data center move in the Fedora project, the ssh keys have changed.
The list with numerical values is hard to read…

$ resolvectl -t sshfp query pkgs.fedoraproject.org
Old:
pkgs.fedoraproject.org IN SSHFP 1 1 18270c9131ef9664861f5aa675a981146573cce0 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 1 2 b067e6eb4c3e2d0e8bb37d6799493b762131816fe979940bbe660470abe6efbb -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 3 1 a1ad871a5eabe3027728d498a89895fb5bf5b290 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 3 2 c3dc523f99bb5155ec87f40fd1aa198c68f349d75beeccf60e87b44c9b461907 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 4 1 e1265f46012ee40967127e06cf5533b270568428 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP 4 2 acaa1ee6292d01f1ae7881fdf03aaf7d7b0814e34e94c3558a25e4d1aaab8f94 -- link: wlp0s20f3
New:
pkgs.fedoraproject.org IN SSHFP RSA     SHA-1   18270c9131ef9664861f5aa675a981146573cce0 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP RSA     SHA-256 b067e6eb4c3e2d0e8bb37d6799493b762131816fe979940bbe660470abe6efbb -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP ECDSA   SHA-1   a1ad871a5eabe3027728d498a89895fb5bf5b290 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP ECDSA   SHA-256 c3dc523f99bb5155ec87f40fd1aa198c68f349d75beeccf60e87b44c9b461907 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP Ed25519 SHA-1   e1265f46012ee40967127e06cf5533b270568428 -- link: wlp0s20f3
pkgs.fedoraproject.org IN SSHFP Ed25519 SHA-256 acaa1ee6292d01f1ae7881fdf03aaf7d7b0814e34e94c3558a25e4d1aaab8f94 -- link: wlp0s20f3

4 months agofix: UnsetProperty example in systemd.link.xml
Frede Braendstrup [Thu, 3 Jul 2025 07:05:05 +0000 (09:05 +0200)] 
fix: UnsetProperty example in systemd.link.xml

4 months agotest: Add tests for various varlink socket units 37991/head
Daan De Meyer [Mon, 30 Jun 2025 11:41:04 +0000 (13:41 +0200)] 
test: Add tests for various varlink socket units

Let's make sure these socket units work as expected by stopping the
related services and making sure the services are started as expected
when a client connects to the corresponding socket.

4 months agoudev: Fix initializing varlink server from listen fd
Daan De Meyer [Mon, 30 Jun 2025 11:06:46 +0000 (13:06 +0200)] 
udev: Fix initializing varlink server from listen fd

manager_listen_fds() instructs sd_listen_fds_with_names() to unset
the environment which means that when sd_varlink_server_listen_auto()
is called from manager_start_varlink_server(), when it eventually calls
sd_listen_fds_with_names() it will return zero because the environment
has already been unset in manager_listen_fds().

Fix the issue by not using sd_varlink_server_listen_auto() but instead
keeping track of the varlink socket in manager_listen_fds() and returning
it and passing it to manager_start_varlink_server().

4 months agologin: Add varlink socket unit
Daan De Meyer [Fri, 27 Jun 2025 14:18:23 +0000 (16:18 +0200)] 
login: Add varlink socket unit

4 months agologin: Add missing newline between headers
Daan De Meyer [Fri, 27 Jun 2025 14:14:33 +0000 (16:14 +0200)] 
login: Add missing newline between headers

4 months agonetwork: Add varlink socket unit
Daan De Meyer [Fri, 27 Jun 2025 13:08:44 +0000 (15:08 +0200)] 
network: Add varlink socket unit

4 months agotest: allow to run test-local-addresses with IPv6 disabled by default, and assume...
Luca Boccassi [Thu, 3 Jul 2025 08:58:02 +0000 (09:58 +0100)] 
test: allow to run test-local-addresses with IPv6 disabled by default, and assume RTA_VIA is always supported (#38039)

4 months agofuzz: avoid assertion for ExecContext.private_var_tmp triggered
Yu Watanabe [Thu, 3 Jul 2025 05:29:55 +0000 (14:29 +0900)] 
fuzz: avoid assertion for ExecContext.private_var_tmp triggered

Follow-up for 6156bec7a464815084fa5218fe782ea6cb20ad52.

Fixes #38037 and oss-fuzz#429112745.

4 months agoshared/bus-unit-util: define helper for CapabilityBoundingSet=/AmbientCapabilities=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 15:24:53 +0000 (17:24 +0200)] 
shared/bus-unit-util: define helper for CapabilityBoundingSet=/AmbientCapabilities=

4 months agoshared/bus-unit-util: define helper function for rlimits
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 15:06:12 +0000 (17:06 +0200)] 
shared/bus-unit-util: define helper function for rlimits

Strictly speaking, we call startswith twice now. This duplication
shall be eliminated later.

4 months agoshared/bus-unit-util: define helper for StandardInputData=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:06:32 +0000 (14:06 +0200)] 
shared/bus-unit-util: define helper for StandardInputData=

4 months agoshared/bus-unit-util: define helper for StandardInputText=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:06:23 +0000 (14:06 +0200)] 
shared/bus-unit-util: define helper for StandardInputText=

4 months agoshared/bus-unit-util: define helper functions for StandardInput/Output/Error=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 14:55:34 +0000 (16:55 +0200)] 
shared/bus-unit-util: define helper functions for StandardInput/Output/Error=

4 months agoshared/bus-unit-util: define helper for LogFilterPatterns=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:05:04 +0000 (14:05 +0200)] 
shared/bus-unit-util: define helper for LogFilterPatterns=

4 months agoshared/bus-unit-util: define helper for LogExtraFields=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 14:49:41 +0000 (16:49 +0200)] 
shared/bus-unit-util: define helper for LogExtraFields=

4 months agoTEST-54-CREDS: s/ImportCredentialEx/ImportCredential/ except for one place
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 13:48:55 +0000 (15:48 +0200)] 
TEST-54-CREDS: s/ImportCredentialEx/ImportCredential/ except for one place

This is a separate commit because the tests are supposed to pass with both
the old spelling and the new.

4 months agoshared/bus-unit-util: add helper for ImportCredentialEx= and fix naming confusion
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:03:32 +0000 (14:03 +0200)] 
shared/bus-unit-util: add helper for ImportCredentialEx= and fix naming confusion

We add D-Bus properties like "*Ex" because we cannot change the D-Bus property
type without breaking backward comapatibility. But those names are only for
D-Bus, not for config file stanzas or the command-line parser. There, we can
change the type, or in other words, there is no type, just a free-form string
whose interpretation we can extend or change. Commit
831f208783aeac443e6f2fc2efc3119535a032ef that added ProtectHostnameEx was
confused, because it added ImportCredentialEx in places where parsing of
ImportCredential should be have been extended.

On D-Bus, we send ImportCrednential in preference, and ImportCredentialEx only
when required. This way we send less bytes on the wire and support older
systems that don't understand the new property.

Partially resolves https://github.com/systemd/systemd/issues/37174.

4 months agoshared/bus-unit-util: define helper for LoadCredential=/LoadCredentialEncrypted=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:02:56 +0000 (14:02 +0200)] 
shared/bus-unit-util: define helper for LoadCredential=/LoadCredentialEncrypted=

4 months agoshared/bus-unit-util: define helper for SetCredential=/SetCredentialEncrypted=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 12:02:27 +0000 (14:02 +0200)] 
shared/bus-unit-util: define helper for SetCredential=/SetCredentialEncrypted=

4 months agoshared/bus-unit-util: define helper function for EnvironmentFile=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 14:45:49 +0000 (16:45 +0200)] 
shared/bus-unit-util: define helper function for EnvironmentFile=

4 months agoshared/bus-unit-util: add helper for SocketBindAllow=/SocketBindDeny=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 11:58:11 +0000 (13:58 +0200)] 
shared/bus-unit-util: add helper for SocketBindAllow=/SocketBindDeny=

4 months agoshared/bus-unit-util: define helper for BPFProgram=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 11:57:29 +0000 (13:57 +0200)] 
shared/bus-unit-util: define helper for BPFProgram=

4 months agoshared/bus-unit-util: add helper for IPIngressFilterPath=/IPEgressFilterPath=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 14:36:03 +0000 (16:36 +0200)] 
shared/bus-unit-util: add helper for IPIngressFilterPath=/IPEgressFilterPath=

4 months agoshared/bus-unit-util: define helper function for IPAddressAllow=/IPAddressDeny=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 14:18:50 +0000 (16:18 +0200)] 
shared/bus-unit-util: define helper function for IPAddressAllow=/IPAddressDeny=

4 months agoshared/bus-unit-util: define helper for IODeviceLatencyTargetSec=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 11:54:12 +0000 (13:54 +0200)] 
shared/bus-unit-util: define helper for IODeviceLatencyTargetSec=

4 months agoshared/bus-unit-util: define helper for IODeviceWeight=
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 11:53:25 +0000 (13:53 +0200)] 
shared/bus-unit-util: define helper for IODeviceWeight=

4 months agoshared/bus-unit-util: add helper for group io limits
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jun 2025 11:51:47 +0000 (13:51 +0200)] 
shared/bus-unit-util: add helper for group io limits

4 months agoshared/bus-unit-util: define helper for DeviceAllow=
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 14:17:50 +0000 (16:17 +0200)] 
shared/bus-unit-util: define helper for DeviceAllow=

4 months agobasic/cgroup-util: align tables
Zbigniew Jędrzejewski-Szmek [Wed, 18 Jun 2025 13:58:22 +0000 (15:58 +0200)] 
basic/cgroup-util: align tables