Commit Graph

85691 Commits

Author SHA1 Message Date
Frantisek Sumsal
cbc55895fb man: fix short option for userdbctl's --from-file=
(cherry picked from commit ad1c7df5f9)
2026-03-12 09:40:48 +01:00
Frantisek Sumsal
e7a95f3bd2 shared: don't leak memory from array fields
The fido2_hmac_salt/fido2_hmac_credential/recovery_key fields kept
leaking memory as the array itself wasn't deallocated after deallocating
each of its elements data:

$ build-san/userdbctl -F fuzz-corpus-userdb/auth-fido2.json
...
=================================================================
==1292840==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7f56f00e5e4b in realloc.part.0 (/lib64/libasan.so.8+0xe5e4b) (BuildId: 25975f766867e9e604dc5a71a8befeaed3301942)
    #1 0x7f56ed869e42 in greedy_realloc ../src/basic/alloc-util.c:65
    #2 0x7f56ed7ff5e9 in dispatch_fido2_hmac_salt ../src/shared/user-record.c:836
    #3 0x7f56edd73cbc in sd_json_dispatch_full ../src/libsystemd/sd-json/sd-json.c:5204
    #4 0x7f56edd745fc in sd_json_dispatch ../src/libsystemd/sd-json/sd-json.c:5276
    #5 0x7f56ed80100b in dispatch_privileged ../src/shared/user-record.c:998
    #6 0x7f56edd73cbc in sd_json_dispatch_full ../src/libsystemd/sd-json/sd-json.c:5204
    #7 0x7f56edd745fc in sd_json_dispatch ../src/libsystemd/sd-json/sd-json.c:5276
    #8 0x7f56ed80622c in user_record_load ../src/shared/user-record.c:1697
    #9 0x000000408c15 in display_user ../src/userdb/userdbctl.c:447
    #10 0x7f56ed83cc9a in dispatch_verb ../src/shared/verbs.c:137
    #11 0x00000041df2b in run ../src/userdb/userdbctl.c:1908
    #12 0x00000041dfbe in main ../src/userdb/userdbctl.c:1911
    #13 0x7f56ec8105b4 in __libc_start_call_main (/lib64/libc.so.6+0x35b4) (BuildId: 2b5beec0fd24fe9c9f43eddfdd5facf0b8a1b805)
    #14 0x7f56ec810667 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x3667) (BuildId: 2b5beec0fd24fe9c9f43eddfdd5facf0b8a1b805)
    #15 0x000000404a44 in _start (/home/fsumsal/repos/@systemd/systemd/build-san/userdbctl+0x404a44) (BuildId: 19e8b7e7b7038d2cea20bc18a55bea2a9e4406d5)

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f56f00e5e4b in realloc.part.0 (/lib64/libasan.so.8+0xe5e4b) (BuildId: 25975f766867e9e604dc5a71a8befeaed3301942)
    #1 0x7f56ed869e42 in greedy_realloc ../src/basic/alloc-util.c:65
    #2 0x7f56ed7fe779 in dispatch_fido2_hmac_credential_array ../src/shared/user-record.c:775
    #3 0x7f56edd73cbc in sd_json_dispatch_full ../src/libsystemd/sd-json/sd-json.c:5204
    #4 0x7f56edd745fc in sd_json_dispatch ../src/libsystemd/sd-json/sd-json.c:5276
    #5 0x7f56ed80622c in user_record_load ../src/shared/user-record.c:1697
    #6 0x000000408c15 in display_user ../src/userdb/userdbctl.c:447
    #7 0x7f56ed83cc9a in dispatch_verb ../src/shared/verbs.c:137
    #8 0x00000041df2b in run ../src/userdb/userdbctl.c:1908
    #9 0x00000041dfbe in main ../src/userdb/userdbctl.c:1911
    #10 0x7f56ec8105b4 in __libc_start_call_main (/lib64/libc.so.6+0x35b4) (BuildId: 2b5beec0fd24fe9c9f43eddfdd5facf0b8a1b805)
    #11 0x7f56ec810667 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x3667) (BuildId: 2b5beec0fd24fe9c9f43eddfdd5facf0b8a1b805)
    #12 0x000000404a44 in _start (/home/fsumsal/repos/@systemd/systemd/build-san/userdbctl+0x404a44) (BuildId: 19e8b7e7b7038d2cea20bc18a55bea2a9e4406d5)

SUMMARY: AddressSanitizer: 176 byte(s) leaked in 2 allocation(s).
(cherry picked from commit 3c7bd947b2)
2026-03-12 09:40:48 +01:00
Frantisek Sumsal
0a3a2ecd69 shared: don't exclude valid min/max values for cgroup weight fields
1 and 10000 are valid cgroup weight values, but the condition was
incorrectly excluding them:

$ echo '{"userName":"crashhostarray","cpuWeight":1}' | userdbctl -F -
<stdin>:1:42: JSON field 'cpuWeight' is not in valid range 1…10000.

$ echo '{"userName":"crashhostarray","cpuWeight":10000}' | userdbctl -F -
<stdin>:1:42: JSON field 'cpuWeight' is not in valid range 1…10000.

(cherry picked from commit 76ab7861ff)
2026-03-12 09:40:48 +01:00
Frantisek Sumsal
818f251e38 shared: fix segfault when processing matchHostname field
Fix a typo which causes a segfault when processing a user record
with matchHostname when it's an array instead of a simple string:

$ echo '{"userName":"crashhostarray","perMachine":[{"matchHostname":["host1","host2"],"locked":false}]}' | userdbctl -F -
Segmentation fault         (core dumped)

$ coredumpctl info
...
       Message: Process 1172301 (userdbctl) of user 1000 dumped core.

                Module libz.so.1 from rpm zlib-ng-2.3.3-1.fc43.x86_64
                Module libcrypto.so.3 from rpm openssl-3.5.4-2.fc43.x86_64
                Stack trace of thread 1172301:
                #0  0x00007fded7b3a656 __strcmp_evex (libc.so.6 + 0x159656)
                #1  0x00007fded7e95397 per_machine_hostname_match (libsystemd-shared-260.so + 0x295397)
                #2  0x00007fded7e955b5 per_machine_match (libsystemd-shared-260.so + 0x2955b5)
                #3  0x00007fded7e957c6 dispatch_per_machine (libsystemd-shared-260.so + 0x2957c6)
                #4  0x00007fded7e96c97 user_record_load (libsystemd-shared-260.so + 0x296c97)
                #5  0x000000000040572d display_user (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x572d)
                #6  0x00007fded7ea9727 dispatch_verb (libsystemd-shared-260.so + 0x2a9727)
                #7  0x000000000041077c run (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x1077c)
                #8  0x00000000004107ce main (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x107ce)
                #9  0x00007fded79e45b5 __libc_start_call_main (libc.so.6 + 0x35b5)
                #10 0x00007fded79e4668 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x3668)
                #11 0x00000000004038d5 _start (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x38d5)
                ELF object binary architecture: AMD x86-64

(cherry picked from commit 1e2517bf2e)
2026-03-12 09:40:48 +01:00
Lennart Poettering
2d0cccc707 sd-varlink: pin error message while we invoke a reply callback
Let's make sure the parameters/error pointers into the message remain
valid as long as the reply callback is running, even if the reply
otherwise resets the pending message.

(cherry picked from commit dfb1fa0197)
2026-03-12 09:40:48 +01:00
Antonio Alvarez Feijoo
f96cf5326b mkosi/opensuse: fix package name systemd-network -> systemd-networkd
```
'systemd-network' not found in package names. Trying capabilities.
```

Follow-up for 00f7afebb4

(cherry picked from commit 4ef56f30b8)
2026-03-12 09:40:48 +01:00
Ronan Pigott
a7f1bdc59f zsh: fixup some recent zsh completers
These two completers are written in a stacked _arguments style, and some
generic options are valid before or after the verb. If the toplevel
_arguments is permitted to match options after the verb, it will halt
completion prematurely, so stop toplevel matching after the verb.

This corrects the following error:

$ userdbctl --output=class user <TAB> # completes users
$ userdbctl user --output=class <TAB> # completes nothing

(cherry picked from commit 0fc5c9ef2e)
2026-03-12 09:40:48 +01:00
Fergus Dall
e0b72366e8 pcrlock: Record predictions at start of component range
Currently pcrlock won't predict PCR values that would be present at the start
of the requested location range (unless there are no events for that PCR in the
location range). This means predictions for the default range 760:940, which is
intended to start just after entering the initrd, are not actually possible to
fulfill until after the initrd is exited (or possibly even later, depending on
what other events are recorded).

Fix this by recording predictions immediately prior to processing components
after the start point.

Fixes #39946

(cherry picked from commit d73dc51fbd)
2026-03-12 09:40:48 +01:00
Yu Watanabe
c812e22a46 gitignore: ignore new default mkosi tools directories
The default place has been changed since
e9abfab744

(cherry picked from commit 3e5a865c3f)
2026-03-12 09:40:48 +01:00
Hans de Goede
ea75da4860 boot: Make missing CHID DTB match a debug message instead of an error
With distributions like Ubuntu and Fedora using systemd-stub to auto load
DTB's on Windows on ARM laptops, the CHID DTB match failing is expected
when that same UKI is instead booted on an ARM SystemReady system where
no DTB is necessary.

In the ARM SystemReady case showing a big red error message is undesirable
and leads to confused users and bug-reports. Lower the message to debug
level when the status is EFI_NOT_FOUND to avoid these false positive error
messages.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2444759
(cherry picked from commit f8ed94ea99)
2026-03-12 09:40:48 +01:00
Frantisek Sumsal
4a121481ab core: drop unused errno from debug message
And properly guard unset parameters.

(cherry picked from commit ab73333c43)
2026-03-12 09:40:48 +01:00
Michal Sekletar
22e3662111 core: cleanup unit's dropin directories from global cache
When user creates dropin files via API (e.g. systemctl set-property ...)
we put the dropin directory path into unit_path_cache. Drop those
directories from the cache in unit_free() and prevent memory leak.

Follow-up for fce94c5c56.

(cherry picked from commit 0c98e432d1)
2026-03-12 09:40:48 +01:00
Luca Boccassi
eea418091d man: clarify requirements around creds null sealing
(cherry picked from commit 240675efeb)
2026-03-12 09:40:48 +01:00
Mike Yuan
1a2346a187 machine-dbus: do not check for overlapping condition
Follow-up for c5e48e3a66

This also makes things in line with the varlink method.

(cherry picked from commit e8c542981b)
2026-03-12 09:40:48 +01:00
Mike Yuan
63ce6e0739 shared/acpi-fpdt: set _packed_ attr properly
We were declaring a variable named _packed...

(cherry picked from commit 11f06ab768)
2026-03-12 09:40:48 +01:00
Lennart Poettering
d13ec7a56b udevadm: fix --help text for udevadm test-builtin
(cherry picked from commit 59a9d1d8ca)
2026-03-12 09:40:48 +01:00
Lennart Poettering
12726a8117 sd-messages: fix typo
(This was introduced in v260, i.e. not yet released, hence not API
break)

(cherry picked from commit acd23fc491)
2026-03-12 09:40:48 +01:00
Bouke van der Bijl
5ea63d6dbe man: fix typo in docs for notify-ready option
(cherry picked from commit 166e62215f)
2026-03-12 09:40:48 +01:00
Eisuke Kawashima
5ae4ded078 shell-completion: update run0 completion
(cherry picked from commit 4bdfcc2ee2)
2026-03-12 09:40:48 +01:00
Kai Lüke
6f8aa4fbfc meson: Work around Meson install_subdir limitation
When install_subdir encounters a mkosi.tools tree with a /bin to
/usr/bin symlink it fails to copy it because it dereferences but still
treats it like a file.
Work around the Meson bug by excluding the mkosi.tools tree from
installation like mkosi.local is excluded. We anyway don't want the
tools tree end up there.

(cherry picked from commit 1f0bc341c5)
2026-03-12 09:40:48 +01:00
noxiouz
e14e206f97 network: fix LLDP field type in Interface Varlink IDL
sd_lldp_tx_describe() returns a single object (the LLDP TX configuration),
but the IDL declared LLDP as SD_VARLINK_ARRAY|SD_VARLINK_NULLABLE. This
caused server-side validation failures ("Field 'LLDP' should be an array,
but it is of type 'object'") whenever networkctl status was called on an
interface with LLDP TX active.

Also fix the field comment: the LLDP field represents the transmit
configuration, not received neighbors.

Follow-up for dd2934d44e.

(cherry picked from commit 8d421c0870)
2026-03-12 09:40:48 +01:00
Frantisek Sumsal
085e66276c nspawn: actually mask certain files under /proc/
/run/systemd/inaccessible/ exists only on host - in the container we have
/run/host/inaccessible/, and since all the inaccessible mounts have
MOUNT_IN_USERNS we need to use the latter one, otherwise the masking
gets silently skipped:

~# SYSTEMD_LOG_LEVEL=debug systemd-nspawn -q --directory=foo ls -la /proc/kallsyms
...
Bind-mounting /run/systemd/inaccessible/reg on /proc/kallsyms (MS_BIND "")...
Failed to mount /run/systemd/inaccessible/reg (type n/a) on /proc/kallsyms (MS_BIND ""): No such file or directory
Changing mount flags /proc/kallsyms (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_REMOUNT|MS_BIND "")...
Failed to mount n/a (type n/a) on /proc/kallsyms (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_REMOUNT|MS_BIND ""): Invalid argument
Bind-mounting /run/systemd/inaccessible/reg on /proc/kcore (MS_BIND "")...
Failed to mount /run/systemd/inaccessible/reg (type n/a) on /proc/kcore (MS_BIND ""): No such file or directory
Changing mount flags /proc/kcore (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_REMOUNT|MS_BIND "")...
Failed to mount n/a (type n/a) on /proc/kcore (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_REMOUNT|MS_BIND ""): Invalid argument
...
Inner child finished, invoking payload.
-r--r--r--. 1 root root 0 Feb 25 13:19 /proc/kallsyms

(cherry picked from commit 83b8daa032)
2026-03-12 09:40:48 +01:00
Skye Soss
f2d81cbe9b network: add DHCPv6 message types to string table (#40912)
Adds the DHCPv6 message types ADDR-REG-INFORM and
ADDR-REG-REPLY to the DHCPv6 message types string table.

Follow-up for 1e55da38aa.

(cherry picked from commit 13db63e920)
2026-03-12 09:40:48 +01:00
Lennart Poettering
f54a88b7bc journal-remote: fix error number confusion
See: https://lists.freedesktop.org/archives/systemd-devel/2026-February/051924.html
(cherry picked from commit 8b3d3d6d67)
2026-03-12 09:40:48 +01:00
noxiouz
dd8cfc5b72 login: add missing NoSessionPIDFD error to io.systemd.Login IDL
The error is emitted by vl_method_create_session() when the session leader
process does not have a pidfd available, but was never declared in the IDL.

Fixes: 3180c4d461
(cherry picked from commit 3d54a40dae)
2026-03-12 09:40:48 +01:00
noxiouz
f9dcdcfc1e login: fix ReleaseSession.Id dispatch flag in io.systemd.Login Varlink handler
The ReleaseSession method's Id field is declared as nullable (?string) in
the IDL, allowing callers to omit it so that the method releases the
caller's own session via session_is_self(NULL). The SD_JSON_MANDATORY flag
in the dispatch table contradicts this and makes omitting Id return -EINVAL
("Invalid argument", parameter "Id") instead.

Drop the flag so omitting Id is treated as passing NULL.

Fixes: 2baca6c22b
(cherry picked from commit 3eacf0d321)
2026-03-12 09:40:48 +01:00
Thomas Weißschuh
036749bc88 nspawn: allow cachestat systemcall
cachestat(2) is essentially a better variant of mincore(2).
As mincore(2) is already allowed, also allow cachestat(2).

(cherry picked from commit 93101e7ef0)
2026-03-12 09:40:48 +01:00
Mike Yuan
50c963fb33 pidref: do not tamper with pidref_acquire_pidfd_id() retval
If a pidfd id is passed to us, it must have originated from
somewhere, i.e. pidfs should be supported on the system.
Hence let's be honest about -EOPNOTSUPP, which might indicate
some bigger problems under the hood, rather than allowing
it to be turned into mild -ESRCH.

(cherry picked from commit a12a4bdc9a)
2026-03-12 09:40:48 +01:00
Ronan Pigott
9d8570f9ac zsh: add systemd-id128 completions
(cherry picked from commit 8d720dea86)
2026-03-12 09:40:48 +01:00
Anton Tiurin
bf5b8be11b resolved: use DNS_TYPE_DNSKEY for trust anchor support (#40850)
Fix typo: DNS_TYPE_DNSKEY should be used instead of DNS_TYPE_KEY.
- DNS_TYPE_KEY is deprecated
- Source code at resolved-dns-trust-anchor.c#L313 handles
DNS_TYPE_DNSKEY records, but not DNS_TYPE_KEY
So DNS_TYPE_KEY is not referenced anywhere

(cherry picked from commit ce1361d7b3)
2026-03-12 09:40:48 +01:00
Anton Tiurin
92d46f31ec resolve: add missing ServiceNotProvided error to Varlink IDL (#40858)
The error is emitted by `vl_method_resolve_service_complete()` when an
SRV record with a root domain hostname is found, indicating the service
is explicitly not offered on the queried domain (RFC 2782 Usage Rules),

but was not declared in the `io.systemd.Resolve` interface definition.

Follow-up for 3d8f2c1464.

(cherry picked from commit 2506a57bca)
2026-03-12 09:40:48 +01:00
Mike Yuan
714a5c7b49 core/exec-invoke: drop duplicate addition of handoff_timestamp_fd to dont_close array
Follow-up for 12001b1bf0

It is part of the keep_fds array already, which is intended
for fds that need to survive until the very end of executor
runtime, i.e. across the second close_all_fds() call.

(cherry picked from commit f2e7ba1074)
2026-03-12 09:40:48 +01:00
Mike Yuan
c2a3a97c70 core/exec-invoke: correct size for dont_close array in close_remaining_fds()
Follow-up for 79dd24cf14

(cherry picked from commit 0aa70bef5e)
2026-03-12 09:40:48 +01:00
Mike Yuan
94aaf20e49 core/exec-invoke: fix potential double close of socket/bpffs fds on failure
The owned fds should be closed before close_all_fds() along the lines
of exec_params/runtime_close(), otherwise they would be left dangling
afterwards.

(cherry picked from commit ec93edc4ca)
2026-03-12 09:40:48 +01:00
Vitaly Kuznetsov
0b4f049ecc cryptsetup-tokens: Print tpm2-primary-alg: only when it is known
When 'tpm2-primary-alg' is missing in LUKS JSON token, the output of
'cryptsetup luksDump' is always:

	tpm2-primary-alg: ecc

because tpm2_parse_luks2_json() returns the default (TPM2_ALG_ECC). This can be
misleading and wrong. Make tpm2_parse_luks2_json() return the reality and move
the default to tpm2_unseal().

(cherry picked from commit 4883ef8aae)
2026-03-12 09:40:48 +01:00
Vitaly Kuznetsov
2e2b25e66c cryptenroll: Save primary algorithm type to the LUKS token
'tpm2-primary-alg' field is currently unset in LUKS JSON token both for the
case when SRK was used for enrolling (--tpm2-device-key=) and for the case when
SRK was obtained/generated (--tpm2-device=). While this information is not
really needed for unsealing (the sealed object itself has key type in it), it
may be convenient to see key type in e.g. 'cryptsetup luksDump' in the
situations where key type matters. Since 'tpm2-primary-alg' is already defined,
just set it properly in all cases.

(cherry picked from commit 295affa3f7)
2026-03-12 09:40:48 +01:00
Val Markovic
7b1ea2374a man: improve documentation for RestartSteps (#40879)
I found the existing explanation of RestartSteps to be simply
impenetrable. Even providing the full docs context to several of our new
AI overlords resulted in wildly different (and completely incorrect)
explanations of the final restart intervals.

Digging through the code, I found the restart delay computation in
`service_restart_usec_next` in `src/core/service.c`.

I've updated the documentation for RestartSteps with an example,
suggested value range and a detailed enough explanation that accurately
describes the current behavior.

(cherry picked from commit 4724cf5526)
2026-03-12 09:40:48 +01:00
Ronan Pigott
ba7247e37c zsh: add userdbctl completion
(cherry picked from commit ac4a7a66bd)
2026-03-12 09:40:48 +01:00
Weixie Cui
3c7ea0cf9f fix: check error with -ENOMEDIUM not ENOMEDIUM
Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
(cherry picked from commit 4980bd05b1)
2026-03-12 09:40:48 +01:00
Mike Yuan
1a3ee1b46e tmpfiles: downgrade log level for non-existent symlink target
I'm seeing a *lot* of noise induced by missing varlink sockets
under /run/host/ after 3363693935.

(cherry picked from commit 476d0d7643)
2026-03-12 09:40:48 +01:00
Mike Yuan
13067479fb tmpfiles: fix doubled "/" in root + path logging
(cherry picked from commit b1c6bcf949)
2026-03-12 09:40:48 +01:00
noxiouz
ca7dc4850c shared: fix comment typos in Udev and AskPassword Varlink IDL
(cherry picked from commit 37b8cd71cd)
2026-03-12 09:40:48 +01:00
noxiouz
50219df07c mountfsd: include imageName in MountImage Varlink reply
(cherry picked from commit 54796ea3b2)
2026-03-12 09:40:48 +01:00
noxiouz
86586394fc import: fix AlreadyInProgress Varlink error missing remote field
The handler sends the remote URL as a parameter via sd_varlink_errorbo()
but the IDL declared the error with no fields, making the payload
undiscoverable via introspection.

(cherry picked from commit c22a131e74)
2026-03-12 09:40:48 +01:00
noxiouz
e9583f61ed hostname: fix OperatingSystemImageID/Version Varlink IDL
Both fields are populated from IMAGE_ID/IMAGE_VERSION in os-release,
which are plain strings.

Fix typo in include.

(cherry picked from commit 56d44e8a02)
2026-03-12 09:40:48 +01:00
Lennart Poettering
63ba0f4814 tpm2-setup: make NV index space exhaustion issues more discoverable
Let's log about this explicitly, and include a message catalog entry for
it.

(cherry picked from commit ac8266c7c2)
2026-03-12 09:40:48 +01:00
Lennart Poettering
d2af006db4 tpm2-util: fix log level of one log call
(cherry picked from commit a01912ef29)
2026-03-12 09:40:48 +01:00
Zbigniew Jędrzejewski-Szmek
75e3ac107d hwdb: update to main@{2026-02-26}
The change from ID_INPUT_JOYSTICK_INTEGRATION to ID_INTEGRATION was
excluded.

git restore -s origin/main hwdb.d/ test/hwdb.d && \
  git commit … &&
  git revert e0684a9abc &&
  git revert 3da9b65b30 (partially)
2026-03-10 19:24:17 +00:00
Luca Boccassi
32bc9ae9f5 meson: bump version to 259.3 v259.3 2026-03-04 13:21:03 +00:00
Luca Boccassi
90b7cb95d6 machined: do not allow unprivileged users to shell into the root namespace via varlink
Forbid non-root from shelling into a machine that is running in
the root user namespace.

Follow-up for adaff8eb35

(cherry picked from commit e5a5656b55)
2026-03-04 13:20:49 +00:00