Commit Graph
60383 Commits
Author SHA1 Message Date
Luca Boccassi 5d31694318 journal-importer: cap field size when checking
Originally reported on yeswehack.com as YWH-PGM9780-82

Follow-up for 1e448731f5
2026-06-07 21:49:43 +02:00
Paul Meyer ce31ff043e tests: don't leak TESTFUNCS count into run_test_table() exit code
strv_split_full() returns the number of parsed entries, which was
assigned to r, the variable that also holds the run's exit status.
With TESTFUNCS set, a passing run of only void tests then exited with
the entry count (e.g. 1) instead of EXIT_SUCCESS. Use a separate
variable for the split result.

Before:
$ env TESTFUNCS=test_copy_tree meson test -C build -v test-copy
1/1 test - systemd:test-copy FAIL            0.01s   exit status 1

$ env TESTFUNCS=test_copy_tree:test_copy_file_fd meson test -C build -v test-copy
1/1 test - systemd:test-copy FAIL            0.01s   exit status 2

Now:
$ env TESTFUNCS=test_copy_tree:test_copy_file_fd meson test -C build -v test-copy
1/1 test - systemd:test-copy OK              0.01s

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-06-07 19:23:48 +01:00
Adam Williamson d66c58f1d6 kbd-model-map: add Arabic mapping
kbd has a switched 'ara' console layout, but we don't have a
corresponding line in kbd-model-map. When converting 'us,ara' to a
legacy layout we wind up with us-acentos, which is definitely
wrong. This will fix it.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2026-06-06 13:44:07 +01:00
Lennart Poettering 2740d6aaa1 core: fix accidental change in 3d0309ac0f
Sorry!
2026-06-05 18:37:57 +02:00
Lennart Poettering 3d0309ac0f update TODO 2026-06-05 17:51:28 +02:00
Luca Boccassi 3b00327fe6 test: bump test-execute subtest timeout in CI
The test is flaky and times out lately in ppc64el CI runners:

exec-dynamicuser-statedir.service: Control group is empty.
exec-dynamicuser-statedir.service: User lookup succeeded: uid=65325 gid=65325
Test timeout when testing exec-dynamicuser-statedir.service

Bump the timeout also when in a CI, as they are often over subscribed
2026-06-05 09:47:02 +01:00
Yu Watanabe 1146c355f4 test: add missing bpf dependency
Fixes the following build error:
```
ninja: job failed: cc (snip) -o test-bpf-restrict-fsaccess.p/src_test_test-bpf-restrict-fsaccess.c.o -c ../src/test/test-bpf-restrict-fsaccess.c
In file included from ../src/test/test-bpf-restrict-fsaccess.c:96:
src/bpf/restrict-fsaccess-skel.h:19:10: fatal error: restrict-fsaccess.bpf.skel.h: No such file or directory
   19 | #include "restrict-fsaccess.bpf.skel.h"    /* IWYU pragma: export */
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
ninja: subcommand failed
```

Follow-up for e6fc73350f.
2026-06-05 04:59:11 +09:00
Yu Watanabe e0f02425ae test-namespace: namespace_open_by_id() may return -ESTALE for permission reasons
As commented in namespace_open_by_id().

Follow-up for 23f2204718.
2026-06-05 04:57:53 +09:00
Yu Watanabe 8dc1de8b3f test-btrfs: quota test is slow
The quota test takes ~30 seconds on my poor laptop, and randomly fails
with timeout. Let's extend the timeout and skip the test case when slow
tests are disabled.
2026-06-05 04:42:14 +09:00
Luca Boccassi 7590eb0c74 sd-dlopen: fix build on 'alpha'
On alpha '.set' is overridden to mean something else, so the build
fails:

/tmp/ccckEb4p.s:11442: Warning: Tried to .set unrecognized mode `sd_dlopen:[{"feature":"lzma","description":"Support lzma compression in journal and coredump files","priority":"suggested","soname":["liblzma.so.5"]}]'
/tmp/ccckEb4p.s:11442: Error: junk at end of line, first unrecognized character is `,'

Switch to '.equ' which seems to do the job just as well, and builds
on alpha too.

Follow-up for 56a7febca7
2026-06-05 04:36:32 +09:00
Antonio Alvarez Feijoo 7b2c004345 resolve: only write one ELF note for libcrypto
systemd-resolved has 2 contradictory ELF notes for libcrypto:

```
$ systemd-analyze dlopen-metadata /usr/lib/systemd/systemd-resolved
FEATURE   DESCRIPTION                                SONAME         PRIORITY
libcrypto Support for cryptographic operations       libcrypto.so.3 recommended
idn       Support for internationalized domain names libidn2.so.0   recommended
libcrypto Support for cryptographic operations       libcrypto.so.3 required
libssl    Support for TLS                            libssl.so.3    required
```

In order to have a single note, condition its priority based on whether
DNS-over-TLS is enabled.
2026-06-04 18:33:19 +01:00
Luca Boccassi cde88c4ea3 oomd: reject invalid arguments early
Validate input parameter immediately during initial parsing

Follow-up for 9de5e32136
2026-06-04 09:31:45 +02:00
Luca Boccassi 88b9acbc2b Make repart more user-friendly (#42345) 2026-06-03 20:22:48 +01:00
Daan De Meyer b77be9f072 fstab-generator: clear nosuid/nodev/noexec for root=bind: mounts
A bind mount inherits the mount flags of the file system the source
directory resides on. For root=bind: the source typically lives below
/run/ (e.g. a freshly unpacked tar image in /run/machines/), which is
mounted nosuid,nodev, so those flags propagated to /sysroot and broke
suid binaries (e.g. sudo) and device nodes on the booted system.

Default bind root mounts to dev,suid,exec instead, unless the user
overrides this via rootflags=.

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

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 20:21:54 +01:00
Daan De Meyer c280a16ab7 cryptsetup: document that keyfile-erase does not apply to auto-discovered key files
keyfile-erase only erases a key file explicitly configured in the third
field of crypttab. Key files automatically discovered in
/etc/cryptsetup-keys.d/ and /run/cryptsetup-keys.d/ are considered shared
resources not owned by an individual volume, and are never erased. Make
this explicit in the documentation and add a code comment clarifying the
intent.

Fixes: https://github.com/systemd/systemd/issues/41127
Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 16:26:04 +02:00
Zbigniew Jędrzejewski-Szmek bf3d2b03e9 shutdown: do not delay VM shutdown (#42396)
Since this was introduced I constantly find myself waiting for VMs to
shut down at the end of a test. This not only happens with mkosi
integration tests, but with other VM-based tests like for example
autopkgtest. In this example, this dracut test suite runtime is tripled
due to the artificial delay:

```
[    5.813234] systemd-shutdown[1]: Syncing filesystems and block devices.
[    5.814635] systemd-shutdown[1]: Delaying shutdown for 9s, in order to reach minimum uptime of 15s.
[    8.816855] systemd-shutdown[1]: Delaying shutdown for 6s, in order to reach minimum uptime of 15s.
[   11.819747] systemd-shutdown[1]: Delaying shutdown for 3s, in order to reach minimum uptime of 15s.
[   14.822660] systemd-shutdown[1]: Delaying shutdown for 601ms, in order to reach minimum uptime of 15s.
[   15.427777] systemd-shutdown[1]: Powering off.
[   15.429681] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[   15.433620] ACPI: PM: Preparing to enter system sleep state S5
[   15.435148] reboot: Power down
TEST: root filesystem on a ext4 filesystem with systemd and extensions   [OK]
autopkgtest [19:39:12]: test 46-systemd-sysext: -----------------------]
autopkgtest [19:39:13]: test 46-systemd-sysext:  - - - - - - - - - - results - - - - - - - - - -
46-systemd-sysext    PASS
```

Contrary to what the comment claimed, the scrollback of a VM is _not_
cleared, EDK2 just prints many pages, and one can just scroll up (a
lot).

Do not delay by default on VMs. Move the check so that in both
containers and VMs users can override and force a delay with the env
var.

Follow-up for 0874eea302
2026-06-03 16:10:20 +02:00
Zbigniew Jędrzejewski-Szmek fe2b35bd58 repart: when copying files into vfat or similar, do not set ownership
$ mkdir /var/tmp/files
$ touch /var/tmp/files/a
$ mkdir /var/tmp/conf
$ cat >>/var/tmp/conf/esp.conf
[Partition]
Type=esp
Format=vfat
CopyFiles=/var/tmp/files:/
$ truncate /var/tmp/disk -s 300M
$ sudo systemd-repart --dry-run=no --empty=require --definitions=/var/tmp/conf /var/tmp/disk
...
Populating vfat filesystem.
Failed to copy '...' to '/run/systemd/mount-root/': Operation not permitted
(sd-copy) failed with exit status 1.

The issue is that if there's a file owned by non-root and we try to copy
it into a newly-created DOS partition, fchown fails:
  fchown(11</run/systemd/mount-root/...>, 1000, 1000) = -1 EPERM (Operation not permitted)
We want to ignore file ownership in such cases, so pass our own UID/GID
to copy_tree_at(), which turns the fchown into a noop and let's the
operation pass through.

Fixes #38863.
2026-06-03 16:02:58 +02:00
Zbigniew Jędrzejewski-Szmek 230a38ea52 repart: perform an early check for missing mkfs or fs contents
I was running repart in a VM, and if failed because mkfs.vfat was
not available. But if fails quite late in the process, possibly wasting
quite a bit of work. So add a check that catches some obvious cases
where repart would fail.

The condition of whether we have the root directory is complex,
determined in part by partition_target_prepare(). I didn't think it
was worth it to recreate the full logic in the check, so in some cases
it'll not miss cases. But that's still better than having no check ;)
2026-06-03 16:02:58 +02:00
nikstur c6bfcf0977 libfido2-util: remove superfluous asserts
These asserts don't make sense and actually break the FIDO2 support in
systemd-cryptsetup.

Follow-up for bd141bd818
2026-06-03 12:01:17 +01:00
Zbigniew Jędrzejewski-Szmek 112b565756 Add DLOPEN macros that stamp the caller's ELF and use it to ensure executables list their dlopen dependencies (#42398)
Currently almost all the dlopens happen in libbasic or libshared code,
so the ELF dlopen notes all end up in libsystemd-shared. Many
distributions split this library and various binaries in separate
packages, and the library ends up with soft-dependencies, even though
many binaries are either completely useless or do not work at all with
the dlopen dependency. This also makes it impossible to know which
executable uses which dlopen dependency without inspecting the source
code.

If someone only wants to add the soft dependencies from libshared they
can just avoid parsing the executable binaries. By design the code in
libbasic/libshared still does the stamping too, at lower priorities, so
that libsystemd-shared will always list all the optional dependencies,
and if one wants to build a minimal system by default, they can just
parse libsystemd-shared dlopen notes, and ignore the individual
executables. But for many distribution the current setup is insufficient
and requires adding a ton of manual library dependencies, as many
executables become effectively broken or useless without the dlopen
dependencies installed (eg: resolved fails to start without libssl,
repart can do basically nothing without blkid, etc).

Add a new set of DLOPEN_<LIB> macros that wrap the dlopen_lib and also
pull in the ELF note voodoo, so that the callers get their ELF binaries
stamped too. Convert a bunch of callers to use the macro, and use
`required` dependencies for the callers that do not work without the
dlopen library being available.

The one caveat is that, in order to avoid duplicating the exact same
note in a binary due to multiple call sites, some `asm` voodoo is done
instead of the previous bare-C section-creating macro. The drawback of
this approach is that if `--gc-sections` is used to link the binary (as
we do), then binutils >= 2.36 is required for the `SHF_GNU_RETAIN` flag.
This effectively cuts off CentOS 9, so what I did here is adding an
override in meson to detect missing support, and drop `SHF_GNU_RETAIN`.
The build works, but on CentOS 9 there's no dlopen ELF notes anymore.
Given it's just that version, and it goes EOL next year, that seems ok
to me. The alternative is to drop the usage of `--gc-sections` on CentOS
9, or to accept duplicated notes everywhere, and both seem worse.

End result:

```
$ readelf --notes build/systemd-executor

Displaying notes found in: .note.gnu.property
  Owner                Data size 	Description
  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0
      Properties: x86 ISA needed: x86-64-baseline

Displaying notes found in: .note.gnu.build-id
  Owner                Data size 	Description
  GNU                  0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 8a0c3db54adb79ae54e1432255011aa4ab583742

Displaying notes found in: .note.ABI-tag
  Owner                Data size 	Description
  GNU                  0x00000010	NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 3.2.0

Displaying notes found in: .note.dlopen
  Owner                Data size 	Description
  FDO                  0x0000006b	FDO_DLOPEN_METADATA
    Dlopen Metadata: [{"feature":"pam","description":"Support for LinuxPAM","priority":"recommended","soname":["libpam.so.0"]}]
  FDO                  0x0000007c	FDO_DLOPEN_METADATA
    Dlopen Metadata: [{"feature":"seccomp","description":"Support for Seccomp Sandboxes","priority":"recommended","soname":["libseccomp.so.2"]}]
  FDO                  0x00000090	FDO_DLOPEN_METADATA
    Dlopen Metadata: [{"feature":"bpf","description":"Support firewalling and sandboxing with BPF","priority":"recommended","soname":["libbpf.so.1","libbpf.so.0"]}]
  FDO                  0x000000a0	FDO_DLOPEN_METADATA
    Dlopen Metadata: [{"feature":"cryptsetup","description":"Support for disk encryption, integrity, and authentication","priority":"recommended","soname":["libcryptsetup.so.12"]}]
  FDO                  0x00000078	FDO_DLOPEN_METADATA
    Dlopen Metadata: [{"feature":"mount","description":"Support for mount enumeration","priority":"recommended","soname":["libmount.so.1"]}]

$ readelf --notes build/systemd

Displaying notes found in: .note.gnu.property
  Owner                Data size 	Description
  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0
      Properties: x86 ISA needed: x86-64-baseline

Displaying notes found in: .note.gnu.build-id
  Owner                Data size 	Description
  GNU                  0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: dcd4568842e32da3e71be27db3def51c6b459994

Displaying notes found in: .note.ABI-tag
  Owner                Data size 	Description
  GNU                  0x00000010	NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 3.2.0

Displaying notes found in: .note.dlopen
  Owner                Data size 	Description
  FDO                  0x00000075	FDO_DLOPEN_METADATA
    Dlopen Metadata: [{"feature":"mount","description":"Support for mount enumeration","priority":"required","soname":["libmount.so.1"]}]
  FDO                  0x00000072	FDO_DLOPEN_METADATA
    Dlopen Metadata: [{"feature":"selinux","description":"Support for SELinux","priority":"recommended","soname":["libselinux.so.1"]}]
```
2026-06-02 18:05:34 +02:00
Luca Boccassi a46ec24ddb core: avoid false maybe-uninitialized warning
2026-05-29T18:00:43.7496388Z ../src/core/dynamic-user.c: In function ‘dynamic_user_realize’:
2026-05-29T18:00:43.7497098Z ../src/core/dynamic-user.c:436:29: error: ‘new_uid’ may be used uninitialized [-Werror=maybe-uninitialized]
2026-05-29T18:00:43.7497758Z   436 |                         num = new_uid;
2026-05-29T18:00:43.7498026Z       |                         ~~~~^~~~~~~~~
2026-05-29T18:00:43.7498465Z ../src/core/dynamic-user.c:361:23: note: ‘new_uid’ was declared here
2026-05-29T18:00:43.7498802Z   361 |                 uid_t new_uid;
2026-05-29T18:00:43.7499039Z       |                       ^~~~~~~
2026-05-29T18:00:43.7499315Z In file included from ../src/core/dynamic-user.c:23:
2026-05-29T18:00:43.7499651Z In function ‘dynamic_user_push’,
2026-05-29T18:00:43.7500063Z     inlined from ‘dynamic_user_realize’ at ../src/core/dynamic-user.c:453:13:
2026-05-29T18:00:43.7501021Z ../src/basic/socket-util.h:131:63: error: ‘new_uid_lock_fd’ may be used uninitialized [-Werror=maybe-uninitialized]
2026-05-29T18:00:43.7501897Z   131 | #define send_one_fd_iov(transport_fd, fd, iov, iovlen, flags) send_one_fd_iov_sa(transport_fd, fd, iov, iovlen, NULL, 0, flags)
2026-05-29T18:00:43.7502530Z       |                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2026-05-29T18:00:43.7503145Z ../src/core/dynamic-user.c:320:16: note: in expansion of macro ‘send_one_fd_iov’
2026-05-29T18:00:43.7503647Z   320 |         return send_one_fd_iov(d->storage_socket[1], lock_fd, &iov, 1, MSG_DONTWAIT);
2026-05-29T18:00:43.7504027Z       |                ^~~~~~~~~~~~~~~
2026-05-29T18:00:43.7504397Z ../src/core/dynamic-user.c: In function ‘dynamic_user_realize’:
2026-05-29T18:00:43.7504888Z ../src/core/dynamic-user.c:360:21: note: ‘new_uid_lock_fd’ was declared here
2026-05-29T18:00:43.7505256Z   360 |                 int new_uid_lock_fd;
2026-05-29T18:00:43.7505511Z       |                     ^~~~~~~~~~~~~~~
2026-05-29T18:00:43.7505882Z ../src/core/dynamic-user.c: In function ‘dynamic_user_current’:
2026-05-29T18:00:43.7506461Z ../src/core/dynamic-user.c:468:15: error: ‘uid’ may be used uninitialized [-Werror=maybe-uninitialized]
2026-05-29T18:00:43.7506895Z   468 |         uid_t uid;
2026-05-29T18:00:43.7507096Z       |               ^~~

2026-05-29T18:26:14.2420944Z In function ‘dynamic_user_push’,
2026-05-29T18:26:14.2421730Z     inlined from ‘dynamic_user_realize’ at ../src/core/dynamic-user.c:453:13:
2026-05-29T18:26:14.2435240Z ../src/basic/socket-util.h:131:63: error: ‘new_uid_lock_fd’ may be used uninitialized [-Werror=maybe-uninitialized]
2026-05-29T18:26:14.2440497Z   131 | #define send_one_fd_iov(transport_fd, fd, iov, iovlen, flags) send_one_fd_iov_sa(transport_fd, fd, iov, iovlen, NULL, 0, flags)
2026-05-29T18:26:14.2442511Z       |                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2026-05-29T18:26:14.2445002Z ../src/core/dynamic-user.c:320:16: note: in expansion of macro ‘send_one_fd_iov’
2026-05-29T18:26:14.2445727Z   320 |         return send_one_fd_iov(d->storage_socket[1], lock_fd, &iov, 1, MSG_DONTWAIT);
2026-05-29T18:26:14.2448345Z       |                ^~~~~~~~~~~~~~~
2026-05-29T18:26:14.2448952Z ../src/core/dynamic-user.c: In function ‘dynamic_user_realize’:
2026-05-29T18:26:14.2451781Z ../src/core/dynamic-user.c:360:21: note: ‘new_uid_lock_fd’ was declared here
2026-05-29T18:26:14.2452287Z   360 |                 int new_uid_lock_fd;
2026-05-29T18:26:14.2454430Z       |                     ^~~~~~~~~~~~~~~
2026-05-29T18:26:14.2454960Z ../src/core/dynamic-user.c: In function ‘dynamic_user_current’:
2026-05-29T18:26:14.2457632Z ../src/core/dynamic-user.c:468:15: error: ‘uid’ may be used uninitialized [-Werror=maybe-uninitialized]
2026-05-29T18:26:14.2458207Z   468 |         uid_t uid;
2026-05-29T18:26:14.2460327Z       |               ^~~
2026-06-02 13:20:29 +01:00
Luca Boccassi b240ce9642 ci: add build/unit-test coverage for armv7 (#42386)
arm64 hosts support running armv7 (armhf) binaries, so we can
cross compile and run the unit tests without performance issues.

armv7 (armhf) is a primary architecture on Ubuntu, so build
regressions block new version updates, and adding coverage
helps to avoid introducing regressions.
2026-06-02 13:15:50 +01:00
elysia090 87b81528a8 resolved: process networkd events before RTNL updates
resolved watches networkd state changes and RTNL updates separately. RTNL is
currently processed at SD_EVENT_PRIORITY_IMPORTANT, while networkd state
changes are processed later at SD_EVENT_PRIORITY_IMPORTANT+5.

If both are pending, an RTM_NEWADDR update can make a link relevant for
LLMNR/mDNS scope allocation before resolved has consumed the corresponding
networkd state update. This can let scope recalculation use stale per-link
settings until the networkd event is processed.

Run the networkd monitor source before RTNL by using
SD_EVENT_PRIORITY_IMPORTANT-5. This lets resolved consume current link settings
before reacting to RTNL address updates in the same event loop iteration.

Fixes #42079
Co-developed-by: OpenAI Codex <noreply@openai.com>
2026-06-02 09:30:53 +01:00
Yu Watanabe 16f72b2468 libarchive-util: update comment for new library symbols
archive_entry_gid_is_set() and archive_entry_uid_is_set() are added by
https://github.com/libarchive/libarchive/commit/8acb738db6bc7087a5e7cdd328bbfb6e673e5bd8 (3.7.3).

archive_entry_hardlink_is_set() is added by
https://github.com/libarchive/libarchive/commit/07206cd172c73cbe3b6b3d64e00f427fa0befa54 (3.7.5).
2026-06-02 15:01:06 +09:00
Yu Watanabe f75bf007f9 Emit a hint when called with the legacy telinit syntax (#42404) 2026-06-02 11:02:09 +09:00
Luca Boccassi b811fa5b32 vmspawn: enforce minimum uptime with --console=gui
When using --console=gui the QEMU window closes immediately when the VM
has stopped, so any console output at shutdown is lost, which makes
debugging difficult. Ensure the VM stays booted for a minimum of 15s.
2026-06-01 18:59:20 +01:00
Luca Boccassi b0ede9f9ee tree-wide: convert dlopen_*() callers to DLOPEN_* wrapper macros
Switch the executable-owned call sites from the plain dlopen_<lib>()
helpers to the new DLOPEN_<LIB>() macros, so that each binary that loads
an optional library at runtime now carries its own .note.dlopen note
instead of relying solely on libsystemd-shared. Each call site passes a
priority reflecting whether it hard-depends on the library (required) or
degrades gracefully without it (recommended).

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 18:46:24 +01:00
Luca Boccassi 7b62f9b4f5 shutdown: do not delay VM shutdown
Since this was introduced I constantly find myself waiting for VMs to
shut down at the end of a test. This not only happens with mkosi integration
tests, but with other VM-based tests like for example autopkgtest. In this
example, this dracut test suite runtime is tripled due to the artificial delay:

[    5.813234] systemd-shutdown[1]: Syncing filesystems and block devices.
[    5.814635] systemd-shutdown[1]: Delaying shutdown for 9s, in order to reach minimum uptime of 15s.
[    8.816855] systemd-shutdown[1]: Delaying shutdown for 6s, in order to reach minimum uptime of 15s.
[   11.819747] systemd-shutdown[1]: Delaying shutdown for 3s, in order to reach minimum uptime of 15s.
[   14.822660] systemd-shutdown[1]: Delaying shutdown for 601ms, in order to reach minimum uptime of 15s.
[   15.427777] systemd-shutdown[1]: Powering off.
[   15.429681] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[   15.433620] ACPI: PM: Preparing to enter system sleep state S5
[   15.435148] reboot: Power down
TEST: root filesystem on a ext4 filesystem with systemd and extensions   [OK]
autopkgtest [19:39:12]: test 46-systemd-sysext: -----------------------]
autopkgtest [19:39:13]: test 46-systemd-sysext:  - - - - - - - - - - results - - - - - - - - - -
46-systemd-sysext    PASS

Contrary to what the comment claimed, the scrollback of a VM is _not_
cleared, EDK2 just prints many pages, and one can just scroll up (a lot).

Do not delay by default on VMs. Move the check so that in both containers
and VMs users can override and force a delay with the env var.

Follow-up for 0874eea302
2026-06-01 18:41:17 +01:00
Luca Boccassi 590e226437 shared: add DLOPEN_* wrapper macros that stamp .note.dlopen on callers
This macro emits an SD_ELF_NOTE_DLOPEN note so that calling sites,
and not just libsystemd-shared, get the ELF stamped with the notes
documenting the dependency. Currently most of the dlopen notes end
up in libsystemd-shared, and executables have no way to document
the optional dependencies they need. With this new macro, this
issue can be fixed.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 18:24:15 +01:00
Luca Boccassi 56a7febca7 sd-dlopen: deduplicate identical .note.dlopen notes
If the SD_ELF_NOTE_DLOPEN macro gets used twice in the same binary,
with identical content, it will add two identical notes, which is
wasteful and confusing.

Emit each note into a COMDAT group keyed on its JSON payload, with an
assembler .ifndef guard, so byte-identical notes fold to a single copy
within a translation unit (assembler) and across translation units
(linker). The section is marked SHF_GNU_RETAIN so --gc-sections keeps it,
and uses the portable "%note" section type so it also assembles on
architectures where "@" is the comment character (e.g. 32-bit ARM).

This ensures SD_ELF_NOTE_DLOPEN can be used as many times as needed,
and the result will be automatically deduplicated.

The SHF_GNU_RETAIN (R) flag requires binutils >= 2.36, which cuts
off CentOS 9. To avoid breaking builds, override the flags passed
to the linker to skip that flag. This unfortunately means in many
cases the ELF notes section will be dropped by the linker due to
--gc-sections. For CentOS 9 builds, the choice is thus between
not using --gc-sections and losing dlopen ELF notes, and the latter
is made here given it's less impactful.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 18:24:15 +01:00
George Tsiamasiotis 7070032728 nspawn: parse PrivateUsers=managed in settings 2026-06-01 17:35:10 +01:00
Lennart Poettering 95c7dc3308 hostname-util: don't allow machine tags to begin/end with '-' or '.' 2026-06-01 12:16:28 +01:00
Zbigniew Jędrzejewski-Szmek b1410258f8 manager: if called with compat telinit interface, tell users to update
In https://bugzilla.redhat.com/show_bug.cgi?id=2479961 a user
reported that they are confused that 'init 6' and such commands
do not work anymore. We removed support for the whole interface,
but it's likely that such commands persist in various scripts
and finger memories. Let's give a helpful hint that this inteface
is gone and what to use instead.
2026-06-01 12:19:03 +02:00
Luca Boccassi 8ff7a5cd09 journalctl: don't assert on MESSAGE field without "MESSAGE=" prefix
sd_journal_get_data() can return a MESSAGE data object whose payload does
not start with "MESSAGE=", e.g. when the journal file is corrupted. Instead
of aborting the whole process, log and skip over such an entry like we do for
other bad/missing fields.

[   87.287390] post.sh[1619]: + journalctl -q -o short-monotonic --grep 'didn'\''t pass validation'
[   87.287844] post.sh[1620]: + grep -v test-varlink-idl
[   87.325676] post.sh[1619]: Assertion 'message = startswith(message, "MESSAGE=")' failed at src/journal/journalctl-show.c:261, function show(). Aborting.

 #0  0x00007fb47b49a29c n/a (libc.so.6 + 0x9a29c)
 #1  0x00007fb47b43e7d0 raise (libc.so.6 + 0x3e7d0)
 #2  0x00007fb47b425681 abort (libc.so.6 + 0x25681)
 #3  0x00007fb47b8a1ace log_assert_failed (libsystemd-shared-261~rc2.so + 0xa1ace)
 #4  0x000055f8e1ef9ddb show (journalctl + 0xcddb)
 #5  0x000055f8e1efa6ee action_show (journalctl + 0xd6ee)
 #6  0x000055f8e1ef3c20 run (journalctl + 0x6c20)
 #7  0x00007fb47b427741 n/a (libc.so.6 + 0x27741)
 #8  0x00007fb47b427879 __libc_start_main (libc.so.6 + 0x27879)
 #9  0x000055f8e1ef4915 _start (journalctl + 0x7915)

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 23:02:25 +01:00
Luca Boccassi 6b0492096e libfido2: enable translations for Plymouth strings (#42389)
- This synchronize the state for existing stuff.
- Enable translations for Plymouth interaction strings.
- Translate them in French as an example.

Fixes #42384.
2026-05-30 10:38:46 +01:00
Raito Bezarius 45164c57f8 shared/libfido2: translate Plymouth interaction strings
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2026-05-30 00:20:00 +02:00
Luca Boccassi 595d3d593c test: skip test-execute and ukify addon test when cross-compiling
These tests run native tools on foreign ELF files, so they fail,
just skip them when cross-compiling
2026-05-29 17:48:52 +01:00
Luca Boccassi 0fd7b5ea5f test: avoid false maybe-uninitialized warning
2026-05-29T16:05:02.6627742Z In file included from ../src/basic/../fundamental/assert-util.h:8,
2026-05-29T16:05:02.6628349Z                  from ../src/basic/assert-util.h:4,
2026-05-29T16:05:02.6628722Z                  from ../src/basic/basic-forward.h:17,
2026-05-29T16:05:02.6629044Z                  from ../src/libsystemd/sd-common/sd-forward.h:6,
2026-05-29T16:05:02.6629361Z                  from ../src/shared/shared-forward.h:6,
2026-05-29T16:05:02.6629648Z                  from ../src/shared/crypto-util.h:4,
2026-05-29T16:05:02.6631153Z                  from ../src/test/test-crypto-util.c:3:
2026-05-29T16:05:02.6634148Z ../src/test/test-crypto-util.c: In function ‘test_digest_size’:
2026-05-29T16:05:02.6634986Z ../src/basic/../fundamental/macro.h:95:41: error: ‘size’ is used uninitialized [-Werror=uninitialized]
2026-05-29T16:05:02.6635470Z    95 | #define _unlikely_(x) (__builtin_expect(!!(x), 0))
2026-05-29T16:05:02.6635764Z       |                                         ^~~~~
2026-05-29T16:05:02.6636287Z ../src/basic/../fundamental/assert-util.h:59:21: note: in expansion of macro ‘_unlikely_’
2026-05-29T16:05:02.6636963Z    59 |                 if (_unlikely_(!(expr)))                                \
2026-05-29T16:05:02.6637344Z       |                     ^~~~~~~~~~
2026-05-29T16:05:02.6637864Z ../src/basic/../fundamental/assert-util.h:65:25: note: in expansion of macro ‘assert_message_se’
2026-05-29T16:05:02.6638339Z    65 | #define assert_se(expr) assert_message_se(expr, #expr)
2026-05-29T16:05:02.6638642Z       |                         ^~~~~~~~~~~~~~~~~
2026-05-29T16:05:02.6639066Z ../src/test/test-crypto-util.c:136:17: note: in expansion of macro ‘assert_se’
2026-05-29T16:05:02.6639450Z   136 |                 assert_se(size == t->size);
2026-05-29T16:05:02.6639704Z       |                 ^~~~~~~~~
2026-05-29T16:05:02.6640063Z ../src/test/test-crypto-util.c:132:16: note: ‘size’ declared here
2026-05-29T16:05:02.6640590Z   132 |         size_t size;
2026-05-29T16:05:02.6640794Z       |                ^~~~
2026-05-29 17:48:50 +01:00
Luca Boccassi b3f50b9515 core: fix maybe-uninitialized warning
2026-05-29T13:14:20.8990848Z arm-linux-gnueabihf-gcc -Isrc/core/libsystemd-core-261.a.p -Isrc/core -I../src/core -Isrc/shared -I../src/shared -Isrc/bpf -I../src/bpf -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-common -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-future -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -Isrc/libsystemd/sd-journal -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-json -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-path -I../src/libsystemd/sd-resolve -I../src/libsystemd/sd-varlink -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -Isrc/version -I../src/version -I/usr/include/uuid -I/usr/include/json-c -I/usr/include/blkid -I/usr/include/libmount -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=gnu17 -O0 -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=bool-compare -Werror=discarded-qualifiers -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=pointer-sign -Werror=return-type -Werror=sequence-point -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=strict-flex-arrays -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fexcess-precision=standard -fno-common -fstack-protector -fstack-protector-strong -fstrict-flex-arrays=3 -fno-math-errno --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -O2 -pipe -g -feliminate-unused-debug-types -fPIC -fno-strict-aliasing -fstrict-flex-arrays=1 -fvisibility=hidden -fno-omit-frame-pointer -include config.h -isystem../src/include/glibc -isystem../src/include/override -isystemsrc/include/override -isystem../src/include/uapi -fvisibility=default -MD -MQ src/core/libsystemd-core-261.a.p/unit.c.o -MF src/core/libsystemd-core-261.a.p/unit.c.o.d -o src/core/libsystemd-core-261.a.p/unit.c.o -c ../src/core/unit.c
2026-05-29T13:14:20.9001764Z ../src/core/unit.c: In function ‘unit_start_on_termination_deps’:
2026-05-29T13:14:20.9002500Z ../src/core/unit.c:2367:21: error: ‘job_mode’ may be used uninitialized [-Werror=maybe-uninitialized]
2026-05-29T13:14:20.9004088Z  2367 |                 r = manager_add_job(u->manager, JOB_START, other, job_mode, &error, /* ret= */ NULL);
2026-05-29T13:14:20.9004619Z       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2026-05-29T13:14:20.9005147Z ../src/core/unit.c:2341:17: note: ‘job_mode’ was declared here
2026-05-29T13:14:20.9005458Z  2341 |         JobMode job_mode;
2026-05-29T13:14:20.9005673Z       |                 ^~~~~~~~
2026-05-29T13:14:20.9005898Z cc1: all warnings being treated as errors

Follow-up for 9faeb2d024
2026-05-29 17:48:37 +01:00
Luca Boccassi 7195c668ce sysupdate: fix bogus return code
2026-05-29T13:44:48.7158429Z In file included from ../src/basic/../fundamental/assert-util.h:8,
2026-05-29T13:44:48.7159224Z                  from ../src/basic/assert-util.h:4,
2026-05-29T13:44:48.7159990Z                  from ../src/basic/basic-forward.h:17,
2026-05-29T13:44:48.7160337Z                  from ../src/basic/alloc-util.h:6,
2026-05-29T13:44:48.7161366Z                  from ../src/sysupdate/sysupdate-transfer.c:9:
2026-05-29T13:44:48.7169020Z ../src/sysupdate/sysupdate-transfer.c: In function ‘transfer_acquire_instance’:
2026-05-29T13:44:48.7169957Z ../src/basic/../fundamental/macro.h:190:37: error: ‘r’ may be used uninitialized [-Werror=maybe-uninitialized]
2026-05-29T13:44:48.7170483Z   190 |                 default:            __builtin_llabs((long long) (a)))
2026-05-29T13:44:48.7171001Z       |                                     ^~~~~~~~~~~~~~~
2026-05-29T13:44:48.7171435Z ../src/basic/log.h:32:46: note: in expansion of macro ‘ABS’
2026-05-29T13:44:48.7171800Z    32 | #define ERRNO_VALUE(val)                    (ABS(val) & ~(1 << 30))
2026-05-29T13:44:48.7172134Z       |                                              ^~~
2026-05-29T13:44:48.7172528Z ../src/basic/log.h:188:28: note: in expansion of macro ‘ERRNO_VALUE’
2026-05-29T13:44:48.7173003Z   188 |                         : -ERRNO_VALUE(_e);                             \
2026-05-29T13:44:48.7173317Z       |                            ^~~~~~~~~~~
2026-05-29T13:44:48.7173779Z ../src/basic/log.h:208:17: note: in expansion of macro ‘log_full_errno_zerook’
2026-05-29T13:44:48.7174204Z   208 |                 log_full_errno_zerook(level, (int)_error, __VA_ARGS__); \
2026-05-29T13:44:48.7174528Z       |                 ^~~~~~~~~~~~~~~~~~~~~
2026-05-29T13:44:48.7174917Z ../src/basic/log.h:233:41: note: in expansion of macro ‘log_full_errno’
2026-05-29T13:44:48.7175401Z   233 | #define log_error_errno(error, ...)     log_full_errno(LOG_ERR,     error, __VA_ARGS__)
2026-05-29T13:44:48.7175799Z       |                                         ^~~~~~~~~~~~~~
2026-05-29T13:44:48.7176318Z ../src/sysupdate/sysupdate-transfer.c:1346:32: note: in expansion of macro ‘log_error_errno’
2026-05-29T13:44:48.7176931Z  1346 |                         return log_error_errno(r, "SHA256 checksum not known for download '%s', refusing.", i->path);
2026-05-29T13:44:48.7177514Z       |                                ^~~~~~~~~~~~~~~
2026-05-29T13:44:48.7178157Z ../src/sysupdate/sysupdate-transfer.c:1270:13: note: ‘r’ was declared here
2026-05-29T13:44:48.7178501Z  1270 |         int r;

Follow-up for 43cc7a3ef4
2026-05-29 17:48:37 +01:00
Luca Boccassi 3db89cbf0e hwdb: reject overlong fnmatch key instead of passing NULL to fnmatch()
When the accumulated trie key exceeds the fixed-size line buffer,
linebuf_get() returns NULL. trie_fnmatch_f() passed that NULL straight
into fnmatch() as the pattern, causing a SIGSEGV on a crafted hwdb.bin
(reachable now that recursion is capped rather than overflowing the
stack first). Treat the NULL like the other corruption checks and
return -EBADMSG.

Follow-up for 73fea38cf1

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

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-29 17:21:31 +01:00
Daan De Meyer 6ec161c5b9 ssh-proxy: Default to root user
When ssh-ing into a VM, you generally do not want to log
in as your user from the host. Let's default to the root
user unless a user is explicitly specified.
2026-05-29 16:13:29 +02:00
Daan De Meyer 0a63318420 ssh-generator: Make sure sshd can always read the authorized keys file
sshd reads AuthorizedKeysFile after dropping to the authenticating user's UID, so the
0400 credential file under %d/ is unreadable for non-root users. Materialize a 0444
copy in a RuntimeDirectory so the ephemeral key works for any user. */
2026-05-29 16:12:45 +02:00
Yu Watanabe f8fbee74ba network: mention interface name in polkit details
Closes #42274.
2026-05-29 04:34:18 +09:00
jeffhuang 0c5cba6420 pe-binary: bound section data against file size, cap UKI zero-padding hash, validate optional header size
A hostile but structurally valid 382-byte PE32+ "EFI application" with a
single section whose VirtualSize is ~4 GiB and SizeOfRawData is 0 drives
uki_hash() into ~4.17 M iterations of SHA-256 over 1024 bytes of zeros
— wedging the parser for >10 s. Nine more slow-units share the same
shape. A separate MSAN finding from the new fuzzer (CIFuzz, memory
sanitizer) shows pe_load_headers() reading uninitialised heap memory
when SizeOfOptionalHeader is too small to actually contain
NumberOfRvaAndSizes.

Three tightenings in src/shared/pe-binary.c:

  1. In pe_load_sections, reject sections whose PointerToRawData +
     SizeOfRawData exceeds the actual file size. Raw section data must
     fit inside the file; this is the parser-wide invariant
     pe_hash / uki_hash / pe_read_section_data rely on.

  2. In uki_hash, cap the (VirtualSize - SizeOfRawData) zero-padding
     hash loop at 64 MiB. Real UKIs do not pad sections with tens of
     MiB of zero-equivalent data; anything above this cap is a
     malformed PE.

  3. In pe_load_headers, reject a PE whose SizeOfOptionalHeader is too
     small to cover up to NumberOfRvaAndSizes. Without this guard the
     subsequent size-mismatch check reads uninitialised optional-header
     bytes, caught by MSAN under CIFuzz.

Add the 382 B canonical reproducer (plus two structural siblings) and
the MSAN reproducer to test/fuzz/fuzz-pe-binary/. Also add a libFuzzer
harness in src/fuzz/fuzz-pe-binary.c and unit tests in
src/test/test-pe-binary.c that exercise each fix branch in isolation.
The 64 MiB hash boundary test is gated behind SYSTEMD_SLOW_TESTS so it
doesn't slow down emulated-arch CI.

This is a robustness fix, not a security fix: PE binaries consumed by
bootctl / systemd-stub / pcrlock / kernel-install / systemd-measure are
already trusted and signed at the consumer side, so the worst pre-fix
behaviour is wasted CPU on a UKI install / measure / inspect call.

Closes #42344.

Reported-by: AI-assisted libFuzzer campaign
Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 04:30:48 +09:00
Zbigniew Jędrzejewski-Szmek 97a0ec135b Downgrade warning about missing libseccomp
We currently log at warning level:
/usr/lib/systemd/system/systemd-udevd.service:56: System call bpf cannot be
  resolved as libseccomp is not available, ignoring: Operation not supported

In the initrd, or in minimal installations, not installing libseccomp is
reasonable, depending on various other choices. We shouldn't make fuss
about this.

C.f. https://bugzilla.redhat.com/show_bug.cgi?id=2463540.
2026-05-29 01:09:19 +09:00
Lennart Poettering eb3799a373 fd-util: add wildcard_fd_is_valid() helper and use it tree-wide
Many *at()-style helpers accept a directory fd that may be either a
regular, valid fd (>= 0) or one of the special AT_FDCWD/XAT_FDROOT
wildcard values, and open-code that check in their assertions. Add a
wildcard_fd_is_valid() helper for it and use it tree-wide.
2026-05-28 13:33:08 +01:00
Zbigniew Jędrzejewski-Szmek bf4388ab31 repart: constify Context* params 2026-05-28 12:06:12 +02:00
Zbigniew Jędrzejewski-Szmek fa2a6b6d88 shared/mkfs-util: split out mkfs_find_or_warn() 2026-05-28 12:06:10 +02:00
Malformed C d35fa257eb nspawn: join network namespace before cloning user namespace
When both --private-users and --network-namespace-path are
specified, systemd-nspawn fails to start with "Operation not
permitted" during the setns() call.

This occurs because of the following execution sequence:
1. The outer child calls raw_clone() with CLONE_NEWUSER to create
   the new user namespace.
2. The inner child is spawned inside this new user namespace.
3. The inner child then attempts to call setns() to join the
   external network namespace.

Because the inner child is already running inside
the restricted user namespace, the kernel rejects
the setns() call to join a network namespace owned by
a different (host/more privileged) user namespace.

Fix this by moving the setns() call to the outer child, executing it
just before the raw_clone() call. This ensures the network namespace
is joined while the process still has the necessary privileges, which
also aligns with the inner child's expectation that the network
namespace is already set up upon entry.
2026-05-28 16:53:23 +09:00