]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
61 min agohwdb: Add extended SteelSeries Arctis headset device support (#41628) main
Sriman Achanta [Tue, 14 Apr 2026 00:08:30 +0000 (20:08 -0400)] 
hwdb: Add extended SteelSeries Arctis headset device support (#41628)

Add USB device IDs for additional SteelSeries Arctis headset models to
the sound card hardware database.

Newly added device IDs:

- Arctis Nova 7x v2 (22AD)
- Arctis Nova 7 Diablo IV (22A9)
- Arctis Nova 7X (22A4)
- Arctis Nova 7X (22A5)
- Arctis Nova 7P V2 (22A7)

7 hours agovmspawn: Support RUNTIME_DIRECTORY again (#41619)
Christian Brauner [Mon, 13 Apr 2026 17:46:55 +0000 (19:46 +0200)] 
vmspawn: Support RUNTIME_DIRECTORY again (#41619)

In ccecae0efd ("vmspawn: use machine name in runtime directory path")
support for RUNTIME_DIRECTORY was dropped which makes it difficult to
run systemd-vmspawn in a service unit which doesn't have write access to
the regular /run but should use its own managed RUNTIME_DIRECTORY. What
worked before was --keep-unit --system but we can't use XDG_RUNTIME_DIR
and --user because then --keep-unit breaks which we need because it
can't create a scope as there is no session. Switch back to
runtime_directory which handles RUNTIME_DIRECTORY and tells us whether
we should use it as is without later cleanup or if we need to use the
regular path where we create and delete the directory ourselves.

9 hours agodocs: fix capability name, it's CAP_MKNOD not CAP_SYS_MKNOD (#41621)
rusty-snake [Mon, 13 Apr 2026 15:41:33 +0000 (17:41 +0200)] 
docs: fix capability name, it's CAP_MKNOD not CAP_SYS_MKNOD (#41621)

9 hours agoci: Two claude-review fixes
Daan De Meyer [Mon, 13 Apr 2026 14:27:10 +0000 (16:27 +0200)] 
ci: Two claude-review fixes

- Use persist-credentials: false for actions/checkout, so we don't
  leak the github token credentials to subsequent jobs.
- Remove one / from the Edit/Write permissions. Currently, with the
  absolute path from github.workspace, we expand to three slashes while
  we only need two.

12 hours agovmspawn: Support RUNTIME_DIRECTORY again 41619/head
Kai Lüke [Mon, 13 Apr 2026 12:21:39 +0000 (21:21 +0900)] 
vmspawn: Support RUNTIME_DIRECTORY again

In ccecae0efd ("vmspawn: use machine name in runtime directory path")
support for RUNTIME_DIRECTORY was dropped which makes it difficult to
run systemd-vmspawn in a service unit which doesn't have write access
to the regular /run but should use its own managed RUNTIME_DIRECTORY.
What worked before was --keep-unit --system but we can't use
XDG_RUNTIME_DIR and --user because then --keep-unit breaks which
we need because it can't create a scope as there is no session.
Switch back to runtime_directory which handles RUNTIME_DIRECTORY and
tells us whether we should use it as is without later cleanup or if we
need to use the regular path where we create and delete the directory
ourselves.

13 hours agomany: final final set of coccinelle check-pointer-deref tweaks (#41595)
Zbigniew Jędrzejewski-Szmek [Mon, 13 Apr 2026 11:59:24 +0000 (13:59 +0200)] 
many: final final set of coccinelle check-pointer-deref tweaks (#41595)

I promised in https://github.com/systemd/systemd/pull/41426 that its the
final update for coccinelle pointer deref checks. However it turned out
there is this coccinelle/parsing_hacks.h that I wasn't aware of. The
file missed some important things like _cleanup_(x) that prevented
coccinelle to check a bunch of functions.

This PR adds some missing defines to the parsing_hacks.h and fixes the
missing asserts(). I apologize that its a bit long (and frankly boring)
and that I missed this earlier.

The last commit contains one small behavior change (ret in
sd_varlink_idl_parse() is now really optional) but the big one is very
mechanical.

13 hours agostat-util: use stat_verify_xyz() and friends more (#41613)
Lennart Poettering [Mon, 13 Apr 2026 11:39:47 +0000 (13:39 +0200)] 
stat-util: use stat_verify_xyz() and friends more (#41613)

13 hours agorun: allow setting output format
Arnout Engelen [Mon, 6 Apr 2026 08:00:37 +0000 (10:00 +0200)] 
run: allow setting output format

This is useful when moving from `--pty` or `--pipe` to using
`--verbose`: you can use `--verbose-output=cat` to get similar output on
stdout while still having all of the advantages of `--verbose` over the
other options.

13 hours agostat-util: always check S_ISDIR() before S_ISLNK() 41613/head
Lennart Poettering [Mon, 13 Apr 2026 11:14:46 +0000 (13:14 +0200)] 
stat-util: always check S_ISDIR() before S_ISLNK()

Check S_ISDIR() before S_ISLINK() for all stat_verify_xyz() helpers
first, where we check them. Just to ensure we systematically return the
same errors.

13 hours agostat-util: also add stat_verify_char() and use it everywhere
Lennart Poettering [Mon, 13 Apr 2026 09:20:57 +0000 (11:20 +0200)] 
stat-util: also add stat_verify_char() and use it everywhere

13 hours agosocket-netlink: use stat_verify_socket() more
Lennart Poettering [Mon, 13 Apr 2026 09:10:36 +0000 (11:10 +0200)] 
socket-netlink: use stat_verify_socket() more

13 hours agotree-wide: use stat_verify_directory() more
Lennart Poettering [Mon, 13 Apr 2026 09:10:03 +0000 (11:10 +0200)] 
tree-wide: use stat_verify_directory() more

13 hours agotree-wide: use stat_verify_regular() more
Lennart Poettering [Mon, 13 Apr 2026 09:09:25 +0000 (11:09 +0200)] 
tree-wide: use stat_verify_regular() more

13 hours agostat-util: also introduce stat_verify_block() and use it everywhere
Lennart Poettering [Mon, 13 Apr 2026 08:45:29 +0000 (10:45 +0200)] 
stat-util: also introduce stat_verify_block() and use it everywhere

13 hours agostat-util: add shortcut for fd_verify_symlink()
Lennart Poettering [Mon, 13 Apr 2026 08:41:01 +0000 (10:41 +0200)] 
stat-util: add shortcut for fd_verify_symlink()

We have a similar shortcut in the other fd_verify_xyz() calls, let's add
it here too, just for completion's sake.

13 hours agotree-wide: make more use of stat_verify_device_node()
Lennart Poettering [Mon, 13 Apr 2026 08:28:54 +0000 (10:28 +0200)] 
tree-wide: make more use of stat_verify_device_node()

13 hours agostat-util: introduce a common (stat|fd)_verify_regular_or_block() helper
Lennart Poettering [Mon, 13 Apr 2026 08:26:36 +0000 (10:26 +0200)] 
stat-util: introduce a common (stat|fd)_verify_regular_or_block() helper

We already had one in repart.c, let's generalize it, and use it
everywhere.

14 hours agoboot: fix loop bound and OOB in devicetree_get_compatible()
Milan Kyselica [Sat, 11 Apr 2026 08:26:13 +0000 (10:26 +0200)] 
boot: fix loop bound and OOB in devicetree_get_compatible()

The loop used the byte offset end (struct_off + struct_size) as the
iteration limit, but cursor[i] indexes uint32_t words. This reads
past the struct block when end > size_words.

Use size_words (struct_size / sizeof(uint32_t)) which is the correct
number of words to iterate over.

Also fix a pre-existing OOB in the FDT_BEGIN_NODE handler: the guard
i >= size_words is always false inside the loop (since the loop
condition already ensures i < size_words), so cursor[++i] at the
boundary reads one word past the struct block. Use i + 1 >= size_words
to check before incrementing.

Fixes: https://github.com/systemd/systemd/issues/41590
14 hours agoboot: fix integer overflow and division by zero in BMP splash parser
Milan Kyselica [Sat, 11 Apr 2026 08:25:19 +0000 (10:25 +0200)] 
boot: fix integer overflow and division by zero in BMP splash parser

Bound image dimensions before computing row_size to prevent overflow
in the depth * x multiplication on 32-bit. Without this, crafted
dimensions like depth=32 x=0x10000001 wrap to a small row_size that
passes all subsequent checks.

Reject channel masks where all bits are set (popcount == 32), since
1U << 32 is undefined behavior and causes division by zero on
architectures where it evaluates to zero. Move the validation before
computing derived values for clarity. Use unsigned 1U in shifts to
avoid signed integer overflow UB for popcount == 31.

Also reject zero-width and zero-height images.

Fixes: https://github.com/systemd/systemd/issues/41589
15 hours agocore: use JSON_BUILD_CONST_STRING() where appropriate
Lennart Poettering [Mon, 13 Apr 2026 08:29:11 +0000 (10:29 +0200)] 
core: use JSON_BUILD_CONST_STRING() where appropriate

15 hours agojournal: limit decompress_blob() output to DATA_SIZE_MAX (#41604)
Zbigniew Jędrzejewski-Szmek [Mon, 13 Apr 2026 10:02:11 +0000 (12:02 +0200)] 
journal: limit decompress_blob() output to DATA_SIZE_MAX (#41604)

We already have checks in place during compression that limit the data
we compress, so they shouldn't decompress to anything larger than
DATA_SIZE_MAX unless they've been tampered with. Let's make this
explicit and limit all our decompress_blob() calls in journal-handling
code to that limit.

One possible scenario this should prevent is when one tries to open and
verify a journal file that contains a compression bomb in its payload:

```
$ ls -lh test.journal
-rw-rw-r--+ 1 fsumsal fsumsal 1.2M Apr 12 15:07 test.journal

$ systemd-run --user --wait --pipe -- build-local/journalctl --verify --file=$PWD/test.journal
Running as unit: run-p682422-i4875779.service
000110: Invalid hash (00000000 vs. 11e4948d73bdafdd)
000110: Invalid object contents: Bad message
File corruption detected at /home/fsumsal/repos/@systemd/systemd/test.journal:272 (of 1249896 bytes, 0%).
FAIL: /home/fsumsal/repos/@systemd/systemd/test.journal (Bad message)
          Finished with result: exit-code
Main processes terminated with: code=exited, status=1/FAILURE
               Service runtime: 48.051s
             CPU time consumed: 47.941s
                   Memory peak: 8G (swap: 0B)
```
Same could be, in theory, possible with just `journalctl --file=`, but
the reproducer would be a bit more complicated (haven't tried it, yet).

Lastly, the change in journal-remote is mostly hardening, as the maximum
input size to decompress_blob() there is mandated by MHD's connection
memory limit (set to JOURNAL_SERVER_MEMORY_MAX which is 128 KiB at the
time of writing), so the possible output size there is already quite
limited (e.g. ~800 - 900 MiB for xz-compressed data).

15 hours agoudev/scsi-id: hardening against malformed kernel data (#41585)
Zbigniew Jędrzejewski-Szmek [Mon, 13 Apr 2026 09:53:43 +0000 (11:53 +0200)] 
udev/scsi-id: hardening against malformed kernel data (#41585)

15 hours agonspawn: Add --restrict-address-families= option
Daan De Meyer [Mon, 22 Dec 2025 10:22:34 +0000 (11:22 +0100)] 
nspawn: Add --restrict-address-families= option

Add a new --restrict-address-families= command line option and
corresponding RestrictAddressFamilies= setting for .nspawn files to
restrict which socket address families may be used inside a container.

Many address families such as AF_VSOCK and AF_NETLINK are not
network-namespaced, so restricting access to them in containers
improves isolation. The option supports allowlist and denylist modes
(via ~ prefix), as well as "none" to block all families, matching the
semantics of RestrictAddressFamilies= in unit files.

The address family parsing logic is extracted into a shared
parse_address_families() helper in parse-helpers.c, which is now also
used by config_parse_address_families() in load-fragment.c.

This is currently opt-in. In a future version, the default will be
changed to restrict address families to AF_INET, AF_INET6 and AF_UNIX.

15 hours agomkosi: Drop kexec-tools
Daan De Meyer [Fri, 27 Mar 2026 22:53:43 +0000 (23:53 +0100)] 
mkosi: Drop kexec-tools

Not needed anymore now that we use kexec_file_load().

15 hours agosystemctl: replace kexec-tools dependency with direct kexec_file_load() syscall
Daan De Meyer [Fri, 27 Mar 2026 22:03:14 +0000 (22:03 +0000)] 
systemctl: replace kexec-tools dependency with direct kexec_file_load() syscall

Replace the fork+exec of /usr/bin/kexec in load_kexec_kernel() with a
direct kexec_file_load() syscall, removing the runtime dependency on
kexec-tools for systemctl kexec.

The kexec_file_load() syscall (available since Linux 3.17) accepts
kernel and initrd file descriptors directly, letting the kernel handle
image parsing, segment setup, and purgatory internally. This is much
simpler than the older kexec_load() syscall which requires complex
userspace setup of memory segments and boot protocol structures — that
complexity is the raison d'être of kexec-tools.

The implementation follows the established libc wrapper pattern: a
missing_kexec_file_load() fallback in src/libc/kexec.c calls the
syscall directly when glibc doesn't provide a wrapper (which is
currently always the case). The syscall is not available on all
architectures — alpha, i386, ia64, m68k, mips, sh, and sparc lack
__NR_kexec_file_load — so the wrapper and caller are guarded with
HAVE_KEXEC_FILE_LOAD_SYSCALL to compile cleanly everywhere.

When kexec_file_load() rejects the kernel image with ENOEXEC (e.g. the
image is compressed or wrapped in a PE container that the kernel's kexec
handler doesn't understand natively), we attempt to unwrap/decompress
and retry. This is effectively the same decompression and extraction
logic that already lives in src/ukify/ukify.py (maybe_decompress() and
get_zboot_kernel()), now implemented in C so that systemctl can handle
it natively without shelling out to external tools:

 - Compressed kernels (Image.gz, Image.zst, Image.xz, Image.lz4): the
   format is detected by magic bytes (per RFC 1952, RFC 8878,
   tukaani.org xz spec, and lz4 frame format spec) and decompressed to
   a memfd using the existing decompress_stream_*() infrastructure plus
   the new gzip support from the previous commit. This is primarily
   needed on arm64 where kexec_file_load() only accepts raw Image files.
   On x86_64, bzImage is already the native format and works directly.

 - EFI ZBOOT PE images (vmlinuz.efi): detected by "MZ" + "zimg" magic
   at the start of the file. The compressed payload offset, size, and
   compression type are read from the ZBOOT header defined in
   linux/drivers/firmware/efi/libstub/zboot-header.S.

 - Unified Kernel Images (UKI): detected as PE files with a .linux
   section via the existing pe_is_uki() infrastructure. The .linux
   section (kernel) and optionally .initrd section are extracted to
   memfds. When a UKI provides an embedded initrd and the boot entry
   doesn't specify one separately, the embedded initrd is used.

The try-first-then-decompress approach means we never decompress
unnecessarily: on x86_64 the first kexec_file_load() call succeeds
immediately with the raw bzImage, and on architectures where the
kernel's kexec handler natively understands PE (like LoongArch with
kexec_efi_ops), ZBOOT/UKI images work without decompression too.

If kexec_file_load() is unavailable (architectures without the syscall)
or all attempts fail, we fall back to forking+execing the kexec binary.
This preserves compatibility on architectures like i386 and mips where
only the older kexec_load() syscall exists and kexec-tools is needed to
handle the complex userspace setup.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
15 hours agolibc: Add kexec_file_load() syscall wrapper
Daan De Meyer [Fri, 10 Apr 2026 10:23:22 +0000 (10:23 +0000)] 
libc: Add kexec_file_load() syscall wrapper

Allow tabs in UAPI headers in .gitattributes since they are copied
verbatim from the kernel.

15 hours agocompress: rework decompressor_detect() on top of compression_detect_from_magic()
Daan De Meyer [Fri, 10 Apr 2026 10:18:12 +0000 (10:18 +0000)] 
compress: rework decompressor_detect() on top of compression_detect_from_magic()

Replace the duplicated magic byte signatures in decompressor_detect()
with a call to the new compression_detect_from_magic() helper and use a
switch statement to initialize the appropriate decompression context.

18 hours agotime-util: encode our assumption that clock_gettime() never can return 0 or USEC_INFINITY
Lennart Poettering [Sun, 12 Apr 2026 19:44:59 +0000 (21:44 +0200)] 
time-util: encode our assumption that clock_gettime() never can return 0 or USEC_INFINITY

We generally assume that valid times returned by clock_gettime() are > 0
and < USEC_INFINITY. If this wouldn't hold all kinds of things would
break, because we couldn't distuingish our niche values from regular
values anymore.

Let's hence encode our assumptions in C, already to help static
analyzers and LLMs.

Inspired by: https://github.com/systemd/systemd/pull/41601#pullrequestreview-4094645891

28 hours agoudev/scsi-id: various typing refactorings 41585/head
Luca Boccassi [Fri, 10 Apr 2026 21:14:45 +0000 (22:14 +0100)] 
udev/scsi-id: various typing refactorings

28 hours agoudev/scsi-id: check for invalid header from kernel buffer
Luca Boccassi [Fri, 10 Apr 2026 18:35:59 +0000 (19:35 +0100)] 
udev/scsi-id: check for invalid header from kernel buffer

28 hours agoudev/scsi-id: check for invalid chars in various fields received from the kernel
Luca Boccassi [Fri, 10 Apr 2026 18:04:04 +0000 (19:04 +0100)] 
udev/scsi-id: check for invalid chars in various fields received from the kernel

Follow-up for 16325b35fa6ecb25f66534a562583ce3b96d52f3

28 hours agonss-systemd: fix off-by-one in nss_pack_group_record_shadow()
Milan Kyselica [Sat, 11 Apr 2026 08:31:16 +0000 (10:31 +0200)] 
nss-systemd: fix off-by-one in nss_pack_group_record_shadow()

nss_count_strv() counts trailing NULL pointers in n. The pointer area
then used (n + 1), reserving one slot more than the size check
accounted for.

Drop the + 1 since n already includes the trailing NULLs, unlike the
non-shadow nss_pack_group_record() where n does not.

Fixes: https://github.com/systemd/systemd/issues/41591
28 hours agoMore assorted coverity fixes (#41601)
Luca Boccassi [Sun, 12 Apr 2026 20:19:12 +0000 (21:19 +0100)] 
More assorted coverity fixes (#41601)

One more round, this time with the help of the claudebot, especially for
spelunking in git blame to find the original commit and writing commit
messages from the list of warnings exported from coverity

Co-developed-by: Claude
[claude@anthropic.com](mailto:claude@anthropic.com)

29 hours agocore: varlink enum for io.systemd.Unit interface (#40972)
Lennart Poettering [Sun, 12 Apr 2026 19:47:54 +0000 (21:47 +0200)] 
core: varlink enum for io.systemd.Unit interface (#40972)

Convert string fields to varlink enums in io.systemd.Unit

Following
https://github.com/systemd/systemd/pull/39391#discussion_r2489599449,
convert all configuration setting fields in the io.systemd.Unit varlink
interface from bare SD_VARLINK_STRING to proper enum types, adding type
safety to the IDL.

This converts ~30 fields across ExecContext, CGroupContext, and
UnitContext, adding 25 new varlink enum types.

Weak compatibility breakage (per
https://github.com/systemd/systemd/pull/40972#issuecomment-4222294318):
Varlink enum identifiers cannot contain - or +, so affected values are
underscorified on the wire. For example, "tty-force" becomes tty_force,
"kmsg+console" becomes kmsg_console.

The full list of affected values:
```
  - ExecInputType: tty-force, tty-fail
  - ExecOutputType: kmsg+console, journal+console
  - ProtectHome: read-only
  - CGroupController: bpf-firewall, bpf-devices, bpf-foreign, bpf-socket-bind, bpf-restrict-network-interfaces, bpf-bind-network-interface
  - CollectMode: inactive-or-failed
  - EmergencyAction: exit-force, reboot-force, reboot-immediate, poweroff-force, poweroff-immediate, soft-reboot, soft-reboot-force, kexec-force, halt-force, halt-immediate
  - JobMode: replace-irreversibly, ignore-dependencies, ignore-requirements, restart-dependencies
```

34 hours agojournal: limit decompress_blob() output to DATA_SIZE_MAX 41604/head
Frantisek Sumsal [Sun, 12 Apr 2026 13:02:11 +0000 (15:02 +0200)] 
journal: limit decompress_blob() output to DATA_SIZE_MAX

We already have checks in place during compression that limit the data
we compress, so they shouldn't decompress to anything larger than
DATA_SIZE_MAX unless they've been tampered with. Let's make this
explicit and limit all our decompress_blob() calls in journal-handling
code to that limit.

One possible scenario this should prevent is when one tries to open and
verify a journal file that contains a compression bomb in its payload:

$ ls -lh test.journal
-rw-rw-r--+ 1 fsumsal fsumsal 1.2M Apr 12 15:07 test.journal

$ systemd-run --user --wait --pipe -- build-local/journalctl --verify --file=$PWD/test.journal
Running as unit: run-p682422-i4875779.service
000110: Invalid hash (00000000 vs. 11e4948d73bdafdd)
000110: Invalid object contents: Bad message
File corruption detected at /home/fsumsal/repos/@systemd/systemd/test.journal:272 (of 1249896 bytes, 0%).
FAIL: /home/fsumsal/repos/@systemd/systemd/test.journal (Bad message)
          Finished with result: exit-code
Main processes terminated with: code=exited, status=1/FAILURE
               Service runtime: 48.051s
             CPU time consumed: 47.941s
                   Memory peak: 8G (swap: 0B)

Same could be, in theory, possible with just `journalctl --file=`, but
the reproducer would be a bit more complicated (haven't tried it, yet).

Lastly, the change in journal-remote is mostly hardening, as the maximum
input size to decompress_blob() there is mandated by MHD's connection
memory limit (set to JOURNAL_SERVER_MEMORY_MAX which is 128 KiB at the
time of writing), so the possible output size there is already quite
limited (e.g. ~800 - 900 MiB for xz-compressed data).

34 hours agocompress: limit the output to dst_max bytes with LZ4 if set
Frantisek Sumsal [Sun, 12 Apr 2026 14:24:53 +0000 (16:24 +0200)] 
compress: limit the output to dst_max bytes with LZ4 if set

We already do that with other algorithms, so let's make
decompress_blob_lz4() consistent with the rest.

34 hours agojournal: move the {DATA,ENTRY}_SIZE constants to sd-journal
Frantisek Sumsal [Sun, 12 Apr 2026 13:43:35 +0000 (15:43 +0200)] 
journal: move the {DATA,ENTRY}_SIZE constants to sd-journal

So we can access them from the code there as well.

35 hours agococcinelle: add SIZEOF() macro to work-around sizeof(*private) 41595/head
Michael Vogt [Sun, 12 Apr 2026 13:47:48 +0000 (15:47 +0200)] 
coccinelle: add SIZEOF() macro to work-around sizeof(*private)

We have code like `size_t max_size = sizeof(*private)` in three
places. This is evaluated at compile time so its safe to use. However
the new pointer-deref checker in coccinelle is not smart enough to know
this and will flag those as errors. To avoid these false positives
we have some options:
1. Reorder so that we do:
```C
size_t max_size = 0;
assert(private);
max_size = sizeof(*private);
```
2. Use something like `size_t max_size = sizeof(*ASSERT_PTR(private));`
3. Place the assert before the declaration
4. Workaround coccinelle via SIZEOF(*private) that we can then hide
   via parsing_hacks.h
5. Fix coccinelle (OCaml, hard)
6. ... somehting I missed?

None of these is very appealing. I went for (4) but happy about
suggestions.

35 hours agosd-varlink: make ret optional in sd_varlink_idl_parse()
Michael Vogt [Sat, 11 Apr 2026 17:52:33 +0000 (19:52 +0200)] 
sd-varlink: make ret optional in sd_varlink_idl_parse()

We have a test failure where the testsuite is calling
sd_varlink_idl_parse() with *ret being NULL. This is now an
assert error. So we could either fix the test or fix the code

Given that it seems genuinely useful to run sd_varlink_idl_parse()
without *ret to e.g. just check if the idl is valid I opted to
fix the code.

35 hours agomany: fix remaining check-pointer-deref issues
Michael Vogt [Tue, 31 Mar 2026 17:53:24 +0000 (19:53 +0200)] 
many: fix remaining check-pointer-deref issues

The updated parsing_hacks.h file uncovered a bunch of extra
things that the check-pointer-deref coccinelle script flags.

This commit fixes them to make the tree check-pointer-deref clean.

36 hours agotest-json: add iszero_safe guards for float division at index 0 and 1 41601/head
Luca Boccassi [Sat, 11 Apr 2026 21:52:47 +0000 (22:52 +0100)] 
test-json: add iszero_safe guards for float division at index 0 and 1

The existing iszero_safe guards at index 9 and 10 were added to
silence Coverity, but the same division-by-float-zero warning also
applies to the divisions at index 0 (DBL_MIN) and 1 (DBL_MAX).

CID#1587762

Follow-up for 7f133c996c8b1ea9219540ec8f966b64b58d30a6

36 hours agodebug-generator: assert breakpoint type is valid before bit shift
Luca Boccassi [Sat, 11 Apr 2026 21:50:39 +0000 (22:50 +0100)] 
debug-generator: assert breakpoint type is valid before bit shift

The BreakpointType enum includes _BREAKPOINT_TYPE_INVALID (-EINVAL),
so Coverity flags the bit shift as potentially using a negative shift
amount. Add an assert to verify the type is in valid range, since the
static table only contains valid entries.

CID#1568482

Follow-up for 1929226e7e649b72f3f9acd464eaac771c00945c

36 hours agonss-myhostname: add more INC_SAFE for buffer index accumulation
Luca Boccassi [Sat, 11 Apr 2026 21:15:52 +0000 (22:15 +0100)] 
nss-myhostname: add more INC_SAFE for buffer index accumulation

Use overflow-safe INC_SAFE() instead of raw addition for idx
accumulation, so that Coverity can see the addition is checked.

CID#1548028

Follow-up for a05483a921a518fd283e7cb32dc8c8e816b2ab2c

36 hours agouid-range: add assert to prevent underflow in coalesce loop
Luca Boccassi [Sat, 11 Apr 2026 21:04:37 +0000 (22:04 +0100)] 
uid-range: add assert to prevent underflow in coalesce loop

Coverity flags range->n_entries - j as a potential underflow
in the memmove size calculation. Add assert(range->n_entries > 0)
before decrementing n_entries, which holds since the loop condition
guarantees j < n_entries.

CID#1548015

Follow-up for 8dcc66cefc8ab489568c737adcba960756d76a3c

37 hours agoSome coverity cleanups (#41596)
Zbigniew Jędrzejewski-Szmek [Sun, 12 Apr 2026 12:00:49 +0000 (14:00 +0200)] 
Some coverity cleanups (#41596)

37 hours agoAnother batch of option+verb conversions (#41586)
Zbigniew Jędrzejewski-Szmek [Sun, 12 Apr 2026 11:58:38 +0000 (13:58 +0200)] 
Another batch of option+verb conversions (#41586)

37 hours agosd-varlink: scale down the limit of connections per UID to 128
Frantisek Sumsal [Fri, 10 Apr 2026 16:32:33 +0000 (18:32 +0200)] 
sd-varlink: scale down the limit of connections per UID to 128

1024 connections per UID is unnecessarily generous, so let's scale this
down a bit. D-Bus defaults to 256 connections per UID, but let's be even
more conservative and go with 128.

2 days agopo: Translated using Weblate (Arabic)
joo es [Sat, 11 Apr 2026 19:58:51 +0000 (19:58 +0000)] 
po: Translated using Weblate (Arabic)

Currently translated at 100.0% (266 of 266 strings)

Co-authored-by: joo es <jonnyse@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ar/
Translation: systemd/main

2 days agotools: run check-coccinelle.sh with (updated) parsing_hacks.h
Michael Vogt [Tue, 31 Mar 2026 17:01:28 +0000 (19:01 +0200)] 
tools: run check-coccinelle.sh with (updated) parsing_hacks.h

This commit runs the check-coccinelle checker scripts with the
parsing_hacks.h. Because this was missing before there were some
issues that did not get flagged.

While at it it also adds some missing cleanup attributes and
iterators to get better results. Its a bit sad that there is no
(easy/obvious) way to detect when new things are needed for
parsing_hacks.h

2 days agohomed: drop unnecessary cast to double 41596/head
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 11:09:16 +0000 (13:09 +0200)] 
homed: drop unnecessary cast to double

Coverity was complaining that we we're doing a integer division and then
casting that to double. This was OK, but it was also a bit pointless.
An operation on a double and unsigned promoted the unsigned to a double,
so it's enough if we have a double somewhere as an argument early enough.
Drop noop casts and parens to make the formulas easier to read.

CID#1466459

2 days agofundamental: add ABS_DIFF macro
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 11:06:56 +0000 (13:06 +0200)] 
fundamental: add ABS_DIFF macro

Sometimes we want need to diff two unsigned numbers, which is awkward
because we need to cast them to something with a sign first, if we want
to use abs(). Let's add a helper that avoids the function call
altogether.

Also drop unnecessary parens arounds args which are delimited by commas.

2 days agovarlinkctl: drop bogus variable assignment
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 10:44:03 +0000 (12:44 +0200)] 
varlinkctl: drop bogus variable assignment

Coverity complains that r is overridden. In fact it isn't, but
we shouldn't set it like this anyway. exec_with_listen_fds() already
logs, so we only need to call _exit() if it fails.

CID#1646716

2 days agosd-event: replace dead code path with an assert
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 10:33:44 +0000 (12:33 +0200)] 
sd-event: replace dead code path with an assert

Coverity complains that the -EOPNOTSUPP can never be returned, because
we always have !watch_fallback==locked.

CID#1654169

2 days agocryptsetup: convert to the new option and verb parsers 41586/head
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 09:54:05 +0000 (11:54 +0200)] 
cryptsetup: convert to the new option and verb parsers

The synopisis is moved from the header to the a new section:

  -systemd-cryptsetup attach VOLUME SOURCE-DEVICE [KEY-FILE] [CONFIG]
  -systemd-cryptsetup detach VOLUME
  +systemd-cryptsetup [OPTIONS...] {COMMAND} ...

   Attach or detach an encrypted block device.

  +Commands:
  +  attach VOLUME SOURCE-DEVICE [KEY-FILE] [CONFIG] Attach an encrypted block
  +                                                  device
  +  detach VOLUME                                   Detach an encrypted block
  +                                                  device
  +
  +Options:

I think that's OK… With the autogenerated table that's the natural
thing to do.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agocryptenroll: convert to the new option parser
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 09:26:05 +0000 (11:26 +0200)] 
cryptenroll: convert to the new option parser

--help is the same, apart from linewrapping.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agocryptenroll: reorder option cases to match --help output
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 08:52:38 +0000 (10:52 +0200)] 
cryptenroll: reorder option cases to match --help output

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agocat: convert to the new option parser
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 08:07:49 +0000 (10:07 +0200)] 
cat: convert to the new option parser

--help is identical except for whitespace.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agobsod: convert to the new option parser
Zbigniew Jędrzejewski-Szmek [Sat, 11 Apr 2026 08:03:41 +0000 (10:03 +0200)] 
bsod: convert to the new option parser

Option indentation in --help is fixed.
Description for --continuous is shortened.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agodelta: convert to the new option parser
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 19:41:34 +0000 (21:41 +0200)] 
delta: convert to the new option parser

--help for --diff= is changed from old-style "1|0" to "yes|no".

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agoescape: convert to the new option parser
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 19:28:38 +0000 (21:28 +0200)] 
escape: convert to the new option parser

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agopull: convert to the new option and verb parsers
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 19:21:02 +0000 (21:21 +0200)] 
pull: convert to the new option and verb parsers

Duplicated word in description of --keep-download= is fixed.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agoimportctl: convert to the new option and verb parsers
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 16:28:24 +0000 (18:28 +0200)] 
importctl: convert to the new option and verb parsers

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agoimportctl: fix -N to actually clear keep-download flag
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 16:26:58 +0000 (18:26 +0200)] 
importctl: fix -N to actually clear keep-download flag

-N was clearing and re-setting the same bit in arg_import_flags_mask,
which is a no-op. It should clear the bit in arg_import_flags instead,
matching what --keep-download=no does via SET_FLAG().

2 days agoimport: convert to the new option and verb parsers
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 16:19:41 +0000 (18:19 +0200)] 
import: convert to the new option and verb parsers

--help output is the same.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agobootctl: convert options and verbs to the new macros
Zbigniew Jędrzejewski-Szmek [Sun, 5 Apr 2026 16:04:21 +0000 (18:04 +0200)] 
bootctl: convert options and verbs to the new macros

-RR is formatted using the new OPTION_HELP_ENTRY_VERBATIM so that
we get the same --help as before.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2 days agoshared/verbs: add _SCOPE variants of the verb macros
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 14:41:54 +0000 (16:41 +0200)] 
shared/verbs: add _SCOPE variants of the verb macros

In some of the large programs, verbs are defined as non-static
functions. To support this cases, add variants of the VERB macros that
take an explicit scope parameter. The existing macros then call those
new macros with scope=static. The variant without static is the
exception, so the macros are "optimized" toward the static helpers.

I also considered allowing VERB macros to be used in different files,
i.e. in different compilation units. This would actually work without
too many changes, except for one caveat: the order in the array would be
unspecified, so we'd need to somehow order the verbs appropriately. This
most likely means that the verbs would need to be annotated with a
number. But that doesn't seem attractive at all: we'd need to coordinate
changes in different files. So just listing the verbs in one file seems
like least bad option.

2 days agoshared/options: add option to generate a help line for custom option format
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 17:06:00 +0000 (19:06 +0200)] 
shared/options: add option to generate a help line for custom option format

Sometimes we want to document what -RR or -vv does or some other
special thing. Let's allow this by (ab-)using long_code pointer
to store a preformatted string.

2 days agojson-stream: fix NULL pointer passed to memcpy on first read with INPUT_SENSITIVE
Luca Boccassi [Sat, 11 Apr 2026 00:41:13 +0000 (01:41 +0100)] 
json-stream: fix NULL pointer passed to memcpy on first read with INPUT_SENSITIVE

When JSON_STREAM_INPUT_SENSITIVE is set before the first read,
input_buffer is NULL, input_buffer_size is 0, and input_buffer_index
is 0. The old condition '!INPUT_SENSITIVE && index == 0' would route
this case into the else branch which calls memcpy() with a NULL source
pointer, which is undefined behavior even when the length is zero, and
is caught by UBSan.

Fix by checking input_buffer_index == 0 first, then allowing the
GREEDY_REALLOC fast path also when input_buffer_size == 0, since
there is no sensitive data to protect from realloc() copying in that
case. The else branch is now only entered when there is actual data
to copy (input_buffer_size > 0), guaranteeing input_buffer is
non-NULL.

Follow-up for 6b1a59d59426cdda56648b00394addde2d454418

3 days agocore: fix EBUSY on restart and clean of delegated services
Nandakumar Raghavan [Tue, 24 Mar 2026 13:42:42 +0000 (13:42 +0000)] 
core: fix EBUSY on restart and clean of delegated services

When a service is configured with Delegate=yes and DelegateSubgroup=sub,
the delegated container may write domain controllers (e.g. "pids") into the
service cgroup's cgroup.subtree_control via its cgroupns root. On container
exit the stale controllers remain, and on service restart clone3() with
CLONE_INTO_CGROUP fails with EBUSY because placing a process into a cgroup
that has domain controllers in subtree_control violates the no-internal-
processes rule. The same issue affects systemctl clean, where cg_attach()
fails with EBUSY for the same reason.

Add unit_cgroup_disable_all_controllers() helper in cgroup.c that clears
stale controllers via cg_enable(mask=0) and updates cgroup_enabled_mask to
keep internal tracking in sync. Call it from service_start() and
service_clean() right before spawning, so that resource control is preserved
for any lingering processes from the previous invocation as long as possible.

3 days agosd-json: limit the stack depth during parsing as well
Frantisek Sumsal [Fri, 10 Apr 2026 15:20:03 +0000 (17:20 +0200)] 
sd-json: limit the stack depth during parsing as well

3 days agoDefine array cleanup funcs through macros (#41559)
Zbigniew Jędrzejewski-Szmek [Fri, 10 Apr 2026 19:45:14 +0000 (21:45 +0200)] 
Define array cleanup funcs through macros (#41559)

3 days agosd-json: add JsonStream transport-layer module and migrate sd-varlink
Daan De Meyer [Thu, 9 Apr 2026 14:54:21 +0000 (14:54 +0000)] 
sd-json: add JsonStream transport-layer module and migrate sd-varlink

Introduces JsonStream, a generic transport layer for JSON-line message
exchange over a pair of file descriptors. It owns the input/output
buffers, SCM_RIGHTS fd passing, the deferred output queue, the
read/write/parse step functions, sd-event integration (input/output/time
event sources), the idle timeout machinery, and peer credential caching,
but knows nothing about the specific JSON protocol on top — the consumer
drives its state machine via phase/dispatch callbacks supplied at
construction.

sd-varlink is reworked to delegate the entire transport layer to a
JsonStream owned by sd_varlink. The varlink struct drops every
transport-related field (input/output buffers and fds, output queue,
fd-passing state, ucred/pidfd cache, prefer_read/write fallback, idle
timeout, description, event sources) — all of that lives in JsonStream
now. What remains in sd_varlink is the varlink-protocol state machine
(state, n_pending, current/previous/sentinel, server linkage, peer
credentials accounting, exec_pidref, the varlink-specific quit and defer
sources) and a thin wrapper layer over the JsonStream API. The
should_disconnect / get_timeout / get_events / wait helpers all live in
JsonStream now and are driven by a JsonStreamPhase the consumer reports
via its phase callback.

3 days agonews: new record about strings vs enums in varlink 40972/head
Ivan Kruglov [Fri, 10 Apr 2026 13:12:26 +0000 (06:12 -0700)] 
news: new record about strings vs enums in varlink

3 days agotest: add core-specific varlink enum sync test
Ivan Kruglov [Thu, 5 Mar 2026 11:05:00 +0000 (03:05 -0800)] 
test: add core-specific varlink enum sync test

Add test-varlink-idl-unit that validates all varlink enum types in
io.systemd.Unit match their corresponding C string tables. This
catches drift between varlink IDL enum definitions and internal
enum values.

Uses core_test_template since it links against libcore for access
to the string table lookup functions.

ExecOutput uses TEST_IDL_ENUM_TO_STRING only because the '+' in
'kmsg+console' doesn't survive the underscorify/dashify round-trip.

3 days agodocs: beef up SECURITY.md rules for reporting
Luca Boccassi [Fri, 10 Apr 2026 13:13:27 +0000 (14:13 +0100)] 
docs: beef up SECURITY.md rules for reporting

With yeswehack.com suspended due to funding issues for triagers being
worked out, reports on GH are starting to pile up. Explicitly define
some ground rules to avoid noise and time wasting.

3 days agovarlink: add enum types for configuration settings in io.systemd.Unit
Ivan Kruglov [Thu, 5 Mar 2026 10:31:24 +0000 (02:31 -0800)] 
varlink: add enum types for configuration settings in io.systemd.Unit

Define proper varlink enum types for unit configuration settings that
are part of the user-facing API (values users/clients can select).
This replaces SD_VARLINK_STRING with SD_VARLINK_DEFINE_FIELD_BY_TYPE
for these fields, giving them strong type semantics in the IDL.

Enum types added for ExecContext (ExecInputType, ExecOutputType,
ExecUtmpMode, ExecPreserveMode, ExecKeyringMode, MemoryTHP,
ProtectProc, ProcSubset, ProtectSystem, ProtectHome, PrivateTmp,
PrivateUsers, ProtectHostname, ProtectControlGroups, PrivatePIDs,
PrivateBPF), CGroupContext (CGroupDevicePolicy, ManagedOOMMode,
ManagedOOMPreference, CGroupPressureWatch, NFTSetSource, NFProto,
BPFCGroupAttachType, CGroupController), and UnitContext (CollectMode,
EmergencyAction, JobMode).

Engine-reported runtime state fields (Type, LoadState, ActiveState,
FreezerState, SubState, UnitFileState) remain as strings since only
the engine selects those values.

3 days agovarious: use DEFINE_ARRAY_FREE_FUNC 41559/head
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 21:04:47 +0000 (23:04 +0200)] 
various: use DEFINE_ARRAY_FREE_FUNC

3 days agosysupdate: use DEFINE_POINTER_ARRAY_FREE_FUNC, rename func
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 21:04:19 +0000 (23:04 +0200)] 
sysupdate: use DEFINE_POINTER_ARRAY_FREE_FUNC, rename func

3 days agoshared/tar-util: use DEFINE_ARRAY_FREE_FUNC, rename funcs
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 21:03:47 +0000 (23:03 +0200)] 
shared/tar-util: use DEFINE_ARRAY_FREE_FUNC, rename funcs

3 days agosd-journal: use NormalCasing for struct
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 20:56:07 +0000 (22:56 +0200)] 
sd-journal: use NormalCasing for struct

3 days agonsresourced: use DEFINE_ARRAY_FREE_FUNC, make func static and rename
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 20:49:41 +0000 (22:49 +0200)] 
nsresourced: use DEFINE_ARRAY_FREE_FUNC, make func static and rename

3 days agolibsystemd-network: use DEFINE_POINTER_ARRAY_FREE_FUNC, rename cleanup function
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 20:40:21 +0000 (22:40 +0200)] 
libsystemd-network: use DEFINE_POINTER_ARRAY_FREE_FUNC, rename cleanup function

3 days agolibsystemd-network: use DEFINE_ARRAY_FREE_FUNC, rename cleanup func
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 20:34:34 +0000 (22:34 +0200)] 
libsystemd-network: use DEFINE_ARRAY_FREE_FUNC, rename cleanup func

3 days agostub: use DEFINE_ARRAY_FREE_FUNC
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 16:30:37 +0000 (18:30 +0200)] 
stub: use DEFINE_ARRAY_FREE_FUNC

3 days agoAdd DEFINE_ARRAY_FREE_FUNC and mount_image_free_array
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 16:27:34 +0000 (18:27 +0200)] 
Add DEFINE_ARRAY_FREE_FUNC and mount_image_free_array

This is similar to DEFINE_POINTER_ARRAY_FREE_FUNC, but one
pointer chase less. The name of the outer and inner functions are
specified separately. The inner function does not free, so it'll
be generally something like 'foo_done', but the outer function
does free, so it can be called 'foo_array_free'.

3 days agoAdd DEFINE_POINTER_ARRAY_FREE_FUNC and conf_file_free_array
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 15:56:09 +0000 (17:56 +0200)] 
Add DEFINE_POINTER_ARRAY_FREE_FUNC and conf_file_free_array

As mentioned in the grandfather commit, I want to use the _many
suffix for freeing of the contents of an array, so the functions
to free the array to get the suffix _array.

3 days agofirewall-util: use DEFINE_ARRAY_DONE_FUNC for netlink message cleanup
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 15:37:41 +0000 (17:37 +0200)] 
firewall-util: use DEFINE_ARRAY_DONE_FUNC for netlink message cleanup

Replace the open-coded netlink_message_unref_many() function and its
DEFINE_TRIVIAL_CLEANUP_FUNC wrapper with DEFINE_ARRAY_DONE_FUNC.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
3 days agoAdd DEFINE_ARRAY_DONE_FUNC
Zbigniew Jędrzejewski-Szmek [Wed, 8 Apr 2026 15:17:32 +0000 (17:17 +0200)] 
Add DEFINE_ARRAY_DONE_FUNC

This is a helper macro that defines a function to drop elements of an
array but not the array itself. I used the "_many" suffix because it
most closely matches what happens here: we are calling the cleanup
function a bunch of times.

3 days agotest: extract varlink IDL test helpers into shared header
Ivan Kruglov [Thu, 5 Mar 2026 10:30:39 +0000 (02:30 -0800)] 
test: extract varlink IDL test helpers into shared header

Move the TEST_IDL_ENUM_TO_STRING, TEST_IDL_ENUM_FROM_STRING, and
TEST_IDL_ENUM macros along with test_enum_to_string_name() from
test-varlink-idl.c into test-varlink-idl-util.h so they can be
reused by other test files.

3 days agoUpdate TODO
Lennart Poettering [Fri, 10 Apr 2026 12:46:17 +0000 (14:46 +0200)] 
Update TODO

3 days agomeson: Check if files returned by git ls-files actually exist
Daan De Meyer [Fri, 10 Apr 2026 06:14:53 +0000 (08:14 +0200)] 
meson: Check if files returned by git ls-files actually exist

Otherwise you run into errors such as:

"""
../meson.build:2899:28: ERROR: File src/test/test-loop-util.c does not exist.
"""

when deleting a file in git without staging the deletion.

3 days agosd-bus: don't overallocate the message buffer
Frantisek Sumsal [Fri, 10 Apr 2026 08:52:21 +0000 (10:52 +0200)] 
sd-bus: don't overallocate the message buffer

newa(t, n) already allocates sizeof(t) * n bytes, so previously we'd
actually allocate sizeof(t) * sizeof(t) * n bytes, which is ~16x more
(on x86_64) that we actually needed.

This is probably an oversight from a tree-wide change in
6e9417f5b4f29938fab1eee2b5edf596cc580452 that replaced alloca() with
newa().

Follow-up for 6e9417f5b4f29938fab1eee2b5edf596cc580452.

3 days agologind: add io.systemd.Shutdown varlink interface (#41229)
Lennart Poettering [Fri, 10 Apr 2026 10:29:32 +0000 (12:29 +0200)] 
logind: add io.systemd.Shutdown varlink interface (#41229)

The shutdown interface is currently only exposed via dbus. This PR
adds a comparable varlink implementation. It is inspired by the existing
dbus methods and implements PowerOff, Reboot, Halt, Kexec, SoftReboot
as varlink methods on a new io.systemd.Shutdown interface.

It is (intentional) simpler than the dbus for now, i.e. no Can* yet,
mostly
because I want to get feedback first (happy to do that in a followup).

The only real difficulty here is what to do about
verify_shutdown_creds()
as this is needed by both dbus and varlink and its dbus only. I went for
an ugly but (hopefully) pragmatic choice (see the commit message for
details). But I can totally understand if a refactor instead is
preferred.

3 days agoHelp users with incorrect / permission bits (#41431)
Lennart Poettering [Fri, 10 Apr 2026 10:25:07 +0000 (12:25 +0200)] 
Help users with incorrect / permission bits (#41431)

This error causes the computer to pass the emergency.target and go to
graphical.target.
Then, your window manager will have problems because it cant access any
directories, your network manager wont startup the network. In my case,
the screen just goes black. Ideally, you'd get an error message
explaining this edge scenario that's occuring to you, and an emergency
shell that makes it easy to run the necessary chmod 0755 / to proceed
with booting. IDK not sure if this is the correct way to implement this,
sorry it's my first contribution.

I ran
`meson test -C build`
and got

Ok:                1806
Fail:              26
Skipped:           25
on my cloned systemd repo before any changes, and got the same result
after my commit ¯\_(ツ)_/¯
So I hope I did that right.
Thanks

3 days agoreport: add cgroup metrics in a separate varlink service (#41489)
Lennart Poettering [Fri, 10 Apr 2026 10:10:06 +0000 (12:10 +0200)] 
report: add cgroup metrics in a separate varlink service (#41489)

Add CpuUsage, MemoryUsage, IOReadBytes, IOReadOperations, and
TasksCurrent in a standalone socket-activated varlink service. These
metrics are gathered from the kernel via cgroup files and PID1's only
role is mapping unit names to cgroup paths — a separate process can
query PID1 once for that mapping and then read the cgroup files
directly, minimizing PID1 involvement.

The new systemd-report-cgroup-metrics service listens at
/run/systemd/report/io.systemd.CGroup and exposes:
  - io.systemd.CGroup.CpuUsage
  - io.systemd.CGroup.IOReadBytes
  - io.systemd.CGroup.IOReadOperations
  - io.systemd.CGroup.MemoryUsage (with type=current/available/peak)
  - io.systemd.CGroup.TasksCurrent

This is spun out of #41078 and based on top of it. Will rebase once
that's merged.

3 days agoresolved: replace assert() with error return in DNSSEC verify functions
Milan Kyselica [Thu, 9 Apr 2026 17:43:14 +0000 (19:43 +0200)] 
resolved: replace assert() with error return in DNSSEC verify functions

dnssec_rsa_verify_raw() asserts that RSA_size(key) matches the RRSIG
signature size, and dnssec_ecdsa_verify_raw() asserts that
EC_KEY_check_key() succeeds. Both conditions depend on parsed DNS
record content. Replace with proper error returns.

The actual crypto verify calls (EVP_PKEY_verify / ECDSA_do_verify)
handle mismatches fine on their own, so the asserts were also redundant.

While at it, fix the misleading "EC_POINT_bn2point failed" log message
that actually refers to an EC_KEY_set_public_key() failure.

Fixes: https://github.com/systemd/systemd/issues/41569
3 days agoclaude-review: improve review quality for large PRs
Daan De Meyer [Fri, 10 Apr 2026 08:04:08 +0000 (08:04 +0000)] 
claude-review: improve review quality for large PRs

Several issues were identified from analyzing logs of a large (52-commit) PR
review:

- Claude was batching multiple commits into a single review agent instead of
  one per worktree. Strengthen the prompt to explicitly prohibit grouping.
- Claude was reading pr-context.json and commit messages before spawning
  agents despite instructions not to, wasting time. Tighten the pre-spawn
  rules to only allow listing worktrees/ and reading review-schema.json.
- Subagents were spawned with model "sonnet" instead of "opus". Add explicit
  instruction to use opus.
- After agents returned, Claude spent 9 minutes re-verifying findings with
  bash/grep/sed commands, duplicating the agents' work. Add instruction to
  trust subagent findings and only read pr-context.json in phase 2.
- Subagents returned markdown-wrapped JSON instead of raw JSON arrays. Add
  instruction requiring raw JSON output only.
- Each subagent was independently reading review-schema.json. Instead have
  the main agent read it once and paste it into each subagent prompt.
- The "drop low-confidence findings" instruction was being used to justify
  dropping findings that Claude itself acknowledged as valid ("solid cleanup
  suggestions", "reasonable consistency improvement"). Remove the instruction.
- Simplify the deduplication instructions
- Stop adding the severity to the body in the post processing job as claude is
  also adding it so they end up duplicated.

3 days agoresolved: skip cache flush on server switch/re-probe when StaleRetentionSec is set
azureuser [Tue, 3 Mar 2026 08:41:45 +0000 (08:41 +0000)] 
resolved: skip cache flush on server switch/re-probe when StaleRetentionSec is set

manager_set_dns_server() and dns_server_flush_cache() call dns_cache_flush()
unconditionally, wiping the entire cache even when StaleRetentionSec is
configured. This defeats serve-stale by discarding cached records that should
remain available during server switches and feature-level re-probes.

The original serve-stale commit (5ed91481ab) added a stale_retention_usec
guard to link_set_dns_server(), and a later commit (7928c0e0a1) added the
same guard to dns_delegate_set_dns_server(), but these two call sites in
resolved-dns-server.c were missed.

This is particularly visible with DNSOverTLS, where TLS handshake failures
trigger frequent feature-level downgrades and re-probes via
dns_server_flush_cache(), flushing the cache each time.

Add the same stale_retention_usec guard to both call sites so that cache
entries are allowed to expire naturally via dns_cache_prune() when
serve-stale is enabled.

Fixes: #40781
This commit was prepared with assistance from an AI coding agent (GitHub
Copilot). All changes have been reviewed for correctness and adherence to the
systemd coding style.

4 days agoreport: add cgroup metrics in a separate varlink service 41489/head
Yaping Li [Fri, 3 Apr 2026 05:01:15 +0000 (22:01 -0700)] 
report: add cgroup metrics in a separate varlink service

Add CpuUsage, MemoryUsage, IOReadBytes, IOReadOperations, and
TasksCurrent in a standalone socket-activated varlink service.

The new systemd-report-cgroup service listens at
/run/systemd/report/io.systemd.CGroup and exposes:
  - io.systemd.CGroup.CpuUsage
  - io.systemd.CGroup.IOReadBytes
  - io.systemd.CGroup.IOReadOperations
  - io.systemd.CGroup.MemoryUsage (with type=current/available/peak)
  - io.systemd.CGroup.TasksCurrent

4 days agocgroup-util: add cg_get_keyed_attribute_uint64() helper
Yaping Li [Wed, 8 Apr 2026 17:19:42 +0000 (10:19 -0700)] 
cgroup-util: add cg_get_keyed_attribute_uint64() helper

Multiple callers of cg_get_keyed_attribute() follow the same pattern of
reading a single keyed attribute and then parsing it as uint64_t with
safe_atou64(). Add a helper that combines both steps.

Convert all existing single-key + uint64 call sites in cgtop, cgroup.c,
and oomd-util.c to use the new helper.