Commit Graph
87290 Commits
Author SHA1 Message Date
Daan De Meyer 9d844012bc sd-dhcp-client: several trivial cleanups (#41256) 2026-03-22 20:00:33 +01:00
Yu Watanabe 55f2fdd508 dhcp: fix user class and vendor specific option assignment
The commit 6d7cb9a6b8 fixes the assignment
of the these options when specified through SendOption=. However, it
breaks when specified through UserClass= or SendVendorOption=.

When UserClass= or SendVendorOption= is specified, the option length is
calculated from the sd_dhcp_client.user_class or .vendor_options. Hence,
we can use 0 for the length in that case.

Follow-up for 6d7cb9a6b8.
2026-03-22 19:40:54 +01:00
Frantisek Sumsal 924f5a3461 sd-varlink: gracefully reject arrays/maps with a null element
Follow-up for 799392286e.
2026-03-22 19:37:47 +01:00
Oblivionsage 494c65236b dns-packet: move p->more unref into the free path
dns_packet_unref() unconditionally unrefs p->more on every call,
even when n_ref > 1. But dns_packet_ref() doesn't ref p->more.
This means if a packet with a ->more chain gets ref'd and unref'd
multiple times, the chain gets freed too early while the parent
still holds a dangling pointer.

Move the p->more unref into the n_ref == 1 block so the chain
only gets cleaned up when the packet is actually being freed.
2026-03-21 20:34:39 +01:00
Yu Watanabe 26f769bea3 sd-dhcp-client: propagate errors in client_initialize_{io,time}_events()
Call client_stop() on error and return 0 only on callback.
Normal non-callback functions should propagate errors.

This also makes client_initialize_time_events() use
event_reset_time_relative().
2026-03-22 03:34:43 +09:00
Yu Watanabe ad4d2ae619 sd-dhcp-client: voidify client_initialize()
It never fails.
2026-03-22 03:34:43 +09:00
Yu Watanabe 2fb192d237 sd-dhcp-client: drop disabled FORCERENEW message support
FORCERENEW message support has been disabled so long time for security
concern. Most other implementations of DHCP server/client neither
support FORCERENEW. Let's completely drop relevant code.
2026-03-22 03:34:43 +09:00
Yu Watanabe ddded65d41 sd-dhcp-client: add missing error checks 2026-03-22 03:34:43 +09:00
Yu Watanabe 0c68816c56 sd-dhcp-client: add missing assertion 2026-03-22 03:34:43 +09:00
Yu Watanabe ced607506d sd-dhcp-client: coding style fix 2026-03-22 03:34:43 +09:00
Yu Watanabe bd1d1e61eb fuzz-dhcp-client: modernize test code 2026-03-22 02:26:18 +09:00
Yu Watanabe f0387aa666 test-dhcp-client: modernize test code 2026-03-22 02:26:15 +09:00
Yu Watanabe fce03832fa test-dhcp-client: fix packet length and checksum in IP header 2026-03-21 05:21:28 +09:00
vlefebvre 7c1075fb8f kmod-setup: load vsock_loopback alongside vsock
Loading vmw_vsock_virtio_transport early at boot causes vsock to be
resident before any application opens an AF_VSOCK socket. Because the
kernel skips autoloading when the vsock module is already present,
vsock_loopback never gets loaded automatically, and any subsequent
bind() to VMADDR_CID_LOCAL fails with EADDRNOTAVAIL.

Fix this by explicitly loading vsock_loopback on virtio or VMWare
machines via the new may_have_vsock_looopback() helper, wich covers both
vmw_vsock_virtio_transport and vmware_vsock_vmci_transport case.
vsock_loopback is the only module that registers a transport for
VMADDR_CID_LOCAL (CID 1) and has no hard dependency from any of the
vsock transport modules.

Fixes: #41100
Follow-up for 381c78db491a7c5fad8697543dd36ebe9b848718
2026-03-20 19:25:55 +00:00
Daan De Meyer bb7486db61 mountfsd: Add CAP_SYS_PTRACE and CAP_SYS_CHROOT
CAP_SYS_PTRACE for making sure we can open mount namespaces of
peers via /proc/<pid>/ns and CAP_SYS_CHROOT for making sure we can
join those mount namespaces.
2026-03-20 19:19:10 +01:00
David Santamaría Rogado 93f1546b93 hwdb: keyboard: erase entry that will never match
The match in "AYA NEO" will never happen as dmi modalias will wipe blank
spaces. Even more the intended match was covered before by "AYANEO".

Actually there are contributions that rely on someone giving some data
to other someone with no test at all.

Should be consider to enforce the full udevadm info --export-db as
mandatory requirement fot this kind of contributions.
2026-03-20 17:15:00 +01:00
David Tardon 5d0488ab0f integritysetup: regularize conversion of integrity alg.
The number of integrity algorithms we handle whose names differ between
integritysetup and dm-integrity continually increases, so let's drop the
ad hoc conversion and use string tables.
2026-03-20 17:12:29 +01:00
Zbigniew Jędrzejewski-Szmek 77549ac1c4 Stop disabling -Wattributes (#41174)
In one of the reviews one of the LLMs noticed that the pragma is set but
never unset, so it remains in effect for the rest of the translation
unit. From the comment, it's not clear how old those "old compilers"
were, so let's try if things work without this workaround.
2026-03-20 17:10:10 +01:00
Lennart Poettering 7876bd5cfc env-file: add parse_env_data() helper 2026-03-20 16:34:58 +01:00
Daan De Meyer 226525b432 make static hostname settable via firstboot credential (#41212)
Split out of #40980
2026-03-20 15:50:51 +01:00
Daan De Meyer 12bca754d8 shared: extract socket_forward_new() helper from socket-proxyd (#41168) 2026-03-20 15:45:33 +01:00
David Santamaría Rogado de0314a11f hwdb: sensor: fix bncf newbook 11
Actually was found that this device has panel mount at -90º. This fixes
the matrix to follow panel orientation.

More info in the previous PR comments:
https://github.com/systemd/systemd/pull/40773

Fixes: 774e805959
2026-03-20 15:44:19 +01:00
David Santamaría Rogado afc418daa6 sensor: gpd fix matches
Actually for example the Win Max 2 match is affecting devices that even
didn't exist when the matrix was added.
2026-03-20 15:44:04 +01:00
Lennart Poettering 2c74a91cb8 sd-json: when parsing optionally insist top-level variant is object or array
Typically, the top-level JSON object has to be an object, in any json
document we parse, hence let's add a simple way to enforce that.

Make use of this in various places.

(Note, various other JSON parsers insist on this logic right from the
beginning, but I actually thinking making this insisting optional like
this patch does it is the cleaner approach)
2026-03-20 15:34:56 +01:00
Zbigniew Jędrzejewski-Szmek 7e14d3b979 boot: inline a single-use variable
Also, in general we prefer variables that are always defined over
checking with #ifdef, so #if defined(HAVE_NO_STACK_PROTECTOR_ATTRIBUTE)
is something that we want to avoid.
2026-03-20 15:27:57 +01:00
Clayton Craft bc6380ae07 nsresourced: fix BPF loading when using kernel compiled with Clang
This fixes an issue where nsresourced fails to load BPF on kernels
compiled with Clang (this output was from v259):

    $ sudo env SYSTEMD_LOG_LEVEL=debug /usr/lib/systemd/systemd-nsresourced
    ; int BPF_PROG(userns_restrict_path_chown, struct path *path, void* uid, void *gid, int ret) { @ userns-restrict.bpf.c:134
    ...
    ; return validate_path(path, ret); @ userns-restrict.bpf.c:135
    ...
    ; static int validate_path(const struct path *path, int ret) { @ userns-restrict.bpf.c:120
    ...
    ; task = (struct task_struct*) bpf_get_current_task_btf(); @ userns-restrict.bpf.c:84
    ...
    ; task_userns = task->cred->user_ns; @ userns-restrict.bpf.c:85
    ...
    R2 invalid mem access 'rcu_ptr_or_null_'

When Clang is used (which sets CONFIG_PAHOLE_HAS_BTF_TAG), btf_type_tag
support is enabled. As a result, an rcu type tag is added to
task_struct::cred:

    $ bpftool btf dump file /sys/kernel/btf/vmlinux | grep "STRUCT 'task_struct'"
    [459] STRUCT 'task_struct' size=4672 vlen=242

    $ bpftool btf dump file /sys/kernel/btf/vmlinux | grep -A200 "^\[459\] STRUCT 'task_struct'" | grep cred
	    'ptracer_cred' type_id=802 bits_offset=14528
	    'real_cred' type_id=802 bits_offset=14592
	    'cred' type_id=802 bits_offset=14656

    $ bpftool btf dump file /sys/kernel/btf/vmlinux | grep '^\[802\]'
    [802] PTR '(anon)' type_id=801

    $ bpftool btf dump file /sys/kernel/btf/vmlinux | grep '^\[801\]'
    [801] TYPE_TAG 'rcu' type_id=803

Since the struct ptr *could* be null, we have to add a null pointer
check to satisfy the bpf verifier.
2026-03-20 15:27:08 +01:00
Zbigniew Jędrzejewski-Szmek fabc22f599 meson: disable __attribute__((__retain__)) on old compilers
This attribute was introduced in gcc 11, and our baseline is currently
8.4. So let's allow using _retain_ everywhere, but make it into a noop
if not supported.

Using __has_attribute was suggested, but with gcc-11.5.0-14.el9.x86_64,
__has__attribute(__retain__) is true, but we get a warning when the
attribute is actually used.
2026-03-20 15:26:47 +01:00
Luca Boccassi 69c087bade test: skip D-Bus FD truncation test with dbus-daemon
dbus-daemon intentionally disconnects peers when FDs get
truncated. Detect it and skip it in that case, as the purpose
of the test is not to exercise the D-Bus implementation, but
our library.
When running with dbus-broker (Fedora, etc) we'll get full
coverage.

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

Follow-up for 744d589632
2026-03-20 15:25:26 +01:00
Robin Ebert 55e7dc5ce4 kernel-install: fix assert in context_copy 2026-03-20 15:17:44 +01:00
Daan De Meyer ea68a9385e imds preparation (#41214) 2026-03-20 15:14:21 +01:00
Lennart Poettering dae21304ff stub: make debug logging controllable via smbios11 work in the stub too, not just the boot menu
Follow-up for: 0ce83b8a57
2026-03-20 13:56:44 +00:00
Lennart Poettering 4c49e864b0 firstboot: permit setting the static hostname via a system credential
For the IMDS case there's value in being able to set the static
hostname, instead of just the transient one. Let's introduce
firstboot.hostname, which only applies to first boot, and write the
static hostname. This is different from system.hostname which applies to
any boot, and writes the transient hostname.
2026-03-20 12:39:44 +01:00
Lennart Poettering 4460a4ba21 firstboot: harden credential handling a bit
Credentials are highly privileged things, but still, let's do some
validation, because we can.
2026-03-20 12:39:44 +01:00
Lennart Poettering 56f3ae9292 iovec-util: introduce IOVEC_MAKE_BYTE() helper 2026-03-20 11:53:33 +01:00
Lennart Poettering 56356c9dec udev: tag DMI id device with "systemd", so that we can order units after it
For various usecases it is useful to read relevant data from the DMI
udev device, but this means we need a way to wait for it for this to be
probed to be race-free. Hence tag it with "systemd", so that
sys-devices-virtual-dmi-id.device can be used as synchronization point.
2026-03-20 11:53:33 +01:00
Lennart Poettering 6738762688 fileio: introduce write_data_file_atomic_at() helper
This is very similar to write_string_file_atomic(), but is intentionally
kept separate (after long consideration). It focusses on arbitrary
struct iovec data, not just strings, and hence also doesn't do stdio at
all. It's hence a lot more low-level.

We might want to consider moving write_string_file*() on top of
write_data_file_atomic_at(), but for now don't.
2026-03-20 11:53:33 +01:00
Michael Vogt 9a708c5115 shared: extract socket_forward_new() helper from socket-proxyd
This commit extracts the socket forwarding code from the existing
socket-proxyd into a new shared helper that will be used by the
varlinkctl protocol upgrade support code and is used as is in
the socket-proxyd.c.

It tries to keep the changes as small as possible, its mostly
renaming like:
* connection_create_pipes -> socket_forward_create_pipes
* connection_shovel -> socket_forward_shovel
* connection_enable_event_sources -> socket_forward_enable_event_sources
* traffic_cb -> socket_forward_traffic_cb

and a new socket_forward_new() that creates/starts the forwarding.

All log_error_errno() got downgraded to log_debug_errno().
2026-03-20 10:13:34 +01:00
Michael Vogt 55356a7821 units: allow io.systemd.Hostname to be available earlier
Currently the varlink interface for hostname is only available
after sysinit. This means it is not available until systemd-firstboot
is finished. But there is information like the boot-id in there that
is useful to get early.

My use-case is to query the system early via the varlink-http-bridge
and currently I can't get data from io.systemd.Hostname until
systemd-firstboot is completed which is a bit limiting.

So to fix it this commit sets DefaultDependencies=no on both the socket
and service units.

It also changes hostnamed.c to use
bus_open_system_watch_bind_with_description() which means we will
reconnect once dbus is available. This mimics what resolved-bus.c
is doing (and which was originally introduced in d7afd945b).

Thanks to Lennart for pointing this out.
2026-03-20 10:04:26 +01:00
Zbigniew Jędrzejewski-Szmek abb03c7c9d tests: drop _weak_ from the SYSTEMD_TEST_TABLE definition
This will cause test binaries that reference SYSTEMD_TEST_TABLE,
e.g. by trying to iterate over the test list, to fail if no tests are
defined. I think this is the correct thing to do, as the lack of tests
indicates some kind of mistake.
2026-03-20 09:59:58 +01:00
Zbigniew Jędrzejewski-Szmek 4268e95fb9 test-bpf-token: convert "intro" to a test
This file was a bit strange… It was shoehorning a manual test into
the intro block and not using the rest of the TEST machinery. Let's
convert it into a normal executable with a run function as we do
in other similar cases.
2026-03-20 09:59:58 +01:00
Zbigniew Jędrzejewski-Szmek a28dbc9d88 timesyncd: drop obsolete privilege dropping code
systemd-timesyncd always runs as an unprivileged user via the service
file, so the code to resolve the systemd-timesync user, drop privileges
adjust file ownership/permissions, or even create the directory cannot
do anything useful and is unnecessary.

Follow-up for 00a415fc8f, which made
running under an unprivileged user unconditional.
2026-03-20 09:57:55 +01:00
Michael Vogt 541622dfc6 test: add basic TEST-74-AUX-UTILS.socket-proxyd.sh
With the planned extraction of the socket-forward code its useful
to have a basic way to validate the functionality. So add a basic
test that ensures at least base functionality is intact.
2026-03-20 09:37:24 +01:00
Chris Down caed31e148 Various dissect-image cleanups (#41178)
I noticed the message for verity partition mismatch was wrong, which
then led me down this rabbit hole...

Aside from the new test for usr verity partitions, this is 49
insertions(+), 127 deletions(-), and reduces the space for bugs to hide
a bit.
2026-03-20 11:52:32 +08:00
Massii Aqvayli b3388e7cd6 po: Translated using Weblate (Kabyle)
Currently translated at 15.0% (40 of 266 strings)

Co-authored-by: Massii Aqvayli <massiin@proton.me>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/kab/
Translation: systemd/main
2026-03-19 22:13:24 +00:00
Artem Proskurnev f8e31900ce hwdb/keyboard: Map FN key on Wareus B15
After kernel commit 907bc9268a ("Input: atkbd - map F23 key to support default copilot shortcut")
Fn+F5 combination (switch touchpad on/off) stopped working correctly.

Fn produces F23, it is probably a bug in BIOS, ther eis no "Copilot" key.
It was ignored before that commit, but now we have to remap it here in hwdb.

This workaround is similar to systemd commit d2502f5
("hwdb/keyboard: Map FN key on TUXEDO InfinityFlex 14 Gen1")

Hardware probe of this notebook: https://linux-hardware.org/?probe=2d5266f5c6
2026-03-19 19:44:14 +01:00
Chris Down 15a2fdcd96 dissect-image: Add usr verity partition coverage 2026-03-19 22:36:57 +08:00
Zbigniew Jędrzejewski-Szmek bcb65f4b57 test-time-util: restore relaxation of check is special timezones
Fixup for 514fa9d39a. We are now getting
failures in CI i386 builds in Fedora rawhide:
  TZ=Europe/Lisbon, tzname[0]=WET, tzname[1]=WEST
  @212545617716594 → Sun 1976-09-26 00:26:57 WET → @212542017000000 → Sun 1976-09-26 00:26:57 CET
  src/test/test-time-util.c:450: Assertion failed: Expected "ignore" to be true

Restore the conditionalization for CAT, EAT, WET that was removed
in the refactoring.
2026-03-19 14:36:22 +00:00
Chris Down 91578e5293 dissect-image: Consolidate verity validation and setup
The verity consistency checks and verity setup code also have parallel
blocks for root and usr that do basically identical work. Let's
consolidate them and reduce the footprint for bugs or deviance to
manifest.
2026-03-19 21:37:36 +08:00
Chris Down 779e70a8e8 dissect-image: Merge partition handler code
dissect-image has six(!) different branches with basically the same
code. Let's avoid that and reduce the spaces for bugs or differing
behaviour to subtly creep in.
2026-03-19 21:37:36 +08:00
Chris Down 8a66ad0c66 dissect-image: Fix wrong UUID logged on usr verity partition mismatch
When there's a partition mismatch the USR_VERITY branch logs usr_uuid in
the mismatch message, but the check is actually against usr_verity_uuid.
2026-03-19 21:01:54 +08:00